Let's say my application doesn't support culture es-MX so when this is the current setting on the phone I'd like to set the culture to es-ES. Is this possible to do in Windows Phone and if so how?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
This is definitely possible! See this list for cultures and their identifiers
So for example in the App.xaml.cs constructor you could access Thread.CurrentThread.CurrentCulture to determine the actual culture the app is running in. Now if you want to force the UI to use another culture you can do that by setting the CurrentUICulture. For example:
if (Thread.CurrentThread.CurrentCulture.Name.Equals("es-MX"))
{
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("es-ES");
}