Localization in CI/CD: How to Gate Releases on Missing Translations
What to automate in a localization pipeline, where to put the completeness gate, and complete GitHub Actions and GitLab CI examples using the Translatize CLI.
A release goes out on Friday. Monday morning someone in the Paris office opens the app and half the new checkout flow is in English. Nobody did anything wrong, exactly – the feature merged, the French strings were added to the project, a translator even finished them on Saturday – they just never made it into the build, because nothing in the pipeline was watching for that. Translation drifted out of sync with code the same way a dependency drifts out of sync when nobody runs an update, except there was no lockfile to catch it.
The fix isn't a person remembering to check. It's the same thing you already did for tests and linting: put the check in CI, where skipping it takes a deliberate act rather than an oversight.
What's worth automating
Five things, roughly in the order they happen in a feature's life:
- Push new source strings when they land on a branch, so a translator sees them the same day instead of whenever someone remembers to sync, and AI auto-translation (when you trigger it) has something to work from.
- Pull finished translations back into the repo on a schedule or on demand, so the files your build reads are never more than a day stale.
- Gate on completeness – fail a job when a shipping language is missing strings, rather than finding out from a user.
- Validate placeholders in whatever your own locale files contain, so a translation that dropped or mistranslated a
{name}token fails the build instead of reaching a browser – the same parity check described in translating JSON files with AI runs just as well as a CI step on files you pulled as it does on AI output. - Build a pseudo-locale as part of the same pipeline, so layout and hardcoding regressions in new strings get caught the same day they're written – see the pseudo-localization piece for the transform itself; the only new part here is running it automatically rather than by hand.
None of these need a person to remember them once they're jobs. That's the entire point of putting this in CI/CD rather than in a wiki page titled "release checklist" that half the team has never opened.
The CLI commands these jobs actually run
Three commands cover the sync itself (a fourth, qa, is covered below). npx @translatize/cli push reads your local language files, compares them against the branch, and uploads new and changed keys – it never deletes a remote key, so a key that exists on the branch but not locally is reported and left alone rather than silently dropped. npx @translatize/cli pull writes one file per project language, creating directories as needed. npx @translatize/cli status compares the two sides without changing either – this is the one you turn into a gate, with --fail-on-missing (exit 1 if any language has missing translations) or --fail-on-diff (exit 1 if local differs from the branch at all). Without one of those flags, status still reports every difference, it just exits 0 – useful for a warn-only check that should never fail a build.
Worth being precise about what --fail-on-missing checks: completeness – a non-empty value for every key in every shipping language. Review is the other half of the job, and it happens in the app, on the branch, before anyone merges it into main. The two fit together: by the time a branch reaches the release gate it has been reviewed, and the gate makes sure nothing in it is simply missing.
All three accept --branch <name>, which is resolved in order: the flag, then the branch field in translatize.config.json, then the token's own bound branch. A standard token can only ever act on the branch it's bound to; naming any other branch fails with a branch_not_allowed error. Every command exits 2 on a usage or configuration problem (bad flags, missing config, no token) and 1 on a tripped gate, a rejected push, or a failed API call – which is the distinction a CI job needs to tell "something's wrong with how I called this" apart from "the gate did its job."
Configuration lives in a committed translatize.config.json:
{
"apiUrl": "https://api.translatize.com/v1",
"projectId": "your-project-id",
"format": "json-nested",
"files": "locales/{lang}.json",
"branch": "main"
}
npx @translatize/cli init scaffolds this file for you and, if a token is already set, validates it against the API and prints back the project name, bound branch, role and configured languages – a useful sanity check the first time you wire a repo up. The token itself is never written to the config; it's read from TRANSLATIZE_API_TOKEN in the environment or a --token flag at run time, which is exactly the shape you want for a CI secret.
Where to put the gate, and why
Here's the part people get wrong by defaulting to the strictest possible setting everywhere: blocking every pull request on translation completeness is the wrong call, and warning on pull requests while blocking on the branch that actually ships is the right one.
The reasoning is about where translation work happens relative to code review. A feature branch adds English strings before a translator or the AI has had any chance to see them – that's not drift, it's just the normal order of operations, and a hard gate there punishes a developer for a gap that exists by design, every single time, for the entire life of the feature. Fail the PR on that and you train people to merge with --no-verify energy, which defeats the gate before it's caught anything real.
The branch that matters is the one your release actually builds from. By the time code reaches main, or whatever branch cuts a release, there has been time for translation and review to happen, and a gap at that point is a genuine regression rather than work in progress. That's where --fail-on-missing earns its keep – hard, blocking, no exceptions.
So, concretely: run status with no --fail-* flag on every pull request, so reviewers see what's not yet translated without it turning the check red. Run status --fail-on-missing on the pipeline that builds your release branch, so a release genuinely cannot ship with a gap in a language you support. If you want a middle ground on PRs for files that changed source text without updating translations, --fail-on-diff is a softer signal worth surfacing as a warning rather than a required check.
Completeness is only half of translation quality. npx @translatize/cli qa runs the QA checks – placeholders, ICU syntax, HTML tags, length against a key's character limit, glossary terms and a few more – and exits 1 on errors (--fail-on warning is the stricter setting). Pointed at a branch other than the token's base branch – --branch pr-1234 with a create-own token, say – it also reads the project's merge gate for merging that branch into the base, and a gate that would block the merge fails the job whatever --fail-on says. It is a good required check on pull requests, since an error such as a lost placeholder is a defect in the build rather than work in progress.
One token per branch
Scope the credential the same way you scope the gate. An integration token is bound to exactly one project and one base branch – a fixed-scope token can only ever act on that branch, full stop, so a token minted for a release pipeline cannot be pointed at a feature branch even by accident, and a leaked CI secret has a blast radius of one branch rather than the whole project. A create-own token is the exception: it can also create and act on branches it created itself, which is the shape you want for an automation or agent that opens its own translation branches rather than working on a fixed one.
Practically, that means a team syncing more than one branch through CI mints more than one token: one bound to main for the release gate, a separate one bound to staging if that pipeline also syncs, stored under a different secret name. Rotating one doesn't touch the other, and revoking a compromised token in Translatize invalidates it immediately without affecting the rest.
This is also why the recipes below check a fixed branch rather than whatever branch opened the pull request: a standard token cannot act on a branch it isn't bound to, by design. True per-PR isolation needs a create-own token (developer role or higher) and a branch-creation call up front:
curl -X POST "https://api.translatize.com/v1/integrations/projects/$PROJECT_ID/branches" \
-H "Authorization: Bearer $TRANSLATIZE_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "pr-1234"}'
Branch names allow only letters, digits, hyphens and underscores – no slashes – so feature/checkout-v2 becomes pr-1234 or feature-checkout-v2 on the Translatize side. Once it exists, the same token can push, pull and status --branch pr-1234 against it, and a DELETE call cleans it up once the PR merges. More moving parts than most teams need to script by hand; the fixed-branch setup above is the one worth starting with.
If the repository is on GitHub, the Translatize GitHub App does the per-PR version for you, on the Professional and Agency plans. Every pull request that changes the source-language file gets its own pr-<number> branch with the new and changed strings, optional AI translation, and a "Translatize" check that reports translation status and quality results. When the pull request merges, only the strings it added or changed are merged into the base branch; when it's closed without merging, the branch is deleted.
Where each job runs
- Pull request openedCI · warn only
npx @translatize/cli statusReports what is not translated yet and stays green.
- Merged to mainCI
npx @translatize/cli pushNew source keys reach translators the same day.
- Drafts and reviewTranslators and approvers
AI fills the gaps when asked, native speakers review, a developer, admin or owner approves.
- Nightly pullCI
npx @translatize/cli pullOpens a pull request with the finished translations, so a person merges them.
- Release branch gateCI · blocking
npx @translatize/cli status --fail-on-missingA gap in any shipping language stops the release.
A complete GitHub Actions setup
Three workflows cover the lifecycle described above. First, push new source keys whenever they change on main:
name: Push source keys to Translatize
on:
push:
branches: [main]
paths:
- 'locales/en.json'
jobs:
push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Push source keys
uses: translatize/sync-action@v1
with:
command: push
token: ${{ secrets.TRANSLATIZE_TOKEN }}
Second, warn on every pull request without blocking it, by simply not passing a fail flag:
name: Translation status (informational)
on:
pull_request:
jobs:
status:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Report translation status
uses: translatize/sync-action@v1
with:
command: status
token: ${{ secrets.TRANSLATIZE_TOKEN }}
args: --json
Third, block the pipeline that builds your release branch:
name: Translation release gate
on:
push:
branches: [release]
jobs:
gate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Fail if translations are missing
uses: translatize/sync-action@v1
with:
command: status
token: ${{ secrets.TRANSLATIZE_RELEASE_TOKEN }}
args: --fail-on-missing
- name: Fail on translation errors
uses: translatize/sync-action@v1
with:
command: qa
token: ${{ secrets.TRANSLATIZE_RELEASE_TOKEN }}
fail-on: error
Note the different secret on the last job – TRANSLATIZE_RELEASE_TOKEN is bound to the release branch, while TRANSLATIZE_TOKEN used above it is bound to main, in line with the one-token-per-branch pattern. The second step is the quality gate from earlier: a lost placeholder or a translation over its character limit stops the release the same way a missing string does. The action runs npx --yes @translatize/cli@<version> <command> under the hood and takes command (required: pull, push, status or qa), token (required), fail-on (only for qa: error, the default, or warning), version (default latest), config (default translatize.config.json), api-url and args for anything extra, and node-version (default 24). It has no outputs of its own – a red check and the --json log output are how a failure surfaces.
Pulling translations back is worth doing as a scheduled job that opens a pull request rather than writing straight to a branch, so a human still merges the change:
name: Nightly translation pull
on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
pull:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Pull latest translations
uses: translatize/sync-action@v1
with:
command: pull
token: ${{ secrets.TRANSLATIZE_TOKEN }}
- name: Open a pull request
uses: peter-evans/create-pull-request@v7
with:
commit-message: 'chore(i18n): sync translations from Translatize'
title: 'Update translations from Translatize'
branch: chore/translatize-sync
That last step needs contents: write and pull-requests: write on the job, and your repository's Settings → Actions → General needs "Allow GitHub Actions to create and approve pull requests" switched on, or the PR step fails silently.
The GitLab CI equivalent
GitLab gives you two ways to wire up the same checks: a CI/CD Catalog component, or a plain job that runs the CLI through npx directly. The component is one include:
include:
- component: gitlab.com/translatize/gitlab/translatize@0.2.0
inputs:
command: status
extra_args: "--fail-on-missing"
Its inputs are stage (default test), command (default status; also pull, push or qa), fail_on (only for qa, default error), cli_version (default latest), config (default translatize.config.json), api_url, extra_args, and node_image (default node:24-alpine). If you'd rather not depend on the catalog, the identical check as a hand-written job:
translatize-mr-gate:
stage: test
image: node:24-alpine
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
script:
- npx --yes @translatize/cli@latest status --config translatize.config.json --fail-on-missing
The rules: block scopes this to merge request pipelines specifically, which is the GitLab equivalent of "warn on pull requests" – except here it's written as a hard gate, so reserve this pattern for your release branch and drop --fail-on-missing (or add allow_failure: true) for an informational check on ordinary merge requests.
In GitLab the cleanest way to hand the CLI its token is a TRANSLATIZE_API_TOKEN variable under Settings → CI/CD → Variables, marked as masked. One detail worth getting right: protected variables are not exposed to merge request pipelines, since those run on unprotected refs, so if the MR gate above needs to authenticate, keep the token masked but not protected. A token used only by your release or scheduled pipelines can be both.
A scheduled job that pulls translations and commits them back needs a second, different credential, because pulling and pushing to Git are two separate permissions:
translatize-nightly-pull:
stage: test
image: node:24-alpine
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
variables:
GIT_STRATEGY: clone
GIT_DEPTH: "0"
script:
- apk add --no-cache git
- npx --yes @translatize/cli@latest pull --config translatize.config.json
- |
if [ -z "$(git status --porcelain)" ]; then
echo "Translations already up to date."
exit 0
fi
git config user.email "bot@translatize.com"
git config user.name "Translatize Bot"
git add -A
git commit -m "chore(i18n): sync translations from Translatize [skip ci]"
git push "https://oauth2:${TRANSLATIZE_GIT_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git" "HEAD:${CI_COMMIT_BRANCH}"
TRANSLATIZE_API_TOKEN authorizes the pull; TRANSLATIZE_GIT_TOKEN is a GitLab project access token with the write_repository scope that authorizes the git push – two tokens doing two different jobs, both masked and the Git one also protected. [skip ci] in the commit message stops the push from triggering another pipeline, and git status --porcelain means a quiet night produces no empty commit.
Webhooks instead of polling
Everything above runs on a schedule or a Git event, which is fine for most teams but means your CI only finds out a translation changed the next time a job happens to run. Translatize also fires webhooks when labels change, so a system that genuinely needs to react immediately – kicking off a pull job the moment a translation changes, say – can do that from the webhook instead of waiting for a cron tick. Treat the scheduled pull as the reliable baseline and a webhook-triggered one as the faster path on top of it, rather than removing the schedule entirely – a missed or delayed webhook delivery is still a normal thing to plan for.
Before you wire this up
Confirm your branching model first: if feature work happens on translation branches the way branching is designed to work, decide whether CI pushes and pulls per feature branch or only ever touches main and your release branch – mixing the two without thinking it through is how you end up gating the wrong branch. And if your team practices a string freeze before a release, the gate above is how that policy gets enforced mechanically rather than by reminder – decide what the freeze is for before you decide how strict the gate should be. For what "approved" should mean by the time a branch reaches the gate, see the translation review workflow.
Start with one job: status, no fail flag, on pull requests. Add the release-branch gate once you trust what it reports. Add the scheduled pull once the gate has caught its first real gap and you've seen that the loop actually closes.
