5

So before I used:

 System.Threading.Thread.CurrentThread.CurrentCulture

How to do it in Wp8.1. And why all the deprecated things dont have a good documentation what you can use instead like in xCode?

v.g.
  • 1,076
  • 5
  • 19
  • 38
  • 3
    Why doesn't that line work? There is also [this msdn page](http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.currentuiculture(v=vs.110).aspx), which says it works in WP 8.1 – gunr2171 Sep 24 '14 at 13:11
  • 1
    It works like this CultureInfo.CurrentUICulture.Name – v.g. Sep 24 '14 at 13:16
  • So, you have your answer? If so, self answer using the button below (get some extra rep). – gunr2171 Sep 24 '14 at 13:19
  • CultureInfo.CurrentUICulture.Name.ToString() returns en-EN, despite my OS is in german?? – v.g. Sep 24 '14 at 13:44

1 Answers1

8

CultureInfo.CurrentCulture used to return the region format setting. WP 8.1 seems to return the default language set in the Package.appxmanifest.

Kinda sucks doesn't it? :)

I think it is planned because they want to steer us towards using GlobalizationPreferences instead. So to get back to what you want....you need to do something like this:

CultureInfo ci = new CultureInfo(Windows.System.UserProfile.GlobalizationPreferences.Languages[0]);

It basically creates a CultureInfo based on their prefer top language (which I think is the display UI).

Good luck :)

Chubosaurus Software
  • 8,133
  • 2
  • 20
  • 26
  • Does not really work. My phone was running 'de-DE' and I switched to 'de-CH' to test if the app adapts the currency symbols and stuff. 'de-CH' is on index 1, though it's the primary language. I guess Microsoft has managed to make something easy terribly difficult. – SharpShade Jun 09 '16 at 18:23