我什么时候应该使用“不变语言(不变国家)”?作为程序集的中性语言?
目前我可以想到三种情况:
- 不包含任何资源
- 控制库的程序集,在其资源文件库中仅包含图像(即 ToolBoxBitmaps)
- ,仅包含用于引发异常的文本(我们不希望用户无论如何,我们可以看到这些吗?;-) )
我对这些案例是否正确,还有其他我现在没有看到的吗?
At the moment I can think of three cases:
- assemblies that don't contain any resources
- control libraries that only contain images (ie. ToolBoxBitmaps) within their resource files
- libraries that contain only text used for throwing exceptions (we don't want the user to see those anyway, do we? ;-) )
Am I right with these cases or not, and are there others I don't see right now?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
仅仅因为库仅包含非文本资源并不意味着它不需要本地化。图像可能也需要本地化,要么因为它们包含文本,要么因为它们受到文化偏见的显着影响(当然,据我所知,目前没有主要应用程序仅出于这个原因本地化图像)。还可能存在特定于语言/文化的声音文件。
此外,仅仅因为库中唯一的文本是异常文本并不意味着库不需要本地化。即使您可能不希望用户看到您的异常文本,您的开发人员仍然会看到它;并且并非所有开发人员都使用相同的语言。由于这个原因,BCL 中的所有异常文本都被本地化。
我真的不认为使用不变文化作为程序集的中性语言有任何优势。如果程序集中有资源,则应该对这些资源使用本机区域性。如果不这样做,也没关系,因此您不妨使用开发程序集(或最有可能使用)的本机文化,这样如果添加资源,则不必更改任何内容将来。
Just because the a library contains only non-text resources does not mean that it doesn't need to be localized. Images may need to be localized too, either because they contain text, or because they are significantly influenced by cultural biases (granted, I know of no major applications that currently localize images for only that reason). There may also be language/culture-specific sound files.
Also, just because the only text in the library is exception text also does not mean that the library does not need to be localized. Even though you may not want the user to ever see your exception text, your developers will still see it; and not all developers speak the same language. All exception text in the BCL is localized for this reason.
I don't really see any advantage to ever using the invariant culture as the neutral language for an assembly. If you have resources in the assembly, you should use the native culture for those resources. If you don't, it doesn't really matter, so you might as well use the native culture in which the assembly is developed (or most likely to be used), so you don't have to change anything if you add resources in the future.