Super simple i18n library with express middleware and Mustache syntax.
$ npm install i18n-node
- Based on Mustache syntax (full partials support)
- Reads translations from file system
- Automatically detects locale
- Easy translation method
- Post processors
We wanted a simple i18n library built on top of the logic-less template syntax provided by Mustache. Most libraries use sprintf, which is awesome, but it requires a specific order of data, which isn't desirable in our case.
All locales must conform to the locale format
ll_CC, where ll is a two-letter language code, and CC is a two-letter country code. For instance, en_US represents U.S. English.
An example of a locale file could be:
var I18n = ;var i18n =directory: __dirname + '/locales/';i18n; // => "Hello guest!"
var I18n = ;var express = ;var app = ;var i18n =directory: __dirname + '/locales/';app;app;
- Singular/plural support
- Number formatting across locales taking imperial countries into account
- Unit tests!
Hope you like it!