3

I am working with Angular 6 i18n. I am working with multi-language, meaning that I followed cookbook: https://v2.angular.io/docs/ts/latest/cookbook/i18n.html#!#ng-xi18n

My current implementation is using AOT, so I generated a messages.xlf file and a messages.pt.xlf. Everything is working fine, when I run

ng serve --configuration=pt

I get texts translated as expected. But I feel like there is something very wrong with the way it works. I am probably missing something. As far as I understood, everytime I add a new string to be translated and mark it with i18n attribute, i need to re-generate the messages.xlf file running "ng xi18n" and then update manually the messages.pt.xlf. The xlf file also holds the line number where the source is, so it looks like if i it changes the row, i will also need to re-generate the file and manually update my pt file.

<context context-type="linenumber">16</context>

That doesn't look smart, it will give me a lot of extra work to keep it working. Do you understand my concern? Am I missing something? I know Angular 7 i18n will have a big update with Ivy being incorporated, should i wait for it?

Gonçalo Peres
  • 11,752
  • 3
  • 54
  • 83
Fabio Carvalho
  • 459
  • 4
  • 14

1 Answers1

2

i found the answer after searching more. This xliffmerge tool does the job. Maybe there is something more sofisticated, but right now it will do

https://www.npmjs.com/package/ngx-i18nsupport

Probably a duplicate question: Angular 6: i18n: How to update an existing .xlf file that has already been translated?

Fabio Carvalho
  • 459
  • 4
  • 14