Angular 6 i18n runtime translation support

RockBop picture RockBop · Apr 10, 2018 · Viewed 9.6k times · Source

I've read i18n runtime support is coming in angular 6, but cant find anything in rc3. Is it postponed or not yet documented? The i18n documentation still states than one have to build a separate build for each language.

https://github.com/ngx-translate is an alternative but i don't know how long this will be supported or if the support in Angular 6 will be totally different. Migrating later then will include rewrite of all i18n instances in the code and create new translation files. I have room to wait a little in my project but not forever.

Not been able to find anything on how the new i18n support in Angular 6 will be, except that it is coming.

Answer

Greg J Preece picture Greg J Preece · Aug 15, 2018

The author of ngx-translate, Olivier Combe, is working with Angular to upgrade their i18n offerings to offer runtime translation, along with numerous other upgrades. I believe this functionality is expected in Angular 7, but Combe has published a polyfill for earlier versions.

https://github.com/ngx-translate/i18n-polyfill

It is fairly simple to integrate with an existing Angular i18n setup, with only minimal legwork. I'd recommend using this over ngx-translate, as Angular i18n - while more complicated to work with - is significantly more feature-rich than ngx-translate.

See Combe's discussion of the differences here: https://github.com/ngx-translate/core/issues/495#issuecomment-291158036