我需要一个 .NET 3.5 支持的文化列表,无论使用什么操作系统.这似乎很难获得,虽然我不知道为什么!
I need a list of cultures that are supported by .NET 3.5, regardless of the OS used. This seems to be quite a struggle to obtain, though I am not sure why!
啊,我不知道它依赖于操作系统,这可以解释缺乏文档.关于 Mac/Linux 操作系统也支持什么的任何想法?
Arghh, I was not aware that it is dependent on the OS, that would explain the lack of documentation. Any ideas on what is supported by Mac/Linux OS as well?
谢谢:)
不幸的是,它依赖于操作系统.查看此处了解每个操作系统的默认语言支持.
Unfortunately, it is OS dependent. Check here for default language support per OS.
请注意,CultureInfo 文档 警告:
Windows 版本或服务包可以更改可用的文化.
Windows versions or service packs can change the available cultures.
在 ASP.NET 中,与操作系统相比,重要的是浏览器.它可以通过 Accept-Language (第 14.4 节)请求标头.如果您将应用的 全球化 配置设置为 enableClientBasedCulture="true", ASP.NET 将尝试自动将 UICulture 和 Culture 设置为浏览器提供的值.或者,您可以通过检查 Request.UserLanguages 手动设置文化 属性:
In ASP.NET, it's the browser that's important versus the OS. It can tell you which language the user prefers via the Accept-Language (Section 14.4) request header. If you set your app's globalization configuration to enableClientBasedCulture="true", ASP.NET will try to automatically set the UICulture and Culture to the value provided by the browser. Alternatively, you can set Culture manually by inspecting the Request.UserLanguages property:
很遗憾,无法从操作系统或浏览器生成详尽的可能语言列表.最接近的是 IANA 语言子标签注册表.这是 RFC 4646 中描述的语言注册表 - 定义 .NET 的 CultureInfo 标记的文档.
Unfortunately, there's no way to generate an exhaustive list of possible languages from an OS or browser. The closest thing is the IANA Language Subtag Registry. This is the language registry described in RFC 4646 - the document that defines .NET's CultureInfo tags.
请记住,Request.UserLanguages 中的语言标签不保证有效.你会想要检查它们.HTTP 1.1 对 语言标签 使用较旧的建议,并且有没有什么能阻止某人在语言标题中发送乱码.
Keep in mind, language tags in Request.UserLanguages are not guaranteed to be valid. You'll want to check them. HTTP 1.1 uses an older recommendation for language tags and there's nothing stopping someone from sending gibberish in the language header.
这篇关于.NET 3.5 中的 CultureInfo 类支持哪些文化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!