如何从代码中获取Windows Phone系统语言? [英] How to get the Windows Phone system language from code?
本文介绍了如何从代码中获取Windows Phone系统语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案: 使用CultureInfo.CurrentUICulture
用户可以在以下位置更改Windows Phone的系统语言: 设置>语言+区域>手机语言
User can change the system language of Windows Phone at: Settings > language+region > Phone language
如何从C#代码中获取选定的语言(电话语言)?
How can I get the selected language (Phone language) from C# code?
以下是我的手机设置:
这是我的代码段:
System.Diagnostics.Debug.WriteLine(
"************************************* CultureInfo.CurrentCulture.Name = " + CultureInfo.CurrentCulture.ToString() + ", " +
"CultureInfo.CurrentCulture.CompareInfo = " + CultureInfo.CurrentCulture.CompareInfo + ", " +
"CultureInfo.CurrentCulture.DisplayName = " + CultureInfo.CurrentCulture.DisplayName + ", " +
"CultureInfo.CurrentCulture.EnglishName = " + CultureInfo.CurrentCulture.EnglishName + ", " +
"CultureInfo.CurrentCulture.Name = " + CultureInfo.CurrentCulture.Name + ", " +
"CultureInfo.CurrentCulture.NativeName = " + CultureInfo.CurrentCulture.NativeName + ", " +
"CultureInfo.CurrentCulture.TextInfo = " + CultureInfo.CurrentCulture.TextInfo
);
以下是输出:
CultureInfo.CurrentCulture.Name = zh-HK,
CultureInfo.CurrentCulture.CompareInfo = CompareInfo - zh-HK,
CultureInfo.CurrentCulture.DisplayName = Chinese (Traditional, Hong
Kong SAR), CultureInfo.CurrentCulture.EnglishName = Chinese
(Traditional, Hong Kong SAR), CultureInfo.CurrentCulture.Name = zh-HK,
CultureInfo.CurrentCulture.NativeName = 中文(香港特別行政區),
CultureInfo.CurrentCulture.TextInfo = TextInfo - zh-HK
我找不到电话语言"
推荐答案
使用System.Threading.Thread.CurrentThread.CurrentCulture
.它应该正确反映电话的语言.
Use System.Threading.Thread.CurrentThread.CurrentCulture
. It should correctly reflect the phone language.
这篇关于如何从代码中获取Windows Phone系统语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文