Table of Contents
Table of Contents
- CI/CD for Localization: Automating Translation in Your Deployment Pipeline
- Key Takeaways
- Why Automate Localization in CI/CD?
- Pipeline Architecture
- Implementation with GitHub Actions
- On Pull Request: Validate Translations
- On Merge to Main: Sync and Deploy
- On Translation Complete: Webhook-Triggered Build
- Automated Validation Checks
- Handling Incomplete Translations
- FAQ
CI/CD for Localization: Automating Translation in Your Deployment Pipeline
Key Takeaways
- CI/CD integration eliminates manual translation file management and ensures translations ship with every deployment
- Automated string extraction and validation catch missing translations before they reach production
- Webhook-triggered builds enable continuous localization — translations go live as soon as they are approved
- Pre-merge checks can block PRs with untranslated strings, preventing incomplete localizations from shipping
Why Automate Localization in CI/CD?
Manual localization workflows create bottlenecks:
- Developers forget to upload new strings to the TMS
- Translated files sit in the TMS waiting for someone to download them
- Merge conflicts arise from manual file placement
- Missing translations slip into production
CI/CD automation solves these problems by making translation sync a standard part of every build and deployment.
Pipeline Architecture
Code Push → CI Triggered → Extract Strings → Push to TMS
↓
Production ← Deploy ← Build ← Pull Translations ← Translations Complete (webhook)
Implementation with GitHub Actions
On Pull Request: Validate Translations
name: Translation Check
on: pull_request
jobs:
check-translations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Scan for new strings
run: npx better-i18n scan --check
# Fails if untranslated strings found
- name: Validate translation files
run: npx better-i18n validate
# Checks JSON syntax, missing keys, placeholder consistency
On Merge to Main: Sync and Deploy
name: Deploy with Translations
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Push new strings to TMS
run: npx better-i18n push
env:
BETTER_I18N_TOKEN: ${{ secrets.BETTER_I18N_TOKEN }}
- name: Pull latest translations
run: npx better-i18n pull --all
- name: Build
run: npm run build
- name: Deploy
run: npm run deploy
On Translation Complete: Webhook-Triggered Build
name: Translation Update
on:
repository_dispatch:
types: [translations-updated]
jobs:
rebuild:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npx better-i18n pull --all
- run: npm run build
- run: npm run deploy
Automated Validation Checks
Build these checks into your CI pipeline:
| Check | What It Catches | When to Run |
|---|---|---|
| Missing translations | Keys without translations in target locales | PR check |
| Placeholder consistency | {name} in source but {nom} in translation | PR check |
| JSON/XLIFF syntax | Malformed translation files | Every build |
| String length | Translations exceeding UI character limits | PR check |
| Unused keys | Translation keys no longer referenced in code | Weekly scheduled |
Handling Incomplete Translations
Not all translations will be complete at deploy time. Strategies:
- Fallback to source language — Show English if translation is missing (most common)
- Block deployment — Only deploy when all target locales are 100% translated (strictest)
- Percentage threshold — Deploy if locale is >90% translated, block if below
- Key-level priority — Critical UI strings must be translated, non-critical can fall back
FAQ
Should I commit translation files to git? Yes. Committing translation files ensures builds work even if the TMS API is unavailable. The CI pipeline pulls fresh translations and commits any changes automatically.
How do I prevent merge conflicts in translation files? Use the TMS as the source of truth. CI pulls translations fresh on each build, overwriting local files. Developers never edit translation files manually.
What if translations are not ready when I need to deploy? Use fallback strategies (show source language for untranslated strings). Track translation completion percentage and set alerts when it drops below threshold.
How do I handle branch-based development? Push strings from feature branches to separate TMS namespaces or branches. Merge translations when the feature branch merges to main.
Can I run localization CI/CD for mobile apps too? Yes. The same principles apply — push strings to TMS, pull translations during build, validate before release. Mobile-specific: include ASO metadata in the pipeline and validate .strings/.xml file formats.