Angular 6:i18n:如何更新已翻译的现有 .xlf 文件? [英] Angular 6: i18n: How to update an existing .xlf file that has already been translated?

查看:46
本文介绍了Angular 6:i18n:如何更新已翻译的现有 .xlf 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Angular 6 中,现在我想我理解了如何制作 i18n 文件并使用它们(例如 https://angular.io/guide/i18n),我想知道上述文件的维护.如果我进入并更改 html,根据我的理解,我将不得不使用 ng xi18n 命令重新生成 messages.xml 文件,这意味着我需要将文件重新翻译成其他语言,或者至少进行某种视觉匹配,以便我可以将某些 div 标签的内容从旧的、已经翻译的文件移动到新位置到新文件中.这似乎是维护更改的大量开销,我希望我遗漏了一些东西,但这是维护文件的预期工作流程吗?以下是正确的[我希望不是],还是有我不知道的更好的方法?

In Angular 6, now that I think I comprehend how to make the i18n files and utilize them (e.g. https://angular.io/guide/i18n), I am wondering about maintenance of said files. If I go in and change the html, as I understand it, I would have to regenerate the messages.xml file using the ng xi18n command, which then implies that I would be required to retranslate the file into the other languages or, at the very least, do some kind of visual matching so I can move the content of some div tag to its new location into the new file from the old, already translated, file. This seems to be a lot of overhead to maintain changes and I hope I am missing something, but is this the intended workflow for maintaining the files? Is the following correct [I'm hoping not], or is there a better way that I am unaware of?

创作:

  1. 使用ng xi18n命令生成messages.xlf
  2. 复制并重命名messages.xlf => messages.fr.xlf
  3. 打开messages.fr.xlf,复制标签之间的内容并将其粘贴到下方,然后重命名source => target,然后将内容翻译成新语言(例如法语)
  1. generate messages.xlf with ng xi18n command
  2. copy and rename messages.xlf => messages.fr.xlf
  3. open messages.fr.xlf, copy the content between the tags and paste it underneath, then rename source => target and then translate the content into a new language (e.g. French)

维护:

  1. 对 html 和/或内容进行更改后,使用 ng xi18n 命令重新生成 messages.xlf
  2. 复制messages.xlf并重命名(例如messages.fr2.xlf)
  3. 打开messages.fr.xlf并尝试辨别可以复制到messages.fr2.xlf的内容,然后删除messages.fr.xlf并重命名messages.fr.xlf???对所有语言重复???
  1. after making changes to the html and/or content, regenerate messages.xlf with ng xi18n command
  2. make a copy of messages.xlf and rename it (e.g. messages.fr2.xlf)
  3. open messages.fr.xlf and try to discern what can be copied over to messages.fr2.xlf and then delete messages.fr.xlf and rename messages.fr.xlf??? Repeat for all languages???

是否有我缺少的命令或工具可以帮助我匹配放置在 i18n 标签中的持久 ID(例如 i18n="@@myUniqueTag"),以便我可以移动翻译的目标(例如我翻译的内容)自动到新文件?还是我真的必须手动将所有目标移动到新文件并将它们与每个源标签匹配?

Is there a command or tool I am missing that will help me match up the persistent ids I put in the i18n tags (e.g. i18n="@@myUniqueTag") so I can move translated targets (e.g. <target>my translated content</target>) automatically to the new file? Or do I really have to manually move all of my targets to the new file and match them up with each source tag?

推荐答案

您可以使用 ngx-i18n 支持.运行ng xi18n后,使用xliffmerge自动合并翻译文件.

You can use ngx-i18nsupport. It uses xliffmerge to merge translation files automatically after running ng xi18n.

这篇关于Angular 6:i18n:如何更新已翻译的现有 .xlf 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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