简体   繁体   English

如何将 ICU 格式的字符串转换为 TMX(翻译记忆交换)文件?

[英]How do I convert ICU formatted strings into an TMX (Translation memory exchange) file?

I am attempting to aggregate multiple data sources and locales into a single TMX translation memory file .我正在尝试将多个数据源和区域设置聚合到一个TMX 翻译记忆库文件中

I cannot seem to find any good documentation/existing tools on how converting into TMX format might be achieved.我似乎找不到任何关于如何转换为 TMX 格式的好的文档/现有工具。 These converters are the closest thing I have found but they do not appear to be sufficient for formatting ICU syntax . 这些转换器是我发现的最接近的东西,但它们似乎不足以格式化 ICU 语法

Right now I have extracted my strings into JSON format which would look something like this:现在我已经将我的字符串提取为 JSON 格式,它看起来像这样:

{
  foo_id: {
    en: "This is a test",
    fr: "Some translation"
  },
  bar_id: {
    en: "{count, plural, one{This is a singular} other{This is a test for count #}}",
    fr: "{count, plural, one{Some translation} other{Some translation for count #}}"
  }
}

Based on how many translation vendors allow ICU formatting when submitting content and then exporting their TM as .tmx files it feels like this must be a solved problem but information seems scarce, does anyone have experience with this?根据有多少翻译供应商在提交内容时允许 ICU 格式化,然后将他们的 TM 导出为.tmx文件,感觉这必须是一个已解决的问题,但信息似乎很少,有人有这方面的经验吗? I am using formatjs to write the ICU strings.我正在使用formatjs来编写 ICU 字符串。

Since TMX only really supports plain segments with simple placeholders (not plural forms) it's not easy to convert from ICU to TMX.由于 TMX 只真正支持带有简单占位符(不是复数形式)的普通段,因此从 ICU 转换为 TMX 并不容易。

Support for ICU seems pretty patchy in translation tools but there is another format which does a similar job and has better support: .po gettext .在翻译工具中对 ICU 的支持似乎很不完整,但还有另一种格式可以完成类似的工作并且具有更好的支持: .po gettext Going via .po to get to TMX might work:通过 .po 访问 TMX 可能有效:

  1. Use this tool ICU2po to convert from ICU to .po format使用这个工具ICU2po从 ICU 转换为 .po 格式
  2. Import the .po file into a TMS eg Phrase or a CAT tool eg Trados将 .po 文件导入 TMS(例如Phrase)或 CAT 工具(例如Trados)
  3. Run human/machine translation process运行人工/机器翻译流程
  4. Export a TMX导出 TMX

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM