Подтвердить что ты не робот

Получить список стран на других языках, кроме английского

Я могу получить список названий стран, используя приведенный ниже код (скопированный откуда-то, я не могу вспомнить)

Мой вопрос: могу ли я получить список стран на других языках, таких как тайский?

    /// <summary>
    /// method for generating a country list, say for populating
    /// a ComboBox, with country options. We return the
    /// values in a Generic List<T>
    /// </summary>
    /// <returns></returns>
    public static List<string> GetCountryList()
    {
        //create a new Generic list to hold the country names returned
        List<string> cultureList = new List<string>();

        //create an array of CultureInfo to hold all the cultures found, these include the users local cluture, and all the
        //cultures installed with the .Net Framework
        CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures);

        //loop through all the cultures found
        foreach (CultureInfo culture in cultures)
        {
            //pass the current culture Locale ID (http://msdn.microsoft.com/en-us/library/0h88fahh.aspx)
            //to the RegionInfo contructor to gain access to the information for that culture
            RegionInfo region = new RegionInfo(culture.LCID);

            //make sure out generic list doesnt already
            //contain this country
            if (!(cultureList.Contains(region.EnglishName)))
                //not there so add the EnglishName (http://msdn.microsoft.com/en-us/library/system.globalization.regioninfo.englishname.aspx)
                //value to our generic list
                cultureList.Add(region.EnglishName);
        }
        return cultureList;
    }
4b9b3361

Ответ 1

http://msdn.microsoft.com/en-us/library/system.globalization.regioninfo.displayname.aspx

Свойство DisplayName отображает название страны/региона на языке локализованной версии .NET Framework. Например, свойство DisplayName отображает страну/регион на английском языке на английской версии .NET Framework, и на испанском языке на испанской версии .NET Framework.

Итак, похоже, что нет списка названий стран на каждом языке в .NET Framework, только на том языке, на котором установлена ​​.NET Framework.

Ответ 2

Использовать DisplayName (дает имя в текущей структуре Framework) или NativeName (дает имя в родной культуре) вместо EnglishName.