Skip to content

rockbenben/json-translate

Repository files navigation

⚡️ JSON Translate

English | 中文

Precise JSON translation — values only, structure intact, i18n made simple

License: MIT Live Demo

JSON Translate translates JSON safely and fast — it only touches string values and never breaks your schema. It works with 7 traditional translation APIs (DeepL, Google, Azure, DeepLX, Qwen-MT, TranslateGemma, GTX) and 17+ LLM providers (DeepSeek, OpenAI, Claude, Gemini, plus the catch-all Custom OpenAI-compatible endpoint). Use it to localize apps, sites, and datasets with global, JSONPath-targeted, key-based, selective, or i18n aggregation modes.

👉 Try it online: https://tools.newzone.top/en/json-translate

JSON Translate workflow demo

Key Features

  • Schema-Preserving: Translate only string values; structure, key order, and types stay intact.
  • i18n Framework Ready: Works directly with next-intl, i18next, vue-i18n, and react-intl files — nested objects, flat-key namespaces, and ICU placeholders ({name}, {count, plural, ...}, {0}) are kept verbatim.
  • 5 Translation Modes: Global, JSONPath-targeted, specific keys, selective start node, and i18n aggregation.
  • Mapped Translation: Write results to different output keys (e.g. namename_zh) without overwriting originals.
  • Multi-Language Output: Translate into multiple target languages in one pass; each language exports as its own file or aggregates inline.
  • Unlimited Caching (IndexedDB): All results cached locally with no browser-storage size limit.
  • Context-Aware Translation (LLM only): Surrounding lines included in each request for better coherence and terminology consistency.
  • Multi-Locale UI: Powered by next-intl, with full UI translation across 18 languages.
  • Dark Mode: Built-in theme switching.

Translation Modes

Global Translation

Recursively translates every string value in the JSON while preserving hierarchy. Best for translating an entire file in one go.

Targeted Nodes (JSONPath)

Use JSONPath expressions to pinpoint specific nodes; multiple paths can be comma-separated. Best for large files where only a subset needs translation.

Specific Keys

Translate only specified key names:

  • Simple Mode: comma-separated key names
  • Advanced Mode: define input → output key mappings; translations are written to new keys, originals preserved

Keys are case-sensitive. Avoid dot-containing keys — they conflict with JSONPath nesting syntax.

Selective Translation

For flat structures: specify a starting key (optional) and the field names to translate. The tool walks every object from the start key onward and translates the named fields.

i18n Mode

Aggregates per-language translations under the same structure — perfect for multilingual i18n message files.

// Source: 'en' is the source language
{ "title": { "en": "Settings" } }

Translating to zh and fr:

{
  "title": {
    "en": "Settings",
    "zh": "设置",
    "fr": "Paramètres"
  }
}

Existing target-language fields are skipped (won't overwrite). When combined with Multi-Language Output, the result is a unified JSON containing the source and every target language.

Translation APIs

Traditional APIs

API Quality Stability Free Tier
DeepL ★★★★★ ★★★★☆ 500K chars/month
Google Translate ★★★★☆ ★★★★★ 500K chars/month
Azure Translate ★★★★☆ ★★★★★ 2M chars/month (first 12 months)
DeepLX (Free) ★★★★☆ ★★★☆☆ Self-host or free public endpoints
Qwen-MT ★★★★☆ ★★★★☆ Alibaba DashScope quota
TranslateGemma ★★★★☆ ★★★★☆ Self-host (LM Studio / Ollama / etc.)
GTX API (Free) ★★★☆☆ ★★★☆☆ Free (rate-limited)

LLM Providers

Supports DeepSeek, OpenAI, Claude, Gemini, Qwen, Moonshot, Doubao, Zhipu GLM, MiniMax, Mistral, Perplexity, Cohere, OpenRouter, Groq, SiliconFlow, Nvidia NIM, Azure OpenAI, plus any Custom (OpenAI-compatible) endpoint (Ollama / LM Studio / vLLM / Together AI / Fireworks AI etc.). Each provider has a configurable model list, temperature, system / user prompts, and per-request thinking-mode toggle.

Context-Aware Translation (LLM only)

LLM modes can send surrounding lines as context for each batch, improving paragraph-level coherence and terminology consistency.

  • Concurrent Lines: max lines translated in parallel (default 20). Too high triggers rate limits.
  • Context Lines: lines included per batch as context (default 50). Higher = better coherence but more tokens.

Tech Stack

Getting Started

Requirements

  • Node.js >= 20.9.0
  • Yarn (recommended), npm, or pnpm

Install & Run

git clone https://github.com/rockbenben/json-translate.git
cd json-translate

yarn install
yarn dev

Visit http://localhost:3000.

Production Build

yarn build

Documentation & Deployment

For detailed configuration, API setup, and self-hosting instructions, see the Official Documentation.

Quick Deployment: Deploy Guide

Contributing

Contributions are welcome! Feel free to open issues and pull requests.

  1. Fork the repo and create a feature branch
  2. Run yarn and yarn dev locally
  3. Add tests/docs when applicable
  4. Submit a PR with a clear description

License

MIT © 2025 rockbenben. See LICENSE.

About

⚡ Schema-preserving JSON translation for i18n with JSONPath, key mapping & 17+ LLM providers · 保持 schema 的 JSON 翻译工具,支持 JSONPath、键映射与 17+ LLM,专为 i18n 设计

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages