views:

349

answers:

2

I'm trying to localize my Silverlight 3.0 app to Simplified Chinese.

However, when I attempt to switch to that culture (zh-Hans, according to http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo%28VS.95%29.aspx) with this code:

var currentCulture = new CultureInfo("zh-Hans");
Thread.CurrentThread.CurrentCulture = currentCulture;
Thread.CurrentThread.CurrentUICulture = currentCulture;

I get the following exception:

Culture name 'zh-Hans' is not supported.

I'm using Windows XP SP3 on an en-GB machine.

Is this a problem with Silverlight 3? Or do I need to install some extra Windows XP language packs?

Thanks

A: 

That would be because zh-Hans is a neutral culture code. If you are looking for simplified Chinese your choices are zh-CN (Simplified, People's Republic of China) and zh-SG (Simplified, Singapore). Unfortunately the .Net framework does not truly support neutral cultures currently.

Danny Park
Thanks for that tip. Unfortunately I'm still getting the following exception: "Culture name 'zh-CN' is not supported.", even when using one of the "non-neutral" cultures suggested: var currentCulture = new CultureInfo("zh-CN");
David Laing
Turns out that once I had enabled East Asian languages in WinXP I can switch to zn-Hans in Silverlight 3.0.
David Laing
A: 

The problem turned out to be that my installation of Windows XP (default en-GB) didn't have the files for East Asian languages installed by default.

Enabling these was quite simple - see http://newton.uor.edu/Departments&Programs/AsianStudiesDept/Language/asianlanguageinstallation%5FXP.html for instructions.

After I'd done that, I was able to change Silverlight 3.0 to zn-Hans and zn-SG

var currentCulture = new CultureInfo("zh-Hans");

or

var currentCulture = new CultureInfo("zh-SG");

etc.

David Laing