0

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

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
liuzhidong
  • 538
  • 3
  • 18
  • LCID is an old number, dates from versions of Windows released in the previous century. Kept around merely for compatibility with old code, COM Automation in particular. Just a language identifier, it is no longer a reliable way to distinguish between cultures. – Hans Passant Oct 23 '14 at 10:05

1 Answers1

0

"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.

kennyzx
  • 12,845
  • 6
  • 39
  • 83