Support CurrentUICulture and CurrentCulture

0
0

Hello,

we have the requirement to separate language and culture. ex. English language but Hungarian datetime and number format.

Dotnet uses Thread.CurrentThread.CurrentUICulture and Thread.CurrentThread.CurrentCulture.

We found that Wisej only supports a single culture using Application.CurrentCulture setting CurrentUICulture and CurrentCulture.

Any plans to implement CurrentUICulture as own property within Application?

best regards

Bernhard

  • You must to post comments
0
0

Hi Luca,

I created a sample program.

best regards

Bernhard

  • Bernhard Lang
    Hello Luca. Any Update on this? Best regards Bernhard
  • You must to post comments
0
0

Hello Luca,

We already tried this and is is is not working. If we set Application.CurrentCulture and read it back we still get the old instance back.

static void Main()
{
 var enHU = new CultureInfo("en-HU");
 var huHU = CultureInfo.GetCultureInfo("hu-HU");
 enHU.NumberFormat = huHU.NumberFormat;
 enHU.DateTimeFormat = huHU.DateTimeFormat;
 
 Application.CurrentCulture = enHU;
 if (Application.CurrentCulture == huHU) {
  MessageBox.Show("nothing changed");
 }
 
 Application.MainPage = new Page1();
}
  • Luca (ITG)
    == checks the language code. I run the sample and it works without issues. If your sample doesn’t work please attach it.
  • Bernhard Lang
    It looks like this is only working when changing language. Changing only format has no effect. Using this solution is also strange for ex. de-CH because de-CH has different translations than just de (for de-DE and de-AT) So we either create an de-US culture witch is not working or an de-CH with no hint about the different culture.
  • Bernhard Lang
    We discussed this solution internally and found another problem. A library is using CurrentCulture to pass the culture to an external service and this culture is not defined in the service. Only option we found for this is to set CurrentCulture and CurrentUICulture explicit before calling any service method. Not very convenient.
  • You must to post comments
0
0

Snippet

static void Main()
{
 
	var enHU = new CultureInfo("en-HU");
	var huHU = CultureInfo.GetCultureInfo("hu-HU");
	enHU.NumberFormat = huHU.NumberFormat;
	enHU.DateTimeFormat = huHU.DateTimeFormat;
	
	Application.CurrentCulture = enHU;
 
	Application.MainPage = new Page1();
}

Works well. It’s not a workaround, a culture with english language and hungarian formatting is a custom one by definition.

If you need a custom solution change request, please send the request through the TP channel.

  • You must to post comments
0
0

Hi Alaa,

thank you for you response but CultureAndRegionInfoBuilder is not supported in .net core.

We also tried to clone CultureInfo and set all the format related properties like NumberFormat but WiseJ ignores this when setting Application.CurrentCulture and stays the old value. Even if it would work I would also count this as a work around.

In the dotnet world the UICulture and Culture are very important for any international company.

I understand that this might be a breaking change for WiseJ. Would this possible for WiseJ 4?

best regards

Bernhard

  • You must to post comments
0
0

Hi Bernhard,

It’s best to create your own Culture.

You can check out the MSDN Documentation on how to create your own Culture!

The UI and Culture thread aren’t necessary for what you’re trying to do!
HTH,

Alaa

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.