danielovich
danielovich

Reputation: 9687

Fundamental change in how to specify culture in a Windows 8 app

From OnLaunched in App.cs

this is working...

Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = "da-DK";

but neither of these are...

System.Globalization.CultureInfo.DefaultThreadCurrentUICulture = new System.Globalization.CultureInfo("da-DK");
System.Globalization.CultureInfo.DefaultThreadCurrentCulture = new System.Globalization.CultureInfo("da-DK");

I haven't reflectored it but shouldn't the latter be just as good ?

I am missing a point here ?

Upvotes: 2

Views: 2003

Answers (1)

Leon Lucardie
Leon Lucardie

Reputation: 9730

The difference between the two is that System.Globalization.CultureInfo.DefaultThreadCurrentCulture = new System.Globalization.CultureInfo("da-DK"); is meant for defining the default culture of newly created threads. This means threads that are already running are not affected by it. To change the culture of a already runnning thread, you need to use the System.Globalization.CultureInfo.CurrentCulture property inside that running thread.

Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = "da-DK";

has a wider scope and will also modify the already running threads. But it's meant to be used more as a "language selection" within the application and not as a replacement for CultureInfo (which is not only used for language, but also for conversion, metrics, formatting etc.)

Upvotes: 3

Related Questions