c# – UWP:获取当前的CultureInfo
作者:互联网
对于UWP,根据博客条目CultureInfo changes in UWP,CultureInfo有一些变化.我可以使用GlobalizationPreferences正确获取CultureInfo吗?
public CultureInfo GetCurrentCultureInfo()
{
return new CultureInfo(Windows.System.UserProfile.GlobalizationPreferences.Languages[0].ToString());
}
摘自this example.
解决方法:
Can I take GlobalizationPreferences to get the CultureInfo correctly?
是的,你可以,我已经测试了你的方法,它在我身边运作良好.
I want to know the current language of the device (not region).
您还可以使用Windows.Globalization.Language.CurrentInputMethodLanguageTag获取当前启用的键盘布局或输入.
标签:c,net,xamarin-forms,uwp,windows-10-universal 来源: https://codeday.me/bug/20190611/1219048.html