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

查看:258
本文介绍了角度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 命令

  2. 复制并重命名消息,从而生成messages.xlf。 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的内容,然后删除消息.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???

是否缺少我所需要的命令或工具,以帮助我与放置的持久性ID匹配在i18n标记中(例如 i18n = @@ myUniqueTag ),这样我就可以移动翻译后的目标(例如< target>我的翻译内容< / target> )自动添加到新文件?还是我真的必须手动将所有目标移动到新文件并与每个源标签进行匹配?

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?

推荐答案

我最终为自己制定了解决方案,直到出现更好的情况为止: https://github.com/ maplion / angular6-i18n-helpers

I ended up making a solution for myself until something better comes along: https://github.com/maplion/angular6-i18n-helpers

到目前为止,它对我来说很好。

So far, it is working pretty well for me.

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

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