I'm building an application using the latest Angular5 and what I need is for a user to be able to switch languages. I've never had to implement this in an Angular2+ (actually I'm using Angular5).
I need to set translations in two places:
I was looking at ngx-translation and it looks to do everything I need, as in it allows you to change language without rebuilding your code, see here. However I read it was probably going to be deprecated due to the main developer moving to the angular team to develop their i18n code.
I also understand that the current i18n doesn't support everything I need right now, see here.
My question - what is the state of play for translations in the latest version of Angular? Are there other libraries people would recommend instead, if indeed, Angular itself hasn't got full support as of yet (for changing language without recompiling)? Is ngx-translate good for the future?
Any guidance in this area is greatly appreciated!
Introduction. Internationalization is the process of supporting multiple languages in your applications. This can be accomplished in an Angular application through third party libraries, such as ngx-translate , or you can use the built-in i18n functionality.
AngularJS supports inbuilt internationalization for three types of filters currency, date and numbers. We only need to incorporate corresponding js according to locale of the country. By default it handles the locale of the browser.
Internationalization (i18n) Example Internationalization is also called i18n (because of the number of letters, 18, between “i” and “n”). Internationalization ensures your software is localizable and is typically done by software developers and engineers.
After spending time looking into this, I thought I'd post the main differences I found between ngx-translate and Angular-i18n:
Ocombe (developer of ngx): @josersleal that's exactly what they did, the angular team hired me to improve i18n for everyone But there is no way to integrate my lib directly into the core, after working for 3 months for the core team I can tell you that Angular i18n is much more complex and elaborate than my lib. It handles a lot of more complex stuff, and it does it without all the bugs and shortcomings that my lib has. I understand that it's frustrating that the core doesn't evolve as fast as what a library can do, but there are reasons for that, and the first one is that you cannot implement something and change it whenever you see that you forgot to include a use case. Everything has to be thoroughly planned and thought. Still, you will have most of the things that this lib can do in the core in the future, but it might take a year before we get there unfortunately. The good news is that it's going to be much better than my naive implementation.
This is a good article to discuss the main differences between ngx-translate and Angular’s i18n: https://github.com/ngx-translate/core/issues/495
The changes for i18n are due in version 6 of angular. Today, we are currently on version 5:
It won't be for 5.0, it should be before 6.0 (so before march 2018). Unfortunately I don't have a more precise date
The developer of ngx-translate (and now a main contributor to angular-i18n) has posted this 12 days ago: https://github.com/angular/angular/issues/20193
Here’s the design document for i18n (the Prior Art section is interesting): https://docs.google.com/document/d/1LH7lJ1GjRgpGUjzNb6Eg4xrPooRdi80QOTYYh8z_JyY/edit#
Some thoughts…
I am also going to have a look at the Angular-l10n library as it looks very good:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With