localize doesn’t work with target: ES2015

I’m working with angular since several years now and localization is a problem again and again.
First it starts with the question, how should the ecosystem around translation look like, what’s the best practice here? There is no documentation, recommendation or help for the steps after extracting i18n.
It start’s with the fact, that translations by default are not merged, so I added xliffmerge do my stack. That works pretty okay.
For doing translations I use poedit which is also a pretty nice tool.

But in the end I regularly get issues broken translations, because interpolation doesn’t correctly find it self through the process or currently with this Unexpected messageParts for $localize (expected an array of strings).. This error message itself is already a pain because it’s not helpful at all, because it actually just tells you “There is something wrong with your translations, good luck finding the bad one”.

The problem for me is, that I really don’t know who to “blame”. Is angular not creating proper XLIFF files, is xliffmerge not merging them correctly or is poedit doing something wrong with my files. It’s really frustrating to work with translations when beeing confronted with such errors.

So I really hope that the angular team can spend some time to add documentation about tools that are proven to work with angular. To think about integrating xliffmerge into angular CLI and to add more helpful error messages so that broken translations can be identified easier.

P.S.: Oh and what I forgot is prettier. It also adds to the mess because messages are wrapped or spaces are added which makes creating translations also harder.

4 thoughts on “localize doesn’t work with target: ES2015

  1. Actually, I was hoping that you were not using ES5 😸
    Generally it is better to target ES2015 and then let the CLI generate downleveled code for browsers that need it.
    Not sure why switching solved your problem.