I have an internationalized Angular project, using Angular's built-in i18n framework, where the translation files look like this:
messages.en.xlf
<trans-unit id="7380085404224719862" datatype="html">
<source>Place a new request</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/foo.component.html</context>
<context context-type="linenumber">13</context>
</context-group>
</trans-unit>
messages.de.xlf
<trans-unit id="7380085404224719862" datatype="html">
<source>Place a new request</source>
<target>Einen neuen Antrag stellen</target>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/foo.component.html</context>
<context context-type="linenumber">13</context>
</context-group>
</trans-unit>
where messages.en.xlf is the source file that is automatically generated by the ng extract-i18n
tool, and the other translation files such as messages.de.xlf are copies of that with translations added manually by a human translator.
There are 3 problems with this workflow as I understand it:
foo.component.html
then the line numbers referenced in the above files will change. For the source file this will happen automatically the next time I re-run the ng extract-i18n
tool, but for the other translation files do I need to update them manually?<trans-unit>
in the source file, which I then need to manually copy to the other translation files.<trans-unit>
from the other translation files.It is very obvious that all 3 issues could (and should) be very easily automated by some tool, as syncing these files manually is extremely time consuming and error-prone. However I was shocked to see that IntelliJ does not seem to provide this functionality, and the same goes for all i18n/localization/xliff IntelliJ plugins I tried. Am I missing something here? Which tools do you use to keep your .xlf files in sync?
I am using ng-extract-i18n-merge and I'm very happy with how it works. It handles everything quite transparently and offers a lot of configuration.
As soon as I change a translation id or content, the changes get reflected in all my xlf
files, keeping them perfectly in sync.
This is of course a dev-dependency and not a plugin for intellij, but I guess that doesn't matter too much. If you need a small handy tool for editing translations, give TinyTranslator a go.