sync-multilanguage-json
v1.0.5
Published
The sync-multilanguage-json can sync json files for all languages and set the phrases order by alphabet in each file.
Downloads
3
Maintainers
Readme
Description
The sync-multilanguage-json can sync json files for all languages and set the phrases order by alphabet in each file.
Installation
$ npm i --save-dev sync-multilanguage-json
Example
You have following project structure:
bin/
syncLocales.js
locales/
en.json
uk.json
fr.json
syncLocales.js
const { syncLanguages } = require('sync-multilanguage-json')
syncLanguages(`${__dirname}/../locales`, 'en').then(() => {
console.info('Done!')
}).catch((err) => {
console.error(err)
})
en.json
{
"world": "world",
"hello": "Hello",
"apple": "apple"
}
uk.json
{
"hello": "Привіт",
"world": "всесвіт"
}
fr.json
{
}
Result
en.json
{
"apple": "apple",
"hello": "Hello",
"world": "world"
}
uk.json
{
"apple": "Translate from en: apple",
"hello": "Привіт",
"world": "всесвіт"
}
fr.json
{
"apple": "Translate from en: apple",
"hello": "Translate from en: Hello",
"world": "Translate from en: world"
}