Do you add multilingual support (Angular)?
Last updated by Brady Stroud [SSW] 7 months ago.See historyHow to implement multilingual support in an Angular project?
There are several ways of implementing multilingual support in an Angular project, the following libraries are popular:
Internationalization (i18n): the standard Angular built-in module to help the application dealing with multilingual. It creates multiple language versions of your application.
ngx-translate: a library enhanced the Angular built-in feature, it supports not only template translations but can also be used in the code by APIs.
angular-gettext: the simplest powerful 3rd party library providing translation support to Angular.
The following table shows the pros and cons of the 3 libraries:
Pros (+) | Cons (-) | |
---|---|---|
Internationalization (i18n) |
|
|
ngx-translate |
|
|
angular- gettext |
|
|
Ngx-translate provides the APIs which you can use to translate the resources in the code:
By comparing the 3 libraries we can see ngx-translate provides the best functionality now due to the API support, even though the built-in i18n module will catch up at a certain time, but we still recommend using ngx-translate for multilingual support in your Angular application.
The future…
Since Angular 9, they now have built-in support for i18n which is called Angular Localized, it is expected that over time, Angular Localize will become the most popular (see the yellow line on Google Trends increase).