开发者

Why don't I have a zh-HK CultureInfo in the RTM Windows Phone 7 SDK?

When I try to create a CultureInfo for zh-HK using the Windows Phone 7 RTM SDK, I get a System.ArgumentException with "Value does not fall within the expected ra开发者_C百科nge.".

This is using the ENU variant of the SDK (US / English).

http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo(v=VS.95).aspx specifically uses the "zh-HK" identifier.

The exact code is:

var culture = new CultureInfo("zh-HK"); // Throws ArgumentException


That MSDN document is specific to Silverlight 4. It doesn't state that all listed cultures are available on the phone. In fact:

During initial availability, Windows Phone 7 will support 5 languages; English, French, Italian, German and Spanish.

From http://windowsteamblog.com/windows_phone/b/windowsphone/archive/2010/07/13/windows-phone-7-getting-connected.aspx

I suspect that is why the Chinese (Hong Kong SAR, PRC) culture is not supported. There aren't even any Chinese region format settings on the device.
If you want to do something specific for phones that will be used in Hong Kong, I would recommend using CurrentCulutre or CurrentUICultre as appropriate.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜