Evan Carroll
Evan Carroll

Reputation: 1

Globalize.js vs i18next.js

Does Globalize.js offer anything over i18next.js? I've been using i18next.js and I can't find a comparison of the two technologies. Are there any advantages to one over the other? Or, is this just another jQuery project sold on the jQuery name?

Upvotes: 3

Views: 3776

Answers (2)

jamuhl
jamuhl

Reputation: 4498

I would say one of the main differences is i18next is not backed by some big "company" eg. globalize - jquery or format.js backed by yahoo.

i18next is built by the community - learn once use everywhere (not just where the own direction of the lead company leads the framework). So i18next works for react, angular, aurelia, jquery, vue, backbone, ... even exotic stuff like phraser. Runs in browser, nodejs, electron or native.

Does not have a own formatter for dates or numbers - but could easily extended to work with momentjs or intl API: http://i18next.com/translate/formatting/

The list of extensions is rather amazing: http://i18next.com/docs/ecosystem/

Upvotes: 1

Rafael Xavier
Rafael Xavier

Reputation: 2889

Short answer:

  1. Globalize has additional functionality: i18next seems to offer message formatting only. Globalize offers message formatting, date formatting (e.g., 11/30/2010 in English, 30/11/2010 in Portuguese, Nov 30, 2010, 5:55:00 PM in English, 30 nov. 2010 17:55:00 in Spanish, ٣٠‏/١١‏/٢٠١٠ ٥:٥٥:٠٠ م in Arabic, etc), number formatting (e.g., 3.142 in English, 3,142 in Spanish, ٣٫١٤٢ in Arabic, ৩.১৪২ in Bengali, etc), currency formatting (e.g., €9.99 in English, 9,99 € in German, etc), relative time formatting (e.g., tomorrow, mañana, 明天, غدًا, in 3 months, etc), unit formatting (e.g., 10 seconds, 10 segundos, 10秒钟, ١٠ ثوان, etc).
  2. Considering message formatting (which both libraries support), Globalize supports pre-compiling your formatters during build time for faster and smaller runtime code.
  3. Globalize.js is used at scale at Twitter (mobile site) for example.

Longer answer:

I didn't know of i18nnext.js (and haven't used it myself), so I cannot list the differences precisely, but by looking at its docs in a glance it seems i18nnext is only about message formatting, therefore it doesn't support number formatting, date formatting, currency formatting, unit formatting, and relative time formatting. Nor parsing. Globalize supports those.

Potential interesting reading:

  • Why Globalize? It details the design goals behind Globalize. Some are it is based on CLDR, the largest and most extensive standard repository of locale data available. It keeps code separate from i18n content.
  • JS libs Comparison grid - The globalization (internationalization and localization) farm of the JavaScript community. It has a summary of strengths and weakness of several big i18n libraries for JS (written by each respective maintainers), including Google, Yahoo, etc. BTW, if you have the contact of i18next owner, it would be great having them to contribute the strengths of his lib to this grid.

Just let me know if you have any questions.

Upvotes: 2

Related Questions