Mrs. Sri sends the Mist Homestay brochure copy to the translators, and it comes back in four languages. Before 1,000 sheets are printed, a proofreader reads every page: a missing price, a guest's name spelled wrong, text too long to fit its box. An app's dictionaries need the same proofreader, because translating is no longer one person editing JSON. There is a flow. The developer writes the English text, a tool collects its keys, and translators work in a translation platform (a TMS, Translation Management System). The result comes back to the repo as a pull request, and CI (the automatic checks that run on every pull request) checks the files before they are merged. CI is that proofreader, and it never gets tired.
The flow, from a new key to translations in the repo
Mrs. Sri adds a "Breakfast included" line to the booking card:
- The developer writes
t('breakfast')in the code and"breakfast": "Breakfast included"inlocales/en-US/booking.json(the source language), then runsnpx i18next-cli extractand commits. - Upload: once it lands on
main, GitHub Actions sends the source file to the TMS. - Translators translate in the TMS, with context: the key's description, a length limit ("button, max. 32 characters"), what each slot means (
{{name}}= the booker's name) and a screenshot of the card. - Review: a second translator approves the translation.
- Download: GitHub Actions pulls the translations into a branch of its own and opens a pull request.
- CI checks that PR. Red = it may not be merged. Green = merge, then deploy.
Translation files in the repo are not edited by hand. The TMS is the source of truth: an edit straight in the JSON is overwritten by the next download.
TMS: where translators work
A TMS has two main jobs: giving translators an interface (an editor with context, screenshots, a glossary, translation memory, review and approval) and syncing the translation files with the repository automatically (uploading the source text, downloading translations as a PR). A TMS does not translate by itself, does not replace JSON with a database, and does not redirect visitors.
| TMS | How it runs | Syncing with the repo |
|---|---|---|
| Crowdin | cloud service | the crowdin/github-action GitHub Action, Crowdin CLI |
| Lokalise | cloud service | GitHub integration, Lokalise CLI and API |
| Weblate | open source (GPL 3.0), self-hosted or the hosted service | reads and writes the Git repo directly |
| Tolgee | open source (Apache 2.0 core), self-hosted or cloud | Tolgee CLI, API, GitHub Action |
All four read i18next JSON. Choose by what your team needs (must it run on your own server? does your translation agency already use one?), not by a ranking.
Automatic sync with GitHub Actions
# .github/workflows/crowdin.yml
name: Crowdin
on:
push: { branches: [main], paths: ['locales/en-US/**'] }
schedule: [{ cron: '0 1 * * *' }] # every day at 01:00 UTC
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: crowdin/github-action@v3
with:
upload_sources: true
download_translations: true
skip_untranslated_strings: true
localization_branch_name: l10n_crowdin
create_pull_request: true
pull_request_title: 'New translations from Crowdin'
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
- Versions as of October 2026:
actions/checkout@v7,crowdin/github-action@v3(running on Crowdin CLI 5). skip_untranslated_strings: true: without it, Crowdin fills untranslated strings with the source text, so the Japanese card can carry an English sentence and every key-count check still passes.GH_TOKENis a personal access token (PAT), not the built-inGITHUB_TOKEN. A PR created with the built-inGITHUB_TOKENtriggers no other workflow, so the CI below would never run on the translation PR.
CI that fails the build
# .github/workflows/i18n.yml
name: i18n
on:
pull_request:
paths: ['src/**', 'locales/**', 'scripts/check-i18n.mjs']
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
- run: npm ci
- name: Missing keys per language
if: ${{ !cancelled() }}
run: npx i18next-cli status
- name: Unused keys
if: ${{ !cancelled() }}
run: npx i18next-cli status --unused
- name: Slot syntax
if: ${{ !cancelled() }}
run: node scripts/check-i18n.mjs syntax
- name: Placeholders match en-US
if: ${{ !cancelled() }}
run: node scripts/check-i18n.mjs placeholders
- name: Button text length
if: ${{ !cancelled() }}
run: node scripts/check-i18n.mjs length
- Any step that exits with a code other than 0 turns the job red, and GitHub can require this job to be green before merging (branch protection).
if: ${{ !cancelled() }}: the next steps still run when an earlier one failed, so one run shows every problem, not just the first.npx i18next-cli status(i18next-cli 1.75.2) exits with code 1 when a key is not there (absent) or empty (untranslated) in any language.status --unusedexits with code 1 when a file has keys the code does not use.- One more useful step:
npx i18next-cli extract --ci --dry-runfails when the developer forgot to runextractafter adding a key.
CI results on the PR from the TMS
The first PR from the TMS brings five mistakes. This is the real output of each step:
$ npx i18next-cli status
Translation Progress:
- id-ID: [■■■■■■■■■■■■■■■■■■■■] 100% (10/10 keys)
- ja-JP: [■■■■■■■■■■■■■■■■■■□□] 90% (9/10 keys), 1 absent
- ar-EG: [■■■■■■■■■■■■■■■■■■■■] 100% (20/20 keys)
✖ Error: Incomplete translations detected.
$ npx i18next-cli status --unused
[ja-JP/booking] locales/ja-JP/booking.json
✗ payAtHomestay
Summary: Found 1 unused key(s). No files were modified.
$ node scripts/check-i18n.mjs syntax
id-ID total_other: slot braces not closed
"Total {{count} malam: {{price}}"
1 problem(s) (syntax)
status gives id-ID 100%, even though total_other is broken. It only counts keys that exist and are not empty, not what they hold. (We wrote the dash before "1 absent" as a comma.)
| Mistake from the TMS | Caught by | What the guest sees if it slips through (i18next 26.4.3) |
|---|---|---|
ja-JP has no cancel yet |
status |
the cancellation line in English, from fallbackLng |
ja-JP still keeps payAtHomestay (the old name of book) |
status --unused |
nothing, it only adds bytes |
id-ID {{count} is missing a brace |
check-i18n syntax |
"Total {{count} malam: {{price}}", the price gone too |
ar-EG writes the slot as {{الاسم}} |
check-i18n placeholders |
"شكرًا لك يا {{الاسم}}!", and Rina's name never shows |
id-ID button of 56 characters |
check-i18n length |
a three-line button on a 360 px screen |
A check script of your own: syntax, placeholders, length
i18next-cli 1.75.2 does not look inside translations, so those three checks are written by hand (newer versions have a slot check, see Other options below):
// scripts/check-i18n.mjs: node scripts/check-i18n.mjs syntax | placeholders | length
import { readFileSync } from 'node:fs';
const read = (locale) => JSON.parse(readFileSync(`locales/${locale}/booking.json`, 'utf8'));
const source = read('en-US');
const MAX = { book: 32 }; // booking button: max. 32 characters
const baseKey = (key) => key.replace(/_(zero|one|two|few|many|other)$/, '');
const slots = (text) => [...text.matchAll(/\{\{\s*([^{},\s]+)[^{}]*\}\}/g)].map((m) => `{{${m[1]}}}`);
const checks = {
syntax: (text) => /[{}]/.test(text.replace(/\{\{[^{}]+\}\}/g, '')) && 'slot braces not closed',
placeholders: (text, key) => {
const want = slots(source[key] ?? source[`${baseKey(key)}_other`] ?? '');
const got = slots(text);
const plural = key !== baseKey(key); // plural forms may drop {{count}}: "ليلة واحدة"
const bad = got.some((s) => !want.includes(s)) || want.some((s) => !got.includes(s) && !(plural && s === '{{count}}'));
return bad && `slots ${got.join(' ') || '-'}, source ${want.join(' ')}`;
},
length: (text, key) => [...text].length > MAX[baseKey(key)] && `${[...text].length} characters, max. ${MAX[baseKey(key)]}`,
};
const check = process.argv[2];
let problems = 0;
for (const locale of ['en-US', 'id-ID', 'ja-JP', 'ar-EG']) {
for (const [key, text] of Object.entries(read(locale))) {
const error = checks[check](text, key);
if (error) {
problems++;
console.log(`${locale} ${key}: ${error}\n ${JSON.stringify(text)}`);
}
}
}
console.log(problems ? `${problems} problem(s) (${check})` : `OK (${check})`);
process.exitCode = problems ? 1 : 0;
- syntax: remove every complete slot (
{{price}}); if a{or}is still left, a slot is broken. - placeholders: every slot in a translation must exist in the
en-USsource ({{الاسم}}doesn't). A plural form the source lacks, such astotal_two, is compared with the source's_otherform. Every source slot must come along, except{{count}}in plural forms:ليلة واحدة(one night) simply doesn't write the number. - length:
[...text].lengthcounts Unicode characters. For Japanese, the character count is not the same as the width on screen; the visual check is in the Testing i18n lesson. process.exitCode = 1is what turns the CI step red.
Other options for the slot check. Since i18next-cli 1.80.0 (22 October 2026), npx i18next-cli lint also compares each language's slots with the primary language:
| Way | When to pick it |
|---|---|
check-i18n.mjs (this lesson) |
The default here: one script checks syntax, slots and length, and you can read how it works. |
npx i18next-cli lint with lint: { checkTranslationPlaceholders: 'error' } in i18next.config.js |
Dictionaries in the i18next format, when you want a slot check without writing code. Without 'error', it only warns and the CI step stays green. |
npx formatjs verify |
ICU dictionaries (react-intl, next-intl), see the section below. |
This is lint (i18next-cli 1.88.0) on the two slot mistakes above:
$ npx i18next-cli lint
✖ Linter found 2 potential issues.
locales/id-ID/booking.json
7: Error: Placeholder mismatch: "total_other: missing {{count}}, {{price}} (compared with "en-US")"
locales/ar-EG/booking.json
2: Error: Placeholder mismatch: "thanks: missing {{name}}, unexpected {{الاسم}} (compared with "en-US")"
lint catches both and exits with code 1: it reads the broken {{count} in id-ID as {{count}} and {{price}} missing. It only sees it because Indonesian has one plural form. Plural forms are compared as one group, so in a language that also has a correct total_one, such as English, a broken total_other is not reported. And lint never checks length. So the syntax and length checks still need your own script.
💡 If the dictionaries are ICU: formatjs verify
react-intl and next-intl projects have a ready-made check: npx formatjs verify --source-locale en-US --missing-keys --extra-keys --structural-equality lang/*.json (@formatjs/cli 6.16.34). On the ICU dictionaries of our card with the same mistakes, it reports cancel missing and payAtHomestay extra in ja-JP, total: EXPECT_ARGUMENT_CLOSING_BRACE (an ICU message that does not parse) in id-ID, and "Different number of variables" for thanks in id-ID ("[name] vs [gender, name]") and ar-EG. Then it exits with code 1. The id-ID one is not a wrong translation: Indonesian picks Pak, Bu or Kak from gender, and the English source doesn't need it. --structural-equality asks for the same variables in every language, so write {gender, select, other {Thank you, {name}!}} in the source and wrap ja-JP the same way. Then ar-EG shows its real mistake: thanks: Missing variable name in message.
⚠️ Shortcuts that let broken translations through
- Turning off a CI step to get green. The mistake still reaches guests:
{{الاسم}}shows as is on the Arabic card. Fix it in the TMS, then download again. - Trusting 100%.
statuscounts keys, not their content. Syntax, slots and length need checks of your own. - The TMS fills gaps with the source text. Set
skip_untranslated_strings: true, so an untranslated key is really missing andstatuscatches it. - Editing translation JSON straight in the repo. The next download overwrites it. Fix it in the TMS.
- A translation PR created with the built-in
GITHUB_TOKEN. Its CI never runs. Use a PAT or a GitHub App token.
TL;DR: The translation flow: the developer writes the en-US key and runs extract, GitHub Actions uploads the source to the TMS, translators work with context (description, length limit, slot meanings, screenshot) and review each other, and the translations come back as a pull request. A TMS (Crowdin, Lokalise, Weblate, Tolgee; the last two can be self-hosted) gives translators an interface and syncs the files with the repo automatically. CI on that PR must go red for: missing keys (npx i18next-cli status), unused keys (status --unused), broken slots, placeholders that differ from en-US, and button text over its limit (a script of your own with process.exitCode = 1). status says 100% even when the content is broken. Use if: ${{ !cancelled() }} so every problem shows in one run, skip_untranslated_strings: true in Crowdin, a PAT for translation PRs, and fix things in the TMS, not by turning checks off. For ICU dictionaries: formatjs verify --missing-keys --extra-keys --structural-equality.
⚡ The flow, from a new key to a PR
Meaning: The developer writes the key in the en-US file and runs extract. GitHub Actions uploads the source file to the TMS, translators translate with context, a second translator reviews, then the translations come back to the repo as a pull request that CI checks.
⚡ TMS: where translators work
Guess first: does a TMS like Crowdin or Lokalise translate by itself?
No. A TMS does not translate by itself, does not replace JSON with a database, and does not redirect visitors.
Meaning: A TMS has two main jobs: giving translators an interface (an editor with context, screenshots, a glossary, review) and syncing the translation files with the repository automatically. The TMS is the source of truth, so don't edit translation JSON straight in the repo.
⚡ CI that fails the build
Write:
- name: Missing keys per language
if: ${{ !cancelled() }}
run: npx i18next-cli status
Meaning: A step that exits with a code other than 0 turns the job red. !cancelled() makes every problem show in one run. status only counts keys, not their content, so slot syntax, placeholders and text length need a check script of your own.