I18node
TL;DR: It's an i18n package for Node.js, with support to plurals and genders
$ npm install i18node
Usage:
var I18Node = ; var options = locales: 'en' 'pt' defaultLocale: 'en' defaultGender: 'masc' path: './locales' ; var i18n = options; i18n; //person i18n; //couple i18n; //people i18n; //couple i18n; //hi worlds i18n; //olá mundo i18n; //nidorinos i18n; //nidorino i18n; //nidorinas i18n; //nenhum
And let's say that, inside ./locales
folder we have the files:
en.json
:
pt.json
:
Options
locales
: Array of locale names. Default: ['en'])defaultLocale
: Default: 'en'defaultGender
: Default: 'neutral'path
: Path for the locales folder. Default: './locals'
API
setLocale(locale)
: Set the default localegetLocale()
: Return the current default localesetGender(gender)
: Set the default gendergetGender()
: Return the current default genderhasLocale(locale)
: Return if the passed locale is supportedi18n(term, data)
: Return the internationalized term, using the given data