[ACCEPTED]-C# - How can I get the language name from the language code?-internationalization

Accepted answer
Score: 25
Console.WriteLine(new CultureInfo("en").DisplayName);

Note that DisplayName will format the name 2 for the currently set language. If you want 1 it to always be in English, use EnglishName.

Score: 2

Something like this will work:

var allCultures = CultureInfo.GetCultures(CultureTypes.AllCultures);
var en = allCultures.FirstOrDefault (c => c.Name == "en").DisplayName;
var de = allCultures.FirstOrDefault (c => c.Name == "de").DisplayName;

CultureInfo.DisplayName will contain 1 what you are looking for.

Score: 0

I just found this: http://www.csharp-examples.net/culture-names/

not sure if it helps.

0

More Related questions