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?
Creation:
ng xi18n
commandMaintenance:
ng xi18n
commandIs 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?
After you prepare a component for translation, use the extract-i18n Angular CLI command to extract the marked text in the component into a source language file.
Angular CLI provides extract-i18n command to extract the marked text in the component into a source language file. 2. The extract-i18n command is run from project root directory as following. ng extract-i18n. This will generate messages.
i18next goes beyond just providing the standard i18n features such as (plurals, context, interpolation, format). It provides you with a complete solution to localize your product from web to mobile and desktop.
NGX-Translate is an internationalization library for Angular. Internationalization is the process of translating an application into multiple languages. Using this library, we can translate our application language into multiple languages. This will work with not only static data, but dynamic data as well.
You can use ngx-i18nsupport. It uses xliffmerge
to merge translation files automatically after running ng xi18n
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With