views:

136

answers:

2

Hello, quick question, what's the best way to convert language a abbreviation to full name? e.g. en to English? Note, it's not en-US, it's just en, fr, de

C# please.

+5  A: 

I'm not sure you can get it from just en... You can do this though if you know the rest of the abbrevation:

System.Globalization.RegionInfo info = new System.Globalization.RegionInfo("en-GB");
string countryName = info.EnglishName;

Edit: Actually, you can do it:

CultureInfo info = new CultureInfo("en");
string englishName = info.EnglishName;
GenericTypeTea
And code did follow :)
Brian
Damn right it has.
GenericTypeTea
Why didn't you just use CultureInfo the same way you used RegionInfo (see my answer)? Your version is overcomplicated.
Brian
Very true, changed it and +1ed you.
GenericTypeTea
Worked well, thanks
aron
+3  A: 
        System.Globalization.CultureInfo x = new CultureInfo("en");
        string name = x.EnglishName;
Brian