Make language pack JSON file from properly formatted Excel spreadsheet
Since this app is not currently hosted in a package directly, you will need to include the path to this directory.
npm install -g ./<path-to-files>/mklang
This is a very simple app to help streamline the conversion process, and therefore, there are some expectations and limitations:
- The spreadsheet needs columns with a header with:
- "key"
- at least one locale code (i.e., "en-GB")
- All columns with content need a header. This is a requirement of the main dependency, convert-excel-to-json. Without it convert-excel-to-json throws an error.
- If the spreadsheet contains multiple sheets, it's recommended to convert one sheet at a time. Otherwise, the last sheet may overwrite language packs generated from preceding sheets. See below for an example.
- The destination path needs to exist before attempting the conversion. This does not auto-generate the destination folder for you.
You need to provide at least a spreadsheet file and destination directory:
mklang Spreadsheet.xlsx export-path/
To specify a single sheet within the spreadsheet, add it to the filename with a # delimiter:
mklang Spreadsheet.xlsx#Sheet1 export-path/
To include a map.json, add --include-map:
mklang Spreadsheet.xlsx#Sheet1 export-path/ --include-map
Warning: if there are any missing translations in a language pack, it will not be included in the enabled array of the map.json.
Multiple sheets and destination paths are also supported. Separate sheet names with a comma, and destinations with a space:
mklang Spreadsheet.xlsx#Sheet1,Sheet2 export-path/sub-1/ export-path/sub-2/
Warning: attempting to convert multiple sheets at once is discouraged. The last sheet may overwrite language packs generated from preceding sheets.