Locale files change a few keys at a time, and a translator that re-sends the whole file each release is one you stop running. Incremental caching plus cross-file deduplication turns it into something you can wire into a build. Add `--check-keys` when you do, so a partial response fails loudly instead of shipping a locale with holes in it.
An i18n translator for JSON files that works as both a CLI and an MCP server. It flattens the file to paths, translates the strings, and caches what it has already done — so re-running after adding three keys translates three keys, not the whole file. Across several files it deduplicates repeated strings before sending anything.
- `translate_json` — one file: `inputFile`, `targetLanguage`, `outputFile`
- `translate_multiple` — a glob `pattern` translated to an `outputPattern` built from `{dir}`, `{name}` and `{lang}`, with `showStats` reporting how much deduplication saved
- Exact JSON structure preserved, nested objects and arrays included
- Several targets in one run — `-l es,fr,de,ja` from the command line
- `--preserve-formats` to leave URLs, emails, dates, numbers and template variables untouched, and `--detect-source` instead of assuming the source is English
- `--check-keys` to fail with exit code 1 when a key is missing from the output, which catches a silent API failure
- `--dry-run` to see what would be translated before spending anything, and `--sort-keys` for diffs that stay readable
A key for whichever provider you choose — `GEMINI_API_KEY` from Google AI Studio by default, or `OPENAI_API_KEY`, or neither if you run `--provider ollama` against a local model after `ollama pull deepseek-r1:latest`. `npm install -g translator-ai`. The README's MCP config line names `translator-ai-mcp`, which npm does not have; in the client the key goes in the env block, or `TRANSLATOR_PROVIDER` is set to `ollama`. Model choice is per run: `--gemini-model` defaults to `gemini-2.0-flash-lite`, `--openai-model` to `gpt-4o-mini`, `--ollama-model` to `deepseek-r1:latest`. Package `translator-ai`.
