i18next JSON example and format: translate i18n JSON with AI

i18next, next-intl and react-intl JSON: nested keys, _one/_other plurals, {{name}}, $t() and <Trans> tags kept intact.

.jsonformat: jsonone file per locale

What it is

JSON is the default for JavaScript apps: i18next and react-i18next, next-intl, react-intl (FormatJS), vue-i18n and countless hand-rolled loaders. Each locale is one file (or one file per namespace), with keys either nested in objects or flat ("home.title"). i18next writes plurals as suffixed sibling keys and placeholders as {{name}}; next-intl and FormatJS put an ICU MessageFormat string in each value.

Example

public/locales/en/translation.json
{  "nav": {    "settings": "Settings",    "signOut": "Sign out"  },  "home": {    "greeting": "Welcome back, {{name}}!",    "unread_one": "You have {{count}} unread message",    "unread_other": "You have {{count}} unread messages",    "openSettings": "Open $t(nav.settings)",    "terms": "By continuing you accept the <1>terms</1>."  }}

How Glossa handles it

Plurals
i18next JSON v4 suffixes (_zero, _one, _two, _few, _many, _other) are grouped into one plural string and written back with the suffixes the target language needs: _one, _few, _many and _other for Russian, _other alone for Japanese. ICU plurals in next-intl and FormatJS files stay one message and are checked branch by branch.
Comments and context
JSON has no comments, so context comes from your code: glossa context finds where each i18next or next-intl key is used and records the excerpt, and every translation prompt reads it. You can also add a note to a key in the dashboard or with update_unit.
Placeholders
{{name}} and {{count}}, {name}, ${name}, %s, $t(nesting), HTML tags and react-i18next <Trans> index tags (<1>…</1>) are protected. A draft that renames, drops or adds one is marked needs review with a review task instead of being written.
Round trip
Nested objects are read as dot-joined keys and written back nested, flat files with dotted keys stay flat, and each target file keeps the source's key order and indentation.

What a translated i18next file looks like

Pull writes public/locales/es/translation.json with the same nesting, key order and indentation as the source. Placeholders, the $t(nav.settings) reference and the <1> tag come back exactly as written; only the text around them is translated.

public/locales/es/translation.json
{  "nav": {    "settings": "Ajustes",    "signOut": "Cerrar sesión"  },  "home": {    "greeting": "¡Hola de nuevo, {{name}}!",    "unread_one": "Tienes {{count}} mensaje sin leer",    "unread_other": "Tienes {{count}} mensajes sin leer",    "openSettings": "Abrir $t(nav.settings)",    "terms": "Al continuar, aceptas los <1>términos</1>."  }}

Plurals: _one and _other are not enough

Since i18next 21 (JSON v4) a plural is a set of sibling keys with CLDR suffixes, resolved with Intl.PluralRules, and the count variable must be called count. Glossa reads unread_one and unread_other as one plural string (a group needs an _other key, so a lone is_one stays a normal string) and asks for every form the target language has. Russian uses different forms for 1, for 2–4 and for 5–20, so a Russian draft with only _one and _other is rejected with "plural needs the few, many forms for ru (one, few, many, other)" and filed for review. The accepted file has all four:

public/locales/ru/translation.json (excerpt)
"unread_one": "У вас {{count}} непрочитанное сообщение","unread_few": "У вас {{count}} непрочитанных сообщения","unread_many": "У вас {{count}} непрочитанных сообщений","unread_other": "У вас {{count}} непрочитанного сообщения"

Interpolation, nesting and <Trans> tags

react-i18next's <Trans> component numbers its children by position, so a translation refers to them as <1>…</1> or <3/>; drop one and the link or bold text silently disappears from the UI. Glossa treats those index tags like HTML tags, and {{name}} and $t(key) like any placeholder: a draft that writes {{nombre}} for {{name}}, translates the key inside $t(), or loses </1> fails the check ("Missing {{name}}", "Unexpected {{nombre}}") and goes to the review queue with the problem named. The same check runs again on pull, so a hand edit that breaks a placeholder is reported before it ships.

ICU messages: next-intl, react-intl and FormatJS

These libraries keep ICU MessageFormat in plain JSON values. Glossa translates each ICU string as one message, never splitting it into keys, and compares the draft with the source: the same arguments and tags, =0 and =1 branches kept, select keys as written, and every plural category the target language needs. A Russian draft with only one and other is rejected with "{count, plural} needs the few, many categories in ru".

messages/en.json
{  "Inbox": {    "files": "{count, plural, =0 {No files} one {# file} other {# files}}",    "shared": "Shared by <b>{owner}</b>"  }}

Namespaces and file names

i18next-http-backend loads /locales/{{lng}}/{{ns}}.json by default, so most apps keep one folder per language with a file per namespace. Glossa finds the locale in the path and writes the target next to it: public/locales/en/translation.json becomes public/locales/es/translation.json and public/locales/pt-BR/translation.json; messages/en.json becomes messages/es.json. Push every namespace in one command, and the same English sentence in two namespaces (or two apps) is translated once.

npx @meterapp/glossa push public/locales/en/*.json --project webnpx @meterapp/glossa pull --project web --locale es,de,pt-BR

Keep it in sync from CI

sync pushes the source files, waits for new strings to be translated and pulls every locale file, so the pull request carries its translations. With --context it first records where new keys are used in your code (literal i18next and next-intl keys), which matters for JSON because the file itself has no room for comments. Keys whose English changed are translated again, or kept for review if the project turns retranslation off.

npx @meterapp/glossa sync public/locales/en/*.json --project web --context --src src --wait 10mgit add public/locales

Translate it from the command line

Push the source-language file; strings are deduplicated against the rest of your workspace and queued for translation. Pull writes public/locales/es/translation.json back in the same format.

npx @meterapp/glossa loginnpx @meterapp/glossa push public/locales/en/translation.json --project appnpx @meterapp/glossa pull --project app --locale es,de,ja

Or ask an agent over MCP: “Push public/locales/en/translation.json to Glossa and pull Spanish.” It calls push_file and pull_file. See the CLI and MCP guides.

Questions

How do I translate i18next JSON files with AI?
Push the source-language files (npx @meterapp/glossa push public/locales/en/*.json --project web). Glossa translates every string into the project's target languages with Claude, using your glossary, rules and recorded code context, and pull writes public/locales/es/translation.json and the other locales in the same layout.
Will AI translation break my plurals or {{placeholders}}?
Every draft is checked before it is stored: the same {{placeholders}}, $t() references and tags, and every plural suffix the target language needs (_few and _many for Russian and Polish, for example). A draft that fails is marked needs review and goes to the review queue with the problem named, and AI never overwrites a reviewed or human translation.
Does Glossa change the structure of my JSON files?
No. Nested files are written back nested and flat files flat, with the source's key order and indentation, so a translation diff shows only the strings that changed.
Can my coding agent translate the strings instead?
Yes. Set the project's translation mode to agent and Claude Code, Codex or Cursor reads list_missing_translations (keys, file paths, glossary and rules) over MCP or the CLI and writes them back with submit_translations. The same checks apply, and no AI translation credits are used.

Other formats

Moving from Crowdin? Read the comparison.

Bring every translation you have

Glossa hosts every app free, for good. Import your files, connect your chatbot to audit them, and export the fixes back into your codebase.