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