问题
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