json-translator  by mololab

CLI tool for JSON/YAML translation using multiple AI/free modules

created 3 years ago
565 stars

Top 57.8% on sourcepulse

GitHubView on GitHub
Project Summary

This tool provides a command-line interface (CLI) and a JavaScript/TypeScript library for translating JSON and YAML files. It supports multiple translation services, including free options like Google Translate, Bing Translate, Libre Translate, and Argos Translate, as well as paid options like DeepL and various OpenAI GPT models. The primary benefit is automating the localization of structured data.

How It Works

The project leverages a modular architecture, allowing users to select different translation APIs. It handles the parsing of JSON and YAML files, extracts translatable strings, sends them to the chosen translation service, and then reconstructs the translated files. The library also includes features for ignoring specific placeholders (e.g., {{name}}) and URLs during translation to preserve formatting and variables.

Quick Start & Requirements

  • Install: npm i -g @parvineyvazov/json-translator (for CLI) or npm i @parvineyvazov/json-translator (for library).
  • Usage: jsontt <your/path/to/file.json> or jsontt <your/path/to/file.yaml>.
  • Dependencies: Node.js. API keys are required for DeepL and OpenAI models (set as environment variables DEEPL_API_KEY or OPENAI_API_KEY).
  • Docs: https://github.com/mololab/json-translator

Highlighted Details

  • Supports translation of JSON and YAML files, including deeply nested structures.
  • Offers a fallback mechanism to try alternative translation modules if one fails.
  • Includes options to control concurrency limits for API requests.
  • Automatically ignores URLs and placeholders like {{variable}} during translation.

Maintenance & Community

The project is maintained by mololab. Community interaction and support are available via Twitter.

Licensing & Compatibility

The package is licensed under the MIT license, permitting commercial use and integration into closed-source projects.

Limitations & Caveats

Browser support is listed as "coming soon." Some advanced features like filtering fields during file translation are still in the roadmap. The README mentions that higher concurrency limits can lead to API bans.

Health Check
Last commit

7 months ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
23 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.