.net 中文代码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/732109/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Chinese language codes
提问by Dave K
We are updating an old .net 1.1 website to 2.0. The site currently supports Chinese (Traditional) & Chinese (Simplified)
我们正在将旧的 .net 1.1 网站更新到 2.0。本站目前支持中文(繁体)和中文(简体)
I'm getting a run time error when trying to detect the language & culture using the codes: zh-CHS (simified) & zh-CHT (traditional):
尝试使用以下代码检测语言和文化时出现运行时错误:zh-CHS(简化版)和 zh-CHT(传统版):
Please select a specific culture, such as zh-CN, zh-HK, zh-TW, zh-MO, zh-SG.
请选择特定的文化,例如 zh-CN、zh-HK、zh-TW、zh-MO、zh-SG。
From: System.Globalization.CultureInfo.CreateSpecificCulture(String name)
来自:System.Globalization.CultureInfo.CreateSpecificCulture(字符串名称)
It appears these are outdated language/culture codes. Does anyone have any insights as to how I might map these languages to specific countries / cultures that are supported?
看来这些是过时的语言/文化代码。有没有人对我如何将这些语言映射到支持的特定国家/地区/文化有任何见解?
回答by Nicolas Webb
I'd take a look here:
我会在这里看看:
http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.parent(VS.80).aspx
http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.parent(VS.80).aspx
Specifically,
具体来说,
/*
This code produces the following output.
SPECIFIC CULTURE PARENT CULTURE
0x0404 zh-TW Chinese (Taiwan) 0x7C04 zh-CHT Chinese (Traditional)
0x0804 zh-CN Chinese (People's Republic of China) 0x0004 zh-CHS Chinese (Simplified)
0x0C04 zh-HK Chinese (Hong Kong S.A.R.) 0x7C04 zh-CHT Chinese (Traditional)
0x1004 zh-SG Chinese (Singapore) 0x0004 zh-CHS Chinese (Simplified)
0x1404 zh-MO Chinese (Macau S.A.R.) 0x7C04 zh-CHT Chinese (Traditional)
*/
and:
和:
The list of cultures in the Windows API is slightly different from the list of cultures in the .NET Framework. For example, the neutral culture zh-CHT "Chinese (Traditional)" with culture identifier 0x7C04 is not available in the Windows API. If interoperability with Windows is required (for example, through the p/invoke mechanism), use a specific culture that is defined in the operating system. This will ensure consistency with the equivalent Windows locale, which is identified with the same LCID.
Windows API 中的区域性列表与 .NET Framework 中的区域性列表略有不同。例如,具有文化标识符 0x7C04 的中性文化 zh-CHT“中文(繁体)”在 Windows API 中不可用。如果需要与 Windows 的互操作性(例如,通过 p/invoke 机制),请使用操作系统中定义的特定区域性。这将确保与使用相同 LCID 标识的等效 Windows 区域设置保持一致。
I would stick with zh-CN for the Simplified and probably just pick one of the others for Traditional - maybe most of your Traditional users are from Taiwan?
对于简体,我会坚持使用 zh-CN,而对于繁体,我可能只选择其中一个——也许您的大多数繁体用户都来自台湾?
回答by CookieOfFortune
Simplified: CN (Mainland China), SG(Singapore). Traditional: TW (Taiwan), MO (Macau), HK (Hong Kong).
简体:CN( CN 大陆),SG(新加坡)。繁体:TW(台湾)、MO(澳门)、HK(香港)。

