translate_jsonLABSCO SUMMARY
The cache is what makes this affordable to run repeatedly.
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.
What it is
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.
What you get
translate_json— one file:inputFile,targetLanguage,outputFiletranslate_multiple— a globpatterntranslated to anoutputPatternbuilt from{dir},{name}and{lang}, withshowStatsreporting how much deduplication saved- Exact JSON structure preserved, nested objects and arrays included
- Several targets in one run —
-l es,fr,de,jafrom the command line --preserve-formatsto leave URLs, emails, dates, numbers and template variables untouched, and--detect-sourceinstead of assuming the source is English--check-keysto fail with exit code 1 when a key is missing from the output, which catches a silent API failure--dry-runto see what would be translated before spending anything, and--sort-keysfor diffs that stay readable
Requirements
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. That install also puts the MCP server on your PATH as translator-ai-mcp; the client runs it by that name (the README's npx line for it names a package npm does not have), with the key in the env block, or TRANSLATOR_PROVIDER 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.
Setup effort
One command plus a key — npm install -g translator-ai, then supply credentials
USE CASES
Keeping a locale file current after a feature lands
Re-run against the same target and pay only for the new strings, not the whole file.
Translating a whole locales directory at once
Point it at the glob with an output pattern, and let deduplication collapse the strings that repeat across files.
Not breaking your template variables
Turn on format preservation so placeholders, URLs and dates survive the translation intact.
Translating without sending strings to a cloud provider
Run it against a local Ollama model, which costs nothing per call and keeps the copy on your machine.
Catching an incomplete translation in CI
Verify every source key made it into the output, and fail the build when one did not.
2 tools
Listed in project docs. Your client may show a different list.
translate_multipleBEFORE YOU INSTALL
What to know first
Tools you get
2 tools named in the project's documentation.
Where it runs
The documented client runs the server on your machine.
INSTALLATION
Connect your client
Server setup
npm install -g translator-aiMCP Clients
Claude Desktop
{
"mcpServers": {
"translator-ai": {
"command": "translator-ai-mcp",
"env": {
"GEMINI_API_KEY": "<YOUR_GEMINI_API_KEY>"
}
}
}
}translator-ai-mcp is on your PATH after npm install -g translator-ai. Instead of a Gemini key you can use OPENAI_API_KEY, or set TRANSLATOR_PROVIDER to ollama for a local model with no key.