0

I have setup Internationalization and Localization for my project for two languages. The process was pretty straight forward, but I'm hung up on how the process should exist for making markup or copy changes to my app.

According to Angular's i18n documentation... and working with the translation files.

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.

The marked text includes text marked with i18n, attributes marked with i18n-attribute, >and text tagged with $localize as described in Prepare templates for translations.

Complete the following steps to create and update translation files for your project.

Extract the source language file. Optionally, change the location, format, and name. Copy the source language file to create a translation file for each language. Translate each translation file. Translate plurals and alternate expressions separately. Translate plurals. Translate alternate expressions. Translate nested expressions.

Do I need to do this tedious task every time I alter HTML or text? Do I need to run the extract-i18n command every time? I noticed source files and line numbers in the xlf, changing any markup would likely require an xlf update. Then I'd have to copy it and update the translations for every language.

Is the idea that a production app only updates its translations each delivery milestone (or equivalently few and far between) vs iteratively with development?

My application needs to support 9 languages. I don't see how this scales easily.

Kirby
  • 1,980
  • 3
  • 21
  • 33
  • 1
    I would only do extract when you actually change texts or add / remove keys. Its smart enough to find which mean and adjust. For merging to other languages i use and vscode extension called xliff sync. its not ideal, but you can see the open source and there might be a way to do it command line with the script they created for the extention. Other than that i would probably just use ngx-translate if its not too late to switch. then you just deal with json with keyvalue pairs and you can host them on a service if needed. – Henrik Bøgelund Lavstsen Nov 23 '22 at 08:02
  • It was my understanding that ngx-translate is dead/discontinued. (https://stackoverflow.com/questions/44923138/differences-ngx-translate-vs-i18n) I'll check out that VS Code extension. It's the file names and line numbers in the generated messages.xlf that cause me pause. – Kirby Nov 23 '22 at 13:17
  • 1
    no need to worry too much about the line numbers and filenames, its mainly focused on ids. for inserting on builds. But it can help you get rid of old ids etc, but its tedious like a hell to deal with .xlf files imo. Maybe its great for translators since you can add notes etc and set translation stages. ngx-translate not yet dead, still being maintained. but i don't think it requires more actual work. just keeping up with versions. its at angular 14 so close to newest. – Henrik Bøgelund Lavstsen Nov 24 '22 at 02:54

0 Answers0