1.0.1 โข Published 8 months ago
i18n-translate-ln v1.0.1
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.