Windows 运行时:如何获取用户的首选语言列表?

发布于 2024-12-25 06:00:31 字数 667 浏览 3 评论 0原文

WinRT 类型的某些构造函数接受语言的 IEnumerable 来尝试解析语言选择。例如,有 a Windows.Globalization.NumberFormatting。 CurrencyFormatter 构造函数,它采用语言列表来尝试确定货币格式化程序的语言选择。

我知道访问用户语言的唯一方法是默认构造 Windows.Globalization.Language 对象并访问 Id 属性。如果用户设置了首选语言列表,如何才能按照他们指定的优先级顺序获取完整列表?

Some constructors of WinRT types accept an IEnumerable<string> of languages to try in resolving a choice of language. For example, there is a Windows.Globalization.NumberFormatting.CurrencyFormatter constructor that takes a list of languages to try in determining the choice of language of the currency formatter.

The only method I know of to access the user's language is to default-construct a Windows.Globalization.Language object and access the Id property. If the user has set a list of preferred languages, how is it possible to obtain the full list in the priority order that they specified?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

假面具 2025-01-01 06:00:31

我认为这个属性正是您所需要的: GlobalizationPreferences.Languages。请参阅 MSDN 页面上的 GlobalizationPreferences 类 了解更多信息。

I think this property is what you need: GlobalizationPreferences.Languages. See the MSDN page on the GlobalizationPreferences class for more info.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文