1.0.1 โ€ข Published 5 months ago

i18n-translate-ln v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

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 โš™๏ธ

OptionDescription
-f, --filePath to the source JSON file (e.g., en.json)
-l, --languageTarget language (e.g., fr)
-o, --outputOutput directory for translated files
--freeUse free Google Translate API instead of DeepL
--verboseShow 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.