Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 663 Bytes

README.md

File metadata and controls

32 lines (22 loc) · 663 Bytes

i18n-t

Easy to use i18n utility. It does not contain express specific middlewares, etc.

Build Status NPM version

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);