简体   繁体   English

为什么我们从CultureInfo.GetCultures(CultureTypes.AllCultures)获得相同的CultureInfo.LCID

[英]Why we get the same CultureInfo.LCID from CultureInfo.GetCultures(CultureTypes.AllCultures)

Our code is simple, get the cultures and put them in a dropdown list control. 我们的代码很简单,了解区域性并将它们放在下拉列表控件中。

items = new SortedDictionary<int, string>();
foreach (CultureInfo info in CultureInfo.GetCultures(CultureTypes.AllCultures))
{
    string value = string.Format(System.Globalization.CultureInfo.CurrentCulture, "{0} - {1}", info.LCID, info.DisplayName);
    if (!items.ContainsKey(info.LCID))
    {
         items.Add(info.LCID, value);
    }
}

We want to use LCID as our key to the dictionary. 我们想使用LCID作为字典的键。

However, sometimes we get the same LCID value, for example, when LCID is 4, the displayname is "Chinese (Simplified)" or "Chinese (Simplified) Legacy", what it the difference between these CultureInfo ? 但是,有时我们会获得相同的LCID值,例如,当LCID为4时,显示名称为“中文(简体)”或“中文(简体)传统”,这两个CultureInfo有什么区别?

Can we still use LCID as the key ? 我们还可以使用LCID作为密钥吗?

Thanks for your answer 感谢您的回答

"Chinese (Simplified)" and "Chinese (Simplified) Legacy" refers to the same culture (same LCID). “简体中文”和“繁体中文”是指相同的文化(相同的LCID)。 You can use LCID as the key. 您可以使用LCID作为密钥。

This was a change introduced in .NET Framework 4 to follow the naming convention LanguageName ([Script,] Country/RegionName). 这是.NET Framework 4中引入的更改,以遵循命名约定LanguageName([Script,] Country / RegionName)。

The display names of Chinese cultures have changed to follow the naming convention LanguageName ([Script,] Country/RegionName). 中国文化的显示名称已更改为遵循命名约定LanguageName([Script,] Country / RegionName)。 In the .NET Framework 4, the word "Legacy" has been appended to the zh-CHS and zh-CHT display names to differentiate them from zh-Hans and zh-Hant. 在.NET Framework 4中,单词“ Legacy”已附加到zh-CHS和zh-CHT显示名称中,以区别于zh-Hans和zh-Hant。

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

相关问题 为什么 CultureInfo.GetCultures(CultureTypes.AllCultures) 中缺少某些文化? - Why are certain cultures missing from CultureInfo.GetCultures(CultureTypes.AllCultures)? 为什么CultureInfo.GetCultures(CultureTypes.SpecificCultures)在不同的计算机上返回不同的文化集 - Why does CultureInfo.GetCultures(CultureTypes.SpecificCultures) return different sets of cultures on different computers 为什么不在CultureInfo.GetCultures()中展示所有国家/地区? - Why not all countries are presented in CultureInfo.GetCultures()? CultureInfo.GetCultures (CultureTypes.NeutralCultures) DisplayName 属性在应用程序发布时给出不同的结果 - CultureInfo.GetCultures (CultureTypes.NeutralCultures) DisplayName property gives different results when the application is published 什么是CultureInfo.GetCultures是.NET Core - What is the equivalent of CultureInfo.GetCultures is .NET Core 在.NET Windows应用商店应用中替换CultureInfo.GetCultures - Replacement for CultureInfo.GetCultures in .NET Windows Store apps 请求 CultureTypes.AllCultures 时缺少某些文化 - Some cultures are missing when requesting CultureTypes.AllCultures 获取独立于 CultureInfo.Calendar 的 DateTime - Get DateTime independent from CultureInfo.Calendar 如何从 CultureInfo 获取国家代码? - How to get the country code from CultureInfo? 如何从CultureInfo获得没有国家的语言 - How to get language without country from CultureInfo
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM