是否可以在 Windows 窗体应用程序中使用不同语言的 resx 文件?
是否可以在 Windows 窗体应用程序中使用不同语言的 resx 文件,就像在 Web 项目中一样?
我认为您可以设置线程的区域性,并且它应该从正确的文件中读取。
我遇到的问题是如何在 Visual Studio 2008 中为每种语言创建文件,感觉好像我缺少一些非常简单的东西。
谢谢
设拉子
Is it possible to use resx files for different languages in a windows forms application, the same way as in a web project?
I think that you can set the culture of the thread and it should read from the correct file.
The problem I am having is how to create the files for each language in visual studio 2008, feel like there is something very simple that I am missing.
Thanks
Shiraz
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要为您希望支持的每种文化添加一个资源文件。它们将添加到项目中与主资源文件相同的位置,并且必须遵循严格的命名约定。
资源文件的名称需要同时包含国家/地区代码和语言,例如:
但是,如果您知道不需要支持某种语言的区域变化,则只需使用该语言的名称来命名该文件即可语言:
这将取决于您对每个国家/地区进行本地化的重要性和/或用户在看到“错误”文本(例如美国英语/英国英语的颜色/颜色等)
请参阅 此处查看文化代码列表。
注意:我还没有机会验证代码,但它看起来很完整。
You need to include a resource file for each culture you wish to support. These are added to the project in the same location as the main resource file, and must follow a strict naming convention.
The name of the resource file needs to include both the country code and language, for example:
However, if you know that you don't need to support regional variations in a language you can just name the file with the name of that language:
It will depend on how important it is that you localise for each country and/or how upset your users will be if they see the "wrong" text (e.g. color/colour etc. for US English/UK English)
See here for a list of culture codes.
NOTE: I've not had a chance to verify the code, but it looks complete.
只需添加一个资源文件并将其名称更改为语言短名称即可。
例如,如果默认值为 Resources.resx,则对于希伯来语资源,该资源将命名为 Resources.he.resx;对于德语资源,该资源将命名为 Resources.de.resx。
Just add a resource file and change its name to have the language short name.
For example, if the default is Resources.resx, for a resource for Hebrew, the resource will be named Resources.he.resx and for German it will be named Resources.de.resx.