Internationalization in Ionic 5

May I ask what is the best practice in Internationalization in Ionic 5?
Is it still ngx-translate?
or we can use Angular built-in i18n now?

As I heard ngx-translate is just a temp solution so I am wondering what is the best practice in Ionic 5?

Thanks

If you’re planning to support multiple languages with a single binary, Angular built-in i18n is going to cause you some problems. Runtime language switching is another area that ngx-translate will do better. Personally, I really prefer the stock Angular approach of compile-time translation instead of runtime, and if you’re just dealing with one language per build, or a situation where you’re serving a PWA behind an httpd, I would wholeheartedly endorse built-in Angular i18n.

I would love to do so also for on-device multilingual builds, but can’t really do so yet with the current state of affairs. The Ivy extractor only was released with 10.1 very recently, though, so maybe the answer to this question will change as more people try using it.

1 Like

Thank you. Very informative.
What if I use built-in Angular i18n in mobile?
As it is compile time translation so if this affect the mobile performance or behaviour?

I would assume it would be faster, but probably not noticeably so. The main reason I really like Angular’s compile-time i18n is that it tells me when I’ve missed localizing particular strings at build time, not when users in the field report it.

1 Like