开发者

CultureInfo name for each country

I have country list with two letter code like 'US' and and three letter code like 'USA'. I just want to assign all 239 countries have t开发者_如何学编程he locale code like en-US (not es-US).

I tried the iterate on:

CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.SpecificCultures);

then:

 var country = countries.Where(c => c.CodeIso3 == region.ThreeLetterISORegionName).FirstOrDefault();

it doesnt work, to much override.

how to assign the 239 countries code to with is major(or default) language?

Thanks


There is no way to do that. That is because there is no such thing as default language for many of the countries you have in mind.
For example, US does not have an official language. Although English is used by majority of its citizens, it is not default. The other interesting example would be Switzerland. Its citizens use French, German, Italian and Romansh. None of these is default.

That is the reason why there is no such API.

Edit:

As I said before, in many countries there is no such think as default language. I even gave an example of the country which has more than one major language (German and French). To all of you that still can't understand that this really does not make sense, I will give you a clue on how to guess the most probable language:

Common Locale Data Repository Territory-Language Information

If you still cannot understand why restricting to one language per country is probably not the best of ideas, I give up.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜