简体   繁体   中英

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.

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 ?

Can we still use LCID as the key ?

Thanks for your answer

"Chinese (Simplified)" and "Chinese (Simplified) Legacy" refers to the same culture (same LCID). You can use LCID as the key.

This was a change introduced in .NET Framework 4 to follow the naming convention LanguageName ([Script,] Country/RegionName).

The display names of Chinese cultures have changed to follow the naming convention 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM