I18node

TL;DR: It's an i18n package for Node.js, with support to plurals and genders

$ npm install i18node

var I18Node = require ( ' i18node ' ) ; var options = { locales : [ ' en ' , ' pt ' ] , defaultLocale : ' en ' , defaultGender : ' masc ' , path : ' ./locales ' } ; var i18n = new I18Node ( options ) ; i18n . i18n ( ' person ' ) ; i18n . i18n ( ' person ' , 2 ) ; i18n . i18n ( ' person ' , 3 ) ; i18n . i18n ( ' person ' , { num : 2 } ) ; i18n . i18n ( ' hello world ' , { num : 2 , greeting : ' hi ' } ) ; i18n . i18n ( ' hello world ' , { greeting : ' olá ' , locale : ' pt ' } ) ; i18n . i18n ( ' nidorino ' , { num : 2 } ) ; i18n . i18n ( ' nidorino ' , { gender : ' masc ' } ) ; i18n . i18n ( ' nidorino ' , { num : 2 , gender : ' fem ' } ) ; i18n . i18n ( ' none ' , { gender : ' neutral ' , locale : ' pt ' } ) ;

And let's say that, inside ./locales folder we have the files:

en.json :

{ " person " : { " 1 " : " person " , " 2 " : " couple " , " n " : " people " } , " hello word " : { " 1 " : " {{greeting}} world " , " n " : " {{greeting}} worlds " } , " nidorino " : { " 1 " : { " masc " : " nidorino " , " fem " : " nidorina " } , " n " : { " masc " : " nidorinos " , " fem " : " nidorinas " } } , " none " : " none " }

pt.json :

{ " person " : { " 1 " : " pessoa " , " 2 " : " casal " , " n " : " pessoas " } , " hello word " : { " 1 " : " {{greeting}} mundo " , " n " : " {{greeting}} mundos " } , " none " : { " neutral " : " nenhum " , " fem " : " nenhuma " } }

Options

locales : Array of locale names. Default: ['en'])

: Array of locale names. Default: ['en']) defaultLocale : Default: 'en'

: Default: 'en' defaultGender : Default: 'neutral'

: Default: 'neutral' path : Path for the locales folder. Default: './locals'

API