如何在.Net中获得多语言(人类语言)智能感知
我正在创建一个库(C#、.Net),但我需要将其分发给多个国家/地区的客户。当您向类添加 XML 注释时,智能感知会从程序集中提取注释,并为您提供方法、属性、参数等的详细描述...
有什么方法可以制作程序集的本地化版本,以便XML 注释采用语言环境,但只需要维护源代码的一份副本?
I'm creating a library (C#, .Net), but I need to distribute it to customers in multiple countries. When you add XML comments to your classes, intellisense picks up the comments out of the assembly and gives you a nice description of your methods, properties, arguments, etc...
Is there any way I can make localized versions of my assembly so the XML comments are in the language of the locale, yet only have to maintain one copy of my source code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我知道这是一个相当老的问题,但这是我的谷歌查询的第一次点击,所以我想在这里为其他谷歌用户发布关于这个主题的答案。
然而,我不知道有什么工具可以自动翻译你的 xml 注释,但是如果你自己翻译,你可以将翻译后的 xml 文件与原始文件同名存储在一个子文件夹中,命名为目标区域设置。
因此,我将本地化资源放在子文件夹“de”中,其中存储了所有德语翻译的 xml 注释文件和本地化附属程序集。
当我引用程序集时,IntelliSense 显示本地化文本,因为正在运行的应用程序使用本地化字符串。
I know this is an pretty old one, but it was the first hit to my google-query, so I would like to post my answer here for other google-users on this topic.
Yet, I don't know any tool which translates your xml-comments automatically, but if you do the translation for yourself, you can store the translated xml-file with the same name as the original one in a sub-folder, named by the targeted locale.
So I have my localized resources in a sub-folder 'de', where all German translated xml-comment files and localized satellite assemblies are stored.
When I reference my assembly, IntelliSense shows the localized texts, as the running application uses the localized strings.