Akshay Rana
Akshay Rana

Reputation: 1485

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:

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

Upvotes: 5

Views: 3170

Answers (2)

Akshay Rana
Akshay Rana

Reputation: 1485

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.

Upvotes: 3

David
David

Reputation: 34475

Angular's future versions (8.1?) should support translating contemplate text and dynamic translation without reloading the page. Until then, there is i18-polyfill (https://github.com/ngx-translate/i18n-polyfill) written by Olivier Combe, who joined the angular core team for working on i18n

This library is a speculative polyfill, it means that it's supposed to replace an API that is coming in the future. Once code translations are available in Angular, this library will be deprecated. But since it's a polyfill, we expect the API to be pretty similar. If the API is different, a migration tool will be provided if it's possible and necessary.

Upvotes: 0

Related Questions