simply good
simply good

Reputation: 1103

Angular How to easier maintain build in i18n translations

We use the build in i18n module for angular.

I successfully generated source file for my original lang (en). Then I copied the source file and created another file with (es) translation.

It is easy to regenerate source file. But the problem is that it is very painful to update es localization file. I sync changes manually

For example: even if I change a row of the string in html/ts after the source regeneration it specifies that new row number. So I need then manually go to my ES file and update this row here too. But eventually it happens like that: I edit/add new/change location of plenty of the strings, so that regenerated source file has a lot of changes. And it becomes just easier to manually create ES file again and paste translations in it.

Just in case. This is how the difference between files look every time:

2 files after adding some new translations and refactoring of a code. Left is ES. Right is an original

Is there any good solution for developers to easily maintain other locale files when original file changes?

Upvotes: 3

Views: 556

Answers (1)

ectuser
ectuser

Reputation: 171

I believe you can use this package: https://github.com/daniel-sc/ng-extract-i18n-merge.

First you need to configure angular.json:

Specify targetFiles option with your translation files.

After each change you should run ng extract-i18n to generate and merge existing files

Upvotes: 0

Related Questions