@5no/i18n
v1.0.7
Published
Lightweight simple translation module
Downloads
28
Readme
i18n
Lightweight simple translation module
Install
@5no/i18n requires Node version 8 or above.
npm install --save @5no/i18n
Examples
import { init, setLanguage, translate, initDefault } from '@5no/i18n'
const enOne = {
'test %name%': 'translate1 %name%'
}
const enTwo = {
'test %name%': 'translate2 %name%'
}
init([
{
language: 'en1',
default: true,
db: enOne,
},
{
language: 'en2',
db: enTwo,
}
])
setLanguage('en2')
translate('test %name%', {
'%name%': 'TestName'
})
/**
*
* Result:
* translate2 TestName
*
* /
License
MIT Licensed, Copyright (c) 2020 Aleksandr Sokol