1.3.3 • Published 6 years ago
ml-i18n.js v1.3.3
i18n.js
Tool to transform json key-value format to a translate function
Installation
$ npm install ml-i18n.js
Usage:
$ i18n.js --input './source/**/*.json' --output './target'
Input Format
Input json file for keys and translations for one language
[
{
"key": "some.key",
"value": "translation"
}
]
Output Format
Output js file for keys and translations for one language
const i18n = {
"some.key": (p) => "translation"
}
export function translate(key, params) {
const fn = i18n[key];
return fn ? fn(params) : key;
}