Comparison with i18n js - RobertoPrevato/I.js GitHub Wiki

I.js is created to support only scoped translations and simple templates with mustaches, and to be lighter. Users who need more complex solutions (support for pluralization; dates and numbers formatting; currencies; etc.) should use those instead.

That said, I.js is designed to be similar to i18n-js.

While in i18n-js, the resources must be placed inside its object translations; in I.js the resources must be placed inside its object regional. They both:

  • refer to a property called "locale"
  • offer a function call "t"; that returns a translation, given a key
  • support mustaches {{ }}
_.extend(I.regional, {
  "it": {
    "Hi": "Ciao"
  }
});

// is similar to:

_.extend(I18n.translations, {
  "it": {
    "Hi": "Ciao"
  }
});

I.locale = "it";
I18n.locale = "it";

I.t("Hi") === I18n.t("Hi"); // true