0

I have C# code for as Windows Store app that returns the app language information. If my app is configured to support "fr" and the device is set to that language, then the app determines that the app language information is "fr".

But if the app is not configured to support "es" and the device is set to that particular language, "es", I can not find a way to detect the device settings. I only get the default app language.

I believe that it is not possible to get the device information, only to get the information that the device passes on to the app about what language to use. But I need to ask this to be sure, since my project depends a lot on the device and app language settings.

To be blunt, I want to write the app to support only English but be able to tell the user that their device is configured for French, or Spanish, etc.... Is there a trick that can make this work?

Here is the code that tells me selected language code that the app can see. Note that this will not tell me the device settings if the device language is not supported by the app:

using System.Globalization;
...
CultureInfo ci = CultureInfo.CurrentUICulture;
Data.Add( "language", ci.TwoLetterISOLanguageName ); //My own code that adds the two letter code special data object
David Rector
  • 958
  • 9
  • 31

1 Answers1

2

I found an answer in this thread:

How to get actual language in a WinRT app?

Using Windows.System.UserProfile.GlobalizationPreferences.Languages[0] will give me the language setting that the user sets in the Metro-style PC settings under Time and Language. This selection does not appear to change the Windows operating system display language, which is what I really want. But this does appear to change automatically when the OS display language is changed, so it is probably the proper feature to use for this purpose.

That other thread was about the Windows Phone, but this works in my Windows 8 Store app in C#.

Community
  • 1
  • 1
David Rector
  • 958
  • 9
  • 31