@empathyco/x-translations
v2.0.3-alpha.2
Published
A project which allows the user to import and export the translations.
Downloads
700
Keywords
Readme
Manage Translations JSON to CSV and CSV to JSON
This project converts a JSON file with translations to a CSV and in the other way around.
How to use it
Params
It receives two parameters, the first one should be the path of file to be converted (it is mandatory), and the second one is the target path where the translations are going to be exported (it is not mandatory, a default folder will be created if the param is not sent)
- sourcePath: path of file to be converted.
- targetPath: destination path to export the file converted.
Run it as script
Run the following command to translate from a JSON to a CSV:
ts-node ./src/json-to-csv.ts ./src/__tests__/json/en.messages.json
ts-node ./src/json-to-csv.ts ./src/__tests__/json/en_translations.json ./TargetPath
If you want to transform multiple files, you can use the path:
ts-node ./src/json-to-csv.ts ./src/__tests__/json
ts-node ./src/json-to-csv.ts ./src/__tests__/json ./TargetPath
Run the following command to translate from a CSV to a JSON:
ts-node ./src/csv-to-json.ts ./src/__tests__/csv/en.messages.csv
ts-node ./src/csv-to-json.ts ./src/__tests__/csv/en.messages.csv ./TargetPath
If you want to transform multiple files, you can use the path:
ts-node ./src/csv-to-json.ts ./src/__tests__/csv
ts-node ./src/csv-to-json.ts ./src/__tests__/csv ./TargetPath
Run it as a dependency
npm install @empathyco/x-translations
run the command to transform a JSON to a CSV:
json-csv ./src/__tests__/json/en.messages.json
json-csv ./src/__tests__/json/en.messages.json ./TargetPath
- To transform multiple files, use the path where the files are stored:
json-csv ./src/__tests__/json
json-csv ./src/__tests__/json ./TargetPath
run the command to transform a CSV to a JSON:
csv-json ./src/__tests__/csv/en_translations.csv
csv-json ./src/__tests__/csv/en_translations.csv ./TargetPath
- To transform multiple files, use the path where the files are stored:
csv-json ./src/__tests__/csv
csv-json ./src/__tests__/csv ./TargetPath