Snow 1d0b9c5323 增加了node环境 | vor 1 Monat | |
---|---|---|
.. | ||
test | vor 1 Monat | |
.npmignore | vor 1 Monat | |
.travis.yml | vor 1 Monat | |
README.md | vor 1 Monat | |
index.js | vor 1 Monat | |
package.json | vor 1 Monat |
Easy to use i18n utility. It does not contain express specific middlewares, etc.
var I18n = require('i18n-t');
var i18n = new I18n({
defaultLocale: 'en'
});
// Load locales from a directory
i18n.load('./locales');
// or using a pre-loaded objects
i18n.set({
en: {
HELLO: 'Hello {{name}}',
CATS: '{{0}} cats'
}
});
// Translate sentences
i18n.t('en', 'HELLO', { name: 'Samy' });
i18n.t('en', 'CATS', 10);