2017-05-03 67 views
1

是否有角本地化的工具嗎?本地化Angular2使用使用<strong>角CLI</strong>當角CLI

我遇到了this link(從11月份開始),指出「現在,您不能在翻譯的應用程序中使用CLI」,因此i18n工具無法在我的應用程序中使用。

是否有另一種方法將應用程序翻譯成不同的語言?

(我用的WebPack,不systemJs)

+0

https://angular.io/docs/ts/latest/cookbook/ i18n.html –

+2

好的鏈接@ R.Richards也是,這裏是一個CLI特定的鏈接:https://github.com/angular/angular-cli/wiki/stories-internationalization – Brocco

+0

https://github.com/angular-pakistan/NG-CONF-2017。尋找「迷失在翻譯」 –

回答

2

有一個在角CLI維基一個故事,應該可以幫助您:

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

那篇文章:

當您的應用程序準備就緒時,您可以使用ng xi18n命令從您的模板中提取字符串以進行翻譯。

ng xi18n --output-path src/locale 

一旦你翻譯,你可以成爲:

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

或建立:

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