how to get all culture names in the .NET Framework.

Prabhukiran345
Posted by Prabhukiran345 under .NET Framework category on | Points: 40 | Views : 971
This example shows how to get all culture names in the .NET Framework. Use static method CultureInfo .Get­Cultures . To get associated specific culture use static method CultureInfo.Cre­ateSpecificCul­ture .

// get culture names
List<string> list = new List<string>();
foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.AllCultures))
{
string specName = "(none)";
try { specName = CultureInfo.CreateSpecificCulture(ci.Name).Name; } catch { }
list.Add(String.Format("{0,-12}{1,-12}{2}", ci.Name, specName, ci.EnglishName));
}
list.Sort(); // sort by name
// write to console
Console.WriteLine("CULTURE SPEC.CULTURE ENGLISH NAME");
Console.WriteLine("--------------------------------------------------------------");
foreach (string str in list)
Console.WriteLine(str);

OUTPUT:
CULTURE SPEC.CULTURE ENGLISH NAME
--------------------------------------------------------------
Invariant Language (Invariant Country)
af af-ZA Afrikaans
af-ZA af-ZA Afrikaans (South Africa)
ar ar-SA Arabic
ar-AE ar-AE Arabic (U.A.E.)
ar-BH ar-BH Arabic (Bahrain)
ar-DZ ar-DZ Arabic (Algeria)
ar-EG ar-EG Arabic (Egypt)
ar-IQ ar-IQ Arabic (Iraq)
ar-JO ar-JO Arabic (Jordan)
ar-KW ar-KW Arabic (Kuwait)
ar-LB ar-LB Arabic (Lebanon)
ar-LY ar-LY Arabic (Libya)
ar-MA ar-MA Arabic (Morocco)
ar-OM ar-OM Arabic (Oman)
ar-QA ar-QA Arabic (Qatar)
ar-SA ar-SA Arabic (Saudi Arabia)
ar-SY ar-SY Arabic (Syria)
ar-TN ar-TN Arabic (Tunisia)
ar-YE ar-YE Arabic (Yemen)
az az-Latn-AZ Azeri
az-Cyrl-AZ az-Cyrl-AZ Azeri (Cyrillic, Azerbaijan)
az-Latn-AZ az-Latn-AZ Azeri (Latin, Azerbaijan)
be be-BY Belarusian
be-BY be-BY Belarusian (Belarus)
bg bg-BG Bulgarian
bg-BG bg-BG Bulgarian (Bulgaria)
bs-Latn-BA bs-Latn-BA Bosnian (Bosnia and Herzegovina)
ca ca-ES Catalan
ca-ES ca-ES Catalan (Catalan)
cs cs-CZ Czech
cs-CZ cs-CZ Czech (Czech Republic)
cy-GB cy-GB Welsh (United Kingdom)
da da-DK Danish
da-DK da-DK Danish (Denmark)
de de-DE German
de-AT de-AT German (Austria)
de-DE de-DE German (Germany)
de-CH de-CH German (Switzerland)
de-LI de-LI German (Liechtenstein)
de-LU de-LU German (Luxembourg)
dv dv-MV Divehi
dv-MV dv-MV Divehi (Maldives)
el el-GR Greek
el-GR el-GR Greek (Greece)
en en-US English
en-029 en-029 English (Caribbean)
en-AU en-AU English (Australia)
en-BZ en-BZ English (Belize)
en-CA en-CA English (Canada)
en-GB en-GB English (United Kingdom)
en-IE en-IE English (Ireland)
en-JM en-JM English (Jamaica)
en-NZ en-NZ English (New Zealand)
en-PH en-PH English (Republic of the Philippines)
en-TT en-TT English (Trinidad and Tobago)
en-US en-US English (United States)
en-ZA en-ZA English (South Africa)
en-ZW en-ZW English (Zimbabwe)
es es-ES Spanish
es-AR es-AR Spanish (Argentina)
es-BO es-BO Spanish (Bolivia)
es-CL es-CL Spanish (Chile)
es-CO es-CO Spanish (Colombia)
es-CR es-CR Spanish (Costa Rica)
es-DO es-DO Spanish (Dominican Republic)
es-EC es-EC Spanish (Ecuador)
es-ES es-ES Spanish (Spain)
es-GT es-GT Spanish (Guatemala)
es-HN es-HN Spanish (Honduras)
es-MX es-MX Spanish (Mexico)
es-NI es-NI Spanish (Nicaragua)
es-PA es-PA Spanish (Panama)
es-PE es-PE Spanish (Peru)
es-PR es-PR Spanish (Puerto Rico)
es-PY es-PY Spanish (Paraguay)
es-SV es-SV Spanish (El Salvador)
es-UY es-UY Spanish (Uruguay)
es-VE es-VE Spanish (Venezuela)
et et-EE Estonian
et-EE et-EE Estonian (Estonia)
eu eu-ES Basque
eu-ES eu-ES Basque (Basque)
fa fa-IR Persian
fa-IR fa-IR Persian (Iran)
fi fi-FI Finnish
fi-FI fi-FI Finnish (Finland)
fo fo-FO Faroese
fo-FO fo-FO Faroese (Faroe Islands)
fr fr-FR French
fr-BE fr-BE French (Belgium)
fr-CA fr-CA French (Canada)
fr-FR fr-FR French (France)
fr-CH fr-CH French (Switzerland)
fr-LU fr-LU French (Luxembourg)
fr-MC fr-MC French (Principality of Monaco)
gl gl-ES Galician
gl-ES gl-ES Galician (Galician)
gu gu-IN Gujarati
gu-IN gu-IN Gujarati (India)
he he-IL Hebrew
he-IL he-IL Hebrew (Israel)
hi hi-IN Hindi
hi-IN hi-IN Hindi (India)
hr hr-HR Croatian
hr-BA hr-BA Croatian (Bosnia and Herzegovina)
hr-HR hr-HR Croatian (Croatia)
hu hu-HU Hungarian
hu-HU hu-HU Hungarian (Hungary)
hy hy-AM Armenian
hy-AM hy-AM Armenian (Armenia)
i

Comments or Responses

Login to post response