Mohammed Thabet
Mohammed Thabet

Reputation: 21667

Get culture based on language

How can I get culture based on language ? For example if I will pass language = CHS it will retrieve zh-CN based on National Language Support (NLS) API Reference: http://msdn.microsoft.com/en-us/goglobal/bb896001.aspx

I belive .Net framework should provide us with method that support that .

your responce will be highly appreciated !

Upvotes: 2

Views: 871

Answers (1)

Oded
Oded

Reputation: 498904

This will give you a list of matching cultures:

CultureInfo.GetCultures(CultureTypes.AllCultures)
.Where(c => c.ThreeLetterWindowsLanguageName == "CHS")

You may want to use CultureTypes.SpecificCultures instead of CultureTypes.AllCultures.

Upvotes: 6

Related Questions