Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Internationalization ( ngx-translate/ i18n OR i18next )

I need to implement internationalization in a large scale project in Angular. From what I have found, there are two main choices : Angular's official i18n OR ngx-translate.

To understand advantages and disadvantages of both, I have gone through a lot of discussions :

https://github.com/angular/angular/issues/16477

https://github.com/ngx-translate/core/issues/495

https://github.com/ngx-translate/core/issues/783

Differences ngx-translate vs i18n

Now, the 3rd option is "angular-i18next". There's not a lot of documentation on this. I understand it's a wrapper over i18next. But does it overcome any shortcomings like:

  • Translating non template text.

  • Dynamic translations without reloading the page.

  • Having single build with AOT compilation.

Or, my best bet is to choose between i18n and ngx-translate? Also, is anyone using "angular-i18next"?

like image 850
Akshay Rana Avatar asked Oct 15 '22 13:10

Akshay Rana


1 Answers

After some more research, I came to a conclusion that i18-next does not offer anything over official Angular's i18n. Also, to use i18-next, you'll have to rely on an external dependency angular-i18next, and I am not convinced to do that for a large scale application.

Funnily enough, an article posted on angular-i18next page, states the following:

My point is: There are basically no features that I18next supports and the built-in I18n Angular module doesn’t. So if there is a relatively little difference, why would you make your life more complex and include some third-party I18n framework? Especially, when it relies on a separate plugin (maintained by another person) to make everything working?

Considering these things, and the fact how heavy i18next library is, and the learning time, I immediately dropped the idea to proceed with i18next.

Instead, for now, best option according to me is to go with Angular's official i18n, with the i18n-polyfill for template outside translations. And as soon as i18n gets this functionality, I'll migrate completely to i18n.

like image 152
Akshay Rana Avatar answered Oct 20 '22 11:10

Akshay Rana