Has anyone ever had to deal with these language locales? Specifically, I am working on a .NET client application which passes requests to a Java back-end. This application as a whole needs to support both languages in the subject line of this post. I need to pass locale from the .NET app to the Java app, and I notice that Java supports zh-CN as Chinese (Simplified) and zh-TW as Chinese (Traditional), while .NET uses zh-CHS and zh-CHT, and further, .NET refers to zh-CN as Chinese (People's Republic of China) and zh-TW as Chinese (Taiwan).
Can anyone comment on why this distinction exists? I'm curious as to why .NET breaks out zh-CHT and zh-CHS and zh-CN and zh-TW, whereas Java seems to group zh-CHT and zh-TW together and zh-CHS and zh-CN together. If my .NET client is supposed to support Chinese (Traditional), then the last thing I want to do is hard-code some kind of conversion into the client changing zh-CHT to zh-TW.
I realize there is really no "solution" to this post, I'd just appreciate any comments if you've ever had to deal with this type of situation or something similar. Who knows where it might lead, but it will at least give me greater perspective. Thanks.
As far as I know, there is a CultureInfo class in .Net framework which Provides information about a specific culture (called a "locale" for unmanaged code development). The information includes the names for the culture, the writing system, the calendar used, and formatting for dates and sort strings.
string chineseDateString = "18-一月-2008";
// Chinese Traditional
System.Globalization.CultureInfo nlCulture = new System.Globalization.CultureInfo("zh-CN");
DateTime date = DateTime.Parse(chineseDateString, nlCulture);
//change to US culture
string englishDateString = date.ToString("dd-MMM-yyyy", new System.Globalization.CultureInfo("en-US"));
And perhaps you can try to use it, for more information, please check the URL below.