Convert language abbreviation to full name, e.g. en to English?

筅森魡賤 提交于 2019-12-21 06:27:36

问题


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.


回答1:


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;



回答2:


        System.Globalization.CultureInfo x = new CultureInfo("en");
        string name = x.EnglishName;


来源:https://stackoverflow.com/questions/1723723/convert-language-abbreviation-to-full-name-e-g-en-to-english

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!