其他語言的國家名單,我可以使用下面的代碼獲得國家名稱的列表,(從什麼地方我不記得複製)獲取除英語
我的問題是,我可以在其他國家的名單泰語等語言?
/// <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's 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;
}
這是否意味着設置currentUiCulture爲'fr'將顯示國名「Allemagne」?這意味着德語用英語。 – Pascal
@Pascal不,它將以.NET Framework的安裝語言。 – CodeCaster