i18n-translate-ln
v1.0.1
Published
A simple command-line tool to automatically translate JSON localization files into multiple languages using DeepL and Google Translate.
Readme
i18n-translate-cli 🌍
A simple command-line tool to automatically translate JSON localization files into multiple languages using DeepL and Google Translate.
Features 🚀
- 🌎 Translate JSON localization files into multiple languages.
- 🧢 Supports both DeepL API (recommended) and Google Translate Free Mode.
- ⚡ CLI with easy-to-use options for flexibility.
- 📁 Saves translated files in the desired output directory.
Installation 🔧
You can install the package globally using npm:
npm install -g i18n-translate-cliOr run it directly using npx:
npx i18n-translate-cli --helpUsage 📝
Basic Translation
Translate an English JSON file (en.json) into French (fr.json):
i18n-translate-cli -f en.json -l fr -o ./localesTranslate into Multiple Languages
Translate into French and Chinese:
i18n-translate-cli -f en.json -l fr,zh -o ./localesUse Free Google Translate Mode
i18n-translate-cli -f en.json -l fr -o ./locales --freeUse DeepL API (Recommended)
Requires a DeepL API key. Set it using an environment variable:
export DEEPL_API_KEY=your-api-keyi18n-translate-cli -f en.json -l fr -o ./localesOptions ⚙️
| Option | Description |
| ---------------- | ---------------------------------------------- |
| -f, --file | Path to the source JSON file (e.g., en.json) |
| -l, --language | Target language (e.g., fr) |
| -o, --output | Output directory for translated files |
| --free | Use free Google Translate API instead of DeepL |
| --verbose | Show detailed logs while translating |
License 📝
This project is licensed under the MIT License.
Contributing 🤝
Contributions are welcome! Feel free to open an issue or submit a pull request.
