{"_id":"@asoumagne/json-translate","name":"@asoumagne/json-translate","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@asoumagne/json-translate","version":"1.0.0","description":"CLI tool to translate JSON files using DeepL API","main":"index.js","bin":{"json-translate":"index.js"},"keywords":["translation","json","deepl"],"author":{"name":"alain21218"},"license":"ISC","dependencies":{"commander":"^10.0.0","deepl":"^1.0.13","dotenv":"^10.0.0"},"_id":"@asoumagne/json-translate@1.0.0","_nodeVersion":"16.15.0","_npmVersion":"8.7.0","dist":{"integrity":"sha512-OovYTuz6fjqZU4x6rQmUC3jb7BbMNFgM/fvx4mDsdKHo3JK/i3z0rP3hFyiDMf6JXhsg+mc1wDRmukIvfvVa4Q==","shasum":"f8768a965afaa1e1fea7d214a8fd77f571657ad2","tarball":"https://registry.npmjs.org/@asoumagne/json-translate/-/json-translate-1.0.0.tgz","fileCount":5,"unpackedSize":5327,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICVqTXTIz0OeDYUfUqOJhSgyJ9jpwZcDuWhy/dTeBDxDAiEAkeu/1uk4OCp3pVVVkNSKeCTY57KwprzmLY1NHuBpTGg="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkDxhOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrzhA/+OtBTj4zadHc1KUqvfoXaBCsnlz9vO14iEEFubKF2/YUjel9R\r\ns8mJTzmhLQ7ZTL5e2rJzD05NeF9CdBbO4eryFU6zC+hjN6w7nMnIEznF0RT/\r\nquiaWEVHNdaJx9XEg8nj6dEfGIMBFQONhJX31niixRzc6bk1m7p7j68Nn5+u\r\nqV/Ortj+XFin/bEyTujrPaySt5OkjmSSqxiEg4JjuSZnTVaDvPC7iiZfs7zE\r\n6/7dc5/MqWaa8O/wWSIoJIfFqRWJIphGhHpk69/Kbwsb9l5lnwO1mz9JkWsM\r\nQfoMhXNNiNW777WilBLYBP0UeY6nNWSsfeSDzBaIwBVi3xEqbeFiiqn3nJ4b\r\nOn++MMf3lXGyYLTfqN1Y5HIkGLRJLISX+mAdv0AswyBJSXg8e5RsbvNGlq/+\r\n02yLN5QuDuulmPx25HJ5d8Zrwd4vnCIm1PzW9x0j3IwRVMVUt/a1r4OWA9HV\r\ne6a08O3d+IRfXSV7LPvpgIoiS5XLZUzdBM95OAgLvU6JJq4v+l3bJISRY5y1\r\nwHZwEPZYrdq52DXSNYKdWZdmvWq0oCC3FujdvUcozs/3GCxU+0Gxwzt+bBqx\r\nf5O4Mh77rzbZn06ATe7N12x9ZT+2IntyQfDMNQ2nfmy3Z3S1vR0vNuY1GCE4\r\nIaU7K1vaiYjh2ZZIHl7XQDs3o1h7Ltvhwls=\r\n=KPLd\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"alain21218","email":"alain21218@gmail.com"},"directories":{},"maintainers":[{"name":"alain21218","email":"alain21218@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-translate_1.0.0_1678710862506_0.8070130240779965"},"_hasShrinkwrap":false}},"time":{"created":"2023-03-13T12:34:22.441Z","1.0.0":"2023-03-13T12:34:22.650Z","modified":"2023-03-13T12:34:22.859Z"},"maintainers":[{"name":"alain21218","email":"alain21218@gmail.com"}],"description":"CLI tool to translate JSON files using DeepL API","keywords":["translation","json","deepl"],"author":{"name":"alain21218"},"license":"ISC","readme":"# json-translate\n\nA command-line tool to translate JSON files using DeepL API.\n\n## Installation\n\n```\nnpm install -g json-translate\n```\n\n## Usage\n\n```\njson-translate [-k <key>] [-s <source>] [-t <target>] [--version]\n```\n\nOptions:\n\n- `-k, --key <key>`: DeepL API key\n- `-s, --source <source>`: Source language (default: en)\n- `-t, --target <target>`: Target language (default: fr)\n- `--version`: Show version number\n\nIf the API key is provided, the tool will create a configuration file in the user's home directory (`~/.json-translate`). The tool will then load the source and target JSON files (`<source>.json` and `<target>.json`) and add missing translations to the target file using the DeepL API.\n\nThe tool will recursively traverse the source JSON file and add missing translations to the target JSON file. If a translation already exists in the target JSON file, the tool will skip it.\n\n## Example\n\nSuppose you have the following `en.json` file:\n\n```json\n{\n  \"greeting\": \"Hello, world!\",\n  \"messages\": {\n    \"welcome\": \"Welcome to json-translate!\",\n    \"goodbye\": \"Goodbye!\"\n  }\n}\n```\n\nAnd the following `fr.json` file:\n\n```json\n{\n  \"greeting\": \"Bonjour, le monde!\",\n  \"messages\": {\n    \"welcome\": \"Bienvenue à json-translate!\"\n  }\n}\n```\n\nYou can run the following command to add the missing translations to `fr.json`:\n\n```\njson-translate -k <api_key> -s en -t fr\n```\n\nThe resulting `fr.json` file will be:\n\n```json\n{\n  \"greeting\": \"Bonjour, le monde!\",\n  \"messages\": {\n    \"welcome\": \"Bienvenue à json-translate!\",\n    \"goodbye\": \"Au revoir!\"\n  }\n}\n```\n\n## License\n\nThis tool is licensed under the [MIT License](LICENSE).","readmeFilename":"README.md"}