1.0.1 โข Published 5 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-cli
Or run it directly using npx:
npx i18n-translate-cli --help
Usage ๐
Basic Translation
Translate an English JSON file (en.json
) into French (fr.json
):
i18n-translate-cli -f en.json -l fr -o ./locales
Translate into Multiple Languages
Translate into French and Chinese:
i18n-translate-cli -f en.json -l fr,zh -o ./locales
Use Free Google Translate Mode
i18n-translate-cli -f en.json -l fr -o ./locales --free
Use DeepL API (Recommended)
Requires a DeepL API key. Set it using an environment variable:
export DEEPL_API_KEY=your-api-key
i18n-translate-cli -f en.json -l fr -o ./locales
Options โ๏ธ
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.