.NET Framework 本地化版本中的差异
我想知道 .net 框架的本地化版本 在应用程序下运行相同的区域性代码(即应用程序未本地化)。
到目前为止,我了解到:
- 异常消息已本地化,因此以外语显示
- 框架中的国家/地区名称已本地化
还有其他需要注意的吗?
更新:我正在为 3.5 框架编写 winform
I am wondering what the differences are in localised versions of the.net frameworks running under application the same culture code (i.e. application is not localised).
So far I understand that:
- Exception Messages are localised so appear in foreign language
- The Names of countries in the framework are localised
is there anything else to be aware of?
Update: I am writing winforms for the 3.5 framework
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是通过卫星组件完成的。您可以看到可以使用 Reflector 本地化哪些内容。单击程序集的资源节点并选择 .resources 条目。其中有相当多,但我只看到异常消息的字符串和“属性”窗口中可见的属性描述。国家/地区名称已本地化。
This is done with satellite assemblies. You can see what can be localized with Reflector. Click the Resources node for an assembly and select the .resources entry. There's rather a lot of it, but I only see strings for exception messages and property descriptions visible from the Properties window. Country names are already localized.
需要注意的一个问题是数字的字符串表示形式。例如,在使用“,”作为小数点分隔符的丹麦文化中,“3.141”将解析为 3141,即“.”。被解释为千位分隔符。
此外,DateTime.ToString() 返回数据的本地化表示,而 DateTime.Parse() 以本地化方式进行解析。
如果您要从自己的应用程序以外的源读取数据或将其发送到应用程序,则强烈建议您使用
CultureInfo.InvariantCulture
,因为这在各个区域设置中都是一致的。对于向用户显示的数据,请遵循当地文化。One gotcha to be aware of is the string representations of numbers. For example, in a Danish culture, which uses "," as its decimal separator, "3.141" will parse to 3141, as "." is interpreted as a thousands separator.
Additionally, DateTime.ToString() returns localized representations of data, and DateTime.Parse() parses in a localized manner.
If you are reading data from a source other than your own application or sending it to one, it is highly recommended that you use
CultureInfo.InvariantCulture
, as this will be consistent across locales. For data displayed to the user, stick to the local culture.