How to detect OS language in Windows Phone 8.1

跟風遠走 提交于 2019-12-07 04:07:20

问题


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?


回答1:


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 :)



来源:https://stackoverflow.com/questions/26017809/how-to-detect-os-language-in-windows-phone-8-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!