tt_Gantz tt_Gantz - 1 month ago 43
Javascript Question

Angular2localization vs ng2-translate differences

What are the differences between the two libraries I should be aware of? Is there a general community consensus yet as to which one to use? Most of the posts talk about ng2-translate but they seem similar and angular2localization seems like it has more features.

The main differences I see is that

angular2localization supports currency and time,

ng2-translate allows you to create templates that take a value into it. But this doesn't seem a big issue as you can just use the variable in the code instead of the template...

Is there anything I'm missing out in my decision?

Answer

I am the developer of angular2localization. I started this library as an experimental app for translation when Angular 2 was still in early alpha versions because Angular 2 did not support translation (and still does not support in the rc.5), and even the localization of numbers and dates. ng2-translate is more popular and has more contributors: as ng-translate, it was created to provide the translation. At the moment, I think that the main differences are these:

Angular 2 Final release - Native

  • Messages: Html attribute, Message ID
  • File formats: XLIFF, XMB/XTB
  • No bootstrap (when language changes): no
  • Getting the translation in component class: ?
  • Numbers: pure pipe via Intl
  • Dates: pure pipe via Intl
  • Validation: -

ng2-translate - External library

  • Messages: impure pipe
  • File formats: JSON
  • No bootstrap (when language changes): yes
  • Getting the translation in component class: yes
  • Numbers: -
  • Dates: -
  • Validation: -

angular2localization - External library

  • Messages: pure pipe
  • File formats: JSON
  • No bootstrap (when language changes): yes
  • Getting the translation in component class: yes
  • Numbers: pure pipe via Intl
  • Dates: pure pipe via Intl
  • Validation: numbers validation

I invite anyone interested to correct and update this table. Cc @Olivier