Angular - internationalization (i18n)

岁酱吖の 提交于 2020-01-03 17:53:26

问题


What is the best way to implement the internationalization for a angular application at the moment?


回答1:


The official i18n angular2 will be implemented in one of the rc release before the final release. It also will be more advanced than the current solutions.

More info how the new concept of i18n works in angular2:
https://lingohub.com/blog/2015/03/angular-2-i18n-update-ng-conf-2015

UPDATE 6 SEPTEMBER 2016:

Support for i18n is now official in Angular 2 RC6

Official release blog:
https://angularjs.blogspot.nl/2016/09/angular-2-rc6_1.html

A sample of internationalization with Angular 2 RC6
https://github.com/StephenFluin/i18n-sample




回答2:


At the moment the best alternative is is to use ng2-translate, which is a port to Angular 2 of the well known ng-translate. This will likelly cover the majority of use cases.

Later for Angular 2 there will be an official i18n implementation.




回答3:


According to change log https://github.com/angular/angular/blob/master/CHANGELOG.md, a big piece of i18n was introduced in Angular 2 RC5:

i18n: merge translations 7a8ef1e

Unfortunately, I still don't observe any useful documentation.

However, according to https://github.com/angular/angular/issues/9104, the simple cases are already covered

{{ 'TRANSLATION_ID' | translate }}

Search this document https://docs.google.com/document/d/1mwyOFsAD-bPoXTk3Hthq0CAcGXCUw-BtTJMR4nGTY-0/edit for {{ 'TRANSLATION_ID' | translate }} for more details.



来源:https://stackoverflow.com/questions/35506628/angular-internationalization-i18n

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!