1.0.5 • Published 4 years ago

sync-multilanguage-json v1.0.5

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

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"
}
1.0.5

4 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago