Angular國際化方案
首先和大家推薦一個xlf文件的操作工具,支持合并和編輯功能,github,到release界面下載。
對于Angular國際化,官方提供了i18n方案,也就是標簽的方式,通過angular CLI來識別。國際化方案必須在編譯前定義下來,所以不能動態翻譯。也就是當有人切換語言時,Angular i18n強制您按照不同的語言構建應用程序。
就目前來說,Angular有兩種主流的方式
- i18n
- ngx-translate
目前ngx-translate是比較好的方案。至于為什么?請看下面。
this is a good question, and as I am working on i18n in the Angular core team I am probably the best to answer this.
The idea behind this lib has always been to provide support for i18n until Angular catches up, after that this lib will probably be deprecated. For now, there are still a few differences between Angular i18n and this library:
- Angular only works with one language at a time, you have to completely reload the application to change the lang. The JIT support only mea