WinRT中的当前文化是错误的 [英] Current Culture is wrong in WinRT

查看:236
本文介绍了WinRT中的当前文化是错误的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在WinRT中使用Current Culture格式化日期时间值。但是CurrentCulture的财产似乎并没有尊重系统文化。

我尝试了以下两个属性,

  System.Globalization.CultureInfo.CurrentCulture.DisplayName 
System.Globalization.CultureInfo.CurrentUICulture.DisplayName

尽管在控制面板中更改了区域,但两者都提供了英语(美国)。但是这对WPF来说工作得很好。我在做什么错了?

解决方案

现代应用程序利用用户语言列表来确定默认的应用程序语言应该是什么应用程序语言用于初始化CurrentCulture和CurrentUICulture。桌面应用程序(wpf)将这些初始化为用户的默认UI语言和语言环境。



以下两种情况之一正在发生:您的应用程序正在使用一组有限的语言资源默认情况下,en-US为默认值,您不在用户语言列表中包含任何这些语言,或者en-US是用户语言列表中的第一种语言,您的应用程序中有资源。

I am trying to format the datetime value using Current Culture in WinRT. But CurrentCulture property not seems to respect the System Culture.

I tried the following two properties,

System.Globalization.CultureInfo.CurrentCulture.DisplayName
System.Globalization.CultureInfo.CurrentUICulture.DisplayName

Both gives English (United States) even though I change the region in Control Panel. But this works perfectly fine for WPF. What am I doing wrong?

解决方案

Modern applications make use of the user language list to determine what the default application language should be and the application language is used to initialize the CurrentCulture and CurrentUICulture. Desktop apps (wpf) initialize these to the user's default UI language and locale.

One of two things is happening: your application is being built with a limited set of language resources that has en-US as the default and you do not include any of these languages in your user language list or en-US is the first language in your user language list for which you have resources in your app.

这篇关于WinRT中的当前文化是错误的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆