简体   繁体   English

为什么C#CultureInfo.CurrentCulture在Window-7日本文化中赋予en_US?

[英]Why C# CultureInfo.CurrentCulture give en_US in Window-7 Japanese culture?

I have window-7 Ultimate OS.I written below code for get current culture info. 我有window-7 Ultimate OS。我在下面的代码中编写了用于获取当前区域性信息的代码。

        void TestMessage()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;
            CultureInfo culture1 = Thread.CurrentThread.CurrentCulture;
        }

it is working fine with window-8,server 2012 Japanese OS. 在window-8,server 2012 Japanese OS上运行正常。 But it is not working in window-7 only. 但是它仅在window-7中不起作用。 Please look below image of my computer region setting 请看下面我的计算机区域设置的图片 在此处输入图片说明

Can any anyone guide me to get correct culture name? 任何人都可以指导我获得正确的文化名称吗?

Thanks, 谢谢,

There's CurrentCulture and CurrentUICulture. 有CurrentCulture和CurrentUICulture。

  • CurrentCulture: formatting of data (numbers, dates), it is configured in Windows using the tab visible in your screenshot CurrentCulture:数据的格式(数字,日期),它在Windows中使用屏幕快照中可见的选项卡进行配置
  • CurrentUICulture: the language to speak/write to your user, it is configured in Windows using one of the other tabs showing in your screenshot. CurrentUICulture:与用户说/写的语言,在Windows中使用屏幕快照中显示的其他选项卡之一进行配置。 ("Keyboard & Languages" I think) (我认为是“键盘和语言”)

Your screenshot: 您的屏幕截图:

  • ... is showing american numeric notation because CurrentCulture is set to en-US ...正在显示美国数字符号,因为CurrentCulture设置为en-US
  • ... is talking Japanese because CurrentUICulture is very likely set to Japanese ...在说日语,因为CurrentUICulture很可能设置为日语

So, if you need to know what language to use for localization, as is probably your case, you should be using CurrentUICulture. 因此,如果您需要了解使用哪种语言进行本地化(可能是您的情况),则应使用CurrentUICulture。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C#CultureInfo.CurrentCulture说en_US但我的Windows设置设置为南非 - C# CultureInfo.CurrentCulture says en_US but my Windows settings are set to South Africa CultureInfo.CurrentCulture给了我错误的文化 - CultureInfo.CurrentCulture is giving me the wrong culture 如何在C#/ Windows应用商店应用中更改CultureInfo.CurrentCulture - How to change CultureInfo.CurrentCulture in a C#/Windows Store app CultureInfo.CurrentCulture 错误 - CultureInfo.CurrentCulture wrong TimeSpan.ParseExact(“ 000000.000”,“ hhmmss.fff”,CultureInfo.CurrentCulture); 输入的字符串格式不正确C#? - TimeSpan.ParseExact(“000000.000”, “hhmmss.fff”, CultureInfo.CurrentCulture); Input string was not in a correct format C#? 为什么DateTime.ParseExact会因CultureInfo.CurrentCulture失败? - Why would DateTime.ParseExact fail with CultureInfo.CurrentCulture? 如何设置 CultureInfo.CurrentCulture? - How to set CultureInfo.CurrentCulture? ToString(CultureInfo.CurrentCulture)这需要吗? - ToString(CultureInfo.CurrentCulture) Is this needed? .ToString() 和 .ToString(CultureInfo.CurrentCulture) - .ToString() and .ToString(CultureInfo.CurrentCulture) JavaScriptSerializer不使用CultureInfo.CurrentCulture - JavaScriptSerializer not using CultureInfo.CurrentCulture
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM