Translate JSON files locally by running an instruction model in Ollama and using Transglot Community to apply it to your locale files. This walkthrough takes one English invitation label, drafts its French translation, and shows the change in Git. The key stays project.invite so your application can find it, and {{name}} stays intact so your i18n library can substitute the recipient’s name.
Transglot Community is an MIT-licensed JSON translation editor and CLI. It runs on your computer and writes validated translations to the locale files you already keep in Git. It supports JSON, YAML maps, and literal Laravel PHP arrays. This example uses JSON and a model running on the same machine. Community quickstart · Source code on GitHub
1. Install Ollama and download a local model
Use Node.js 22.15 or later, npm, Git, and Ollama. Install and start Ollama using the instructions for macOS, Linux, or Windows. For a terminal-managed server, start ollama serve in a separate terminal if there is no Ollama service running. Ollama setup
In a second terminal, download and list the model. These commands work in PowerShell and macOS or Linux shells.
The example uses the same qwen3:8b model as the Community demo. Ollama also lists a smaller qwen3:4b variant. If you use it, select that exact model tag in Community. Try the one-string sample before choosing a model for a full catalog. Qwen3 model tags in Ollama
Ollama’s local API listens on http://127.0.0.1:11434 by default. To check both the connection and the model list, open http://127.0.0.1:11434/api/tags in a browser. The response should include the tag you pulled. Ollama model list API
2. Open Community and import your JSON locale files
Run these commands from the directory where you want to clone Community.
The editor opens in your browser. The --port 0 option chooses an available port. Keep the local editor URL printed by the command private.
To try a disposable project first, run npm run demo -- --port 0 from the Community checkout. The demo already contains a partially translated French catalog and the same project.invite key used below.
For the Git workflow, start with a repository that tracks its locale files. Here are the two small catalogs used in the example.
locales/en/messages.json
locales/fr/messages.json
- In Projects, choose Import folder and enter the repository’s absolute path, such as
/path/to/my-apporC:/dev/my-app. - Click Detect files. Choose
enas the source,fras the target, andlocales/{locale}/**/*.jsonas the mapping for this folder layout. For a repository withmessages/en.jsonandmessages/fr.json, usemessages/{locale}.json. - Click Preview import. The two-file example has one source file, two source strings, one existing translation, and one missing translation for French. Confirm with Import project.
The screenshot shows the same JSON keys alongside an additional, already translated YAML file.

3. Connect Ollama and preview one missing key
Open AI & context and select Ollama / local model under AI connection. Use the default base URL for a local Ollama service and click Load models. Select qwen3:8b or enter the exact tag shown by ollama list.
In Product context & tone, tell the model where the string appears. For this example, use “This is a button label in a project management app. Use a concise French imperative.” Click Test translation. Community sends a fixed sample greeting and checks whether the model preserves its placeholder. Click Save AI & context settings after the sample passes.
Open Translations, select French, and search for project.invite. Click Translate 1 pending. The translation plan should show one missing string, one target file, and your selected Ollama model. Confirm it once those match.

4. Review the draft and check the Git diff
Open Review changes and find project.invite. Compare the source and the draft. Confirm that the French reads well on a button and still contains the exact {{name}} placeholder. Edit the draft if needed and select Approve.

Community writes validated drafts to your target file when they are generated. Approval records your review and protects the wording from automatic replacement. Inspect the changes from your project repository before staging them.
The French diff for this example adds an invitation alongside the existing project label. The exact draft may vary by model.
Use git status --short to catch newly created locale files, which you can open directly for review. Commit the reviewed locale files and .transglot/state.json when you want to preserve review status in version control. Use Refresh files after editing files outside Community, or Restore points to recover an earlier local snapshot.
Run the same JSON translation from the terminal
Run the following from the Community checkout. Substitute an absolute path for /path/to/my-app. Use init only when the project has no transglot.community.json. Importing through the browser already sets up the mapping.
The dry run lists the planned work before making model requests or writing files. A new copy of the two-file example reports one planned translation. Once the scope matches, run the same command with --dry-run removed.
Inspect the French text in Git, then record your review and run the structural check for that specific key.
What to check beyond valid JSON
- Placeholders. Preserve names and delimiter styles such as
{name},{{name}}, or%s. A well-formed string with{{nom}}still breaks a call site that suppliesname. - ICU plurals. Read the message with real inputs. In
{count, plural, =0 {No invitations} one {# invitation} other {# invitations}},countis the argument and=0is an exact selector. Community checks ICU structure and target locale categories. If your project uses separate i18next keys such asitems_oneanditems_other, manage the key families for each language in your app. - Meaning and fit. Read the text in the product. Check tone, terminology, punctuation, and whether longer strings still fit in buttons and menus. Structural checks leave those decisions to the reviewer.
Community supports flat and nested JSON objects. The editor displays a literal dot as \. so you can tell a single key named project.invite from the nested invite inside project. Pass the key as displayed. When the same key appears in several files, add a source-file filter such as --file locales/en/messages.json to the CLI command. Supported formats and validation details
Troubleshoot a local translation run
| What you see | What to check |
|---|---|
| Connection fails | Start Ollama and open the local /api/tags endpoint. Check the host and port in Community. |
| Model list is empty | Run ollama list and pull a model if the list is empty. Use the complete tag, such as qwen3:8b. |
| The plan has zero pending keys | Check the source mapping and target locale. If the French value already exists, open the key in the editor to edit it directly. |
| The sample fails validation | Try a different instruction model and repeat the built-in sample. If larger runs fail after a sample passes, use a smaller batch. |
| The draft passes but reads badly | Add a product-specific instruction or glossary term. Review and edit the phrase in context before approving it. |
Can I translate JSON files offline?
Yes. Install Community’s dependencies and download your Ollama model first. Once both are ready, inference runs on your machine when Community uses the local Ollama server and the downloaded model. For a cloud API or an eligible ChatGPT account, the selected provider receives the source strings, keys, and relevant context for the run. Community provider setup and data flow
See the broader guide for API scripts and other ways to translate locale files. Translate JSON i18n files with AI
Try the workflow with a single missing key, then repeat it for the rest of the file once the model and review checks work for your project. Get Transglot Community on GitHub