翻译资源文件 [英] Translating resource files

查看:72
本文介绍了翻译资源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个将其字符串存储在资源文件中的国际化应用程序。  在寻求将这些翻译成其他语言时,我发现很少或根本没有支持,因此我编写了一个Powershell脚本(参见:https://github.com/ekkis/Powershell/blob/master/MT.ps1)
集成到Visual Studio中并进行翻译。


这是我天真的希望,我可以将Microsoft Translator的文件内容(xml格式)交给我,并完成它,但有很多问题:


1。似乎有10241的字符限制,这要求我将文件拆分成块以便单独翻译


2。译者似乎理解xml,即如果我把它交给"< root>"它返回给我"< root>< / root>" - 这意味着在连接资源文件的块时,我得到额外的结束标记,资源不会
编译。


我讨厌认为我要去必须阅读xml,提取标签内的内容并分别翻译,但也许这就是我需要做的。  有人可以建议更好的路径吗?


谢谢我提前,


ekkis




你应该做的是整个法律 - AL。一,40

解决方案

Ekkis


有关翻译在Visual Studio中尝试太:多语种App Toolkit:



http://www.microsoft.com/en-us/translator/mat.aspx



确实在使用HTML模式(contentType = text / HTML)时,传入的HTML块需要是一个格式完整的元素。请注意,API仅理解HTML,并假设哪些标签是句子破坏,哪些是句子内部,
是一个重要的区别。使用纯文本模式时,标签可能会被非法重新排序,您可以安全地仅使用没有属性的简单标签。


在您的情况下,最好的做法是自己解析并将纯文本翻译为纯文本。


感谢您发布脚本!


Chris Wendt

Microsoft Translator


I'm developing an internationalised app that stores its strings in resource files.  in looking to translate these into other languages I've found little or no support, thus I've written a Powershell script (see: https://github.com/ekkis/Powershell/blob/master/MT.ps1) that integrates into Visual Studio and does the translations.

it was my naive hope that I could just hand Microsoft Translator the contents of the file (xml format) and be done with it, but there are a number of problems:

1. there seems to be a character limit of 10241, which requires I break up the file into chunks to be translated separately

2. the translator seems to understand xml i.e. if I hand it "<root>" it returns to me "<root></root>" - which means that in concatenating the chunks of the resource file, I get extra closing tags and the resource won't compile.

I hate to think I'm going to have to read the xml, extract the contents within tags and translate each separately, but perhaps that's what I'll need to do.  could someone here suggest a better path?

thanks i advance,

ekkis


Do what thou wilt shall be the whole of the law -- AL. I. 40

解决方案

Hi Ekkis,

For translation in Visual Studio try MAT: Multilingual App Toolkit:

http://www.microsoft.com/en-us/translator/mat.aspx

Indeed when using HTML mode (contentType=text/HTML) then the chunk of HTML passed in needs to be a well- formed, complete element. Note that the API understands only HTML, and makes assumptions about which tags are sentence breaking and which ones are sentence-internal, an important distinction. When using plain text mode the tags may be reordered illegally, and you can safely use only simple tags without attributes.

Best in your case is to do your own parsing and translate plain text as plain text.

Thanks for publishing your script!

Chris Wendt
Microsoft Translator


这篇关于翻译资源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆