Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there any way I can get the OS language like Chinese (Simplified). I tried with CultureInfo.CurrentCulture.EnglishName but on certain languages like Portuguese Brazil, Chinese (Simplified), etc., it retrieves English. Can anybody help me with this.
Posted

If it retrieves English, it means the CurrectCulture is English. I suspect you're confusing using some language with culture. You see, .NET fully supports Unicode; internally, all strings are represented in memory using Unicode encoding UTF-16, one or two 16-bit words per characters (two words are called surrogate pair and used to represent characters beyond BMP, Basic Multilingual Plain). It allows program to work with any language (and even with several different language in one control like a Label, TextBox or TextBlock) no matter what culture is assigned to a thread. Culture is something associated to language but independent on it. It defines what satellite assemblies will be used (if any) and also such thing as representation of numerals, date/time, etc.

I hope this is the only problem. Please check up what culture was really assigned to a thread. If you cannot see it, try to assign it explicitly and read back; I think you should get matching results.

See also:
http://unicode.org/[^],
http://unicode.org/faq/utf_bom.html[^].

—SA
 
Share this answer
 
Comments
sonia$cool 24-Aug-11 10:18am    
Thanks for the information. I actually want to retrieve the language name in english. When my app is run on different machines with other language OS, it should retrieve the language same as that of the OS. But I see on certain OS like Brazilian, Chinese (Simplified), Hungarian, etc., it is retrieved as English, English (United States) when I use CultureInfo.CurrentCulture.EnglishName.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900