Localization in Angular2 with Angular-cli

Is there a localization tool for Angular 2 when using Angular-cli ?

I came across this link (from November) stating that "right now you cannot use the CLI in translated applications", so the i18n tool cannot be used in my application.

Is there any other way to translate the application into different languages?

(I am using webpack, not systemJs)

+1


source to share


1 answer


The Angular wiki has a story to help you:

https://github.com/angular/angular-cli/wiki/stories-internationalization

From this article:

When your application is ready, you can extract translation strings from your templates using the ng xi18n command.

ng xi18n --output-path src/locale

      



After you have translated, you can submit:

ng serve --aot --locale fr --i18n-format xlf --i18n-file src/locale/messages.fr.xlf

      

Or build:

ng build --aot --locale fr --i18n-format xlf --i18n-file src/i18n/messages.fr.xlf

      

+2


source







All Articles