i18n messages is stored in Excel file, but it is not easy to edit in your code. So, this tool is created to convert Excel to JSON.
Excel data structure is converted to JSON. The key of the first column of the first row is required.
| key | zh_CN | zh_HK | en | and more languages... |
|---|---|---|---|---|
| hello | 你好 | 你好 | hello | ... |
| world | 世界 | 世界 | world! | ... |
output JSON:
{
"zh_CN": {
"hello": "你好",
"world": "世界",
},
"zh_HK": {
"hello": "你好",
"world": "世界",
},
"en": {
"hello": "hello",
"world": "world!",
}
}Using npm:
$ npm install -g excel-to-json-parserUsing yarn:
$ yarn global add excel-to-json-parserrun etj --help without arguments to see list of options:
Usage: etj --sourceFile <dir>
Options:
-V, --version output the version number
-s, --sourceFile <dir> source file path need to be converted
-h, --help display help for commanduse CLI
etj --sourceFile /yourdir/example.xlsx
// or
etj -s /yourDir/example.xlsxrun example
yarn example