简体   繁体   English

Angular2流星Web应用程序的国际化

[英]Internationalization for Angular2 Meteor Web Application

I am building a web application with Meteor and Angular2. 我正在使用Meteor和Angular2构建一个Web应用程序。 I need the application to support 4 languages. 我需要该应用程序支持4种语言。 I am basing my project on Uri Goldshtein's boilerplate https://github.com/Urigo/angular2-meteor-base . 我的项目基于Uri Goldshtein的样板https://github.com/Urigo/angular2-meteor-base

Which is the recommended way to implement internationalization when using Angular2+Meteor? 使用Angular2 + Meteor时,推荐的国际化方法是什么?

You might read my article https://medium.com/@jamuhl/i18n-frameworks-the-unfair-showdown-8d436cd6f470 - using a framework specific solution is not always the best thing to do... 您可以阅读我的文章https://medium.com/@jamuhl/i18n-frameworks-the-unfair-showdown-8d436cd6f470 - 使用特定于框架的解决方案并不总是最好的做法...

i would recommend looking into a i18n lib that is more mature - i18next, formatjs, polyglot,... 我建议调查一个更成熟的i18n lib - i18next,formatjs,polyglot,...

Further you should not only consider that you have to instrument your code (i18n) to get your app/website translated. 此外,您不仅要考虑必须检测代码(i18n)以便翻译您的应用程序/网站。 You should think about the process too - how will you solve continuous localization, how you keep track of progress, ... http://locize.com/2016-10-05-continuous-development-integration-and-localization-cd/ 您也应该考虑这个过程 - 您将如何解决持续本地化,如何跟踪进度,... http://locize.com/2016-10-05-continuous-development-integration-and-localization-cd /

For a translation management+ system you might eg. 对于翻译管理+系统,您可以例如。 have a look at locize.com it plays well with all json based i18n frameworks...and provides a lot more than traditional systems. 看看locize.com它与所有基于json的i18n框架配合得很好......并提供了比传统系统更多的功能。

I can recommend the ngx-translate module, we are using it in production in some projects. 我可以推荐ngx-translate模块,我们在一些项目中使用它。

  • It is easy to integrate and transactions are stored in the JSON files. 它易于集成,事务存储在JSON文件中。
  • Translations are runtime (dynamically inserted through selector keys) 翻译是运行时(通过选择键动态插入)
  • Translate invoked through the translation pipe or translation directive 通过翻译管道或翻译指令调用的翻译

There are also other options summarized in comparison table from angular2localization, that is shown below angular2localization的比较表中还总结了其他选项,如下所示

角度i18n比较表

We are also using the native Angular i18n solution, it is integrated into angular CLI build tool and also really easy to use. 我们还使用原生的Angular i18n解决方案,它集成到角度CLI构建工具中,并且非常易于使用。 There is a major drawback of the rebuild for each app localization. 每个应用程序本地化的重建都有一个主要缺点。 It is nicely summarized here . 这里很好地总结

Also in the angular2translate readme is mentioned this library for usage with Meteor, so there are always multiple options to choose from. 另外在angular2translate自述文件中提到了这个用于Meteor的 ,因此总有多个选项可供选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM