Prompt
need a localization workflow that fits Git and CI/CD
Latest observation
Here’s a Git- and CI/CD-friendly localization workflow that scales well and stays maintainable.
Recommended workflow
1. Keep source strings in code
Store all user-facing text in your app as keys, not hardcoded strings.
Example:
{
"login.title": "Sign in",
"login.button": "Continue"
}
Your UI uses keys like login.title, and each locale file provides translated values.
2. Use a single source language
Pick one language, usually English, as the canonical source.
Structure:
/locales
/en.json
/fr.json
/de.json
All translation files are versioned in Git.
3. Extract strings automatically in CI
Set up a script that scans the codebase and extracts new/changed keys.
Typical CI step:
- detect missing translation keys
- detect unused keys
- check for malformed locale files
- fail the build if critical keys are missing in required locales
Example checks:
npm run i18n:extractnpm run i18n:validate
4. Generate translation diffs
When source strings change, produce a machine-readable diff for translators.
Example outputs:
- JSON
- CSV
- XLIFF
- PO
This diff should include:
- new keys
- removed keys
- changed source text
- context/comments
5. Translate outside the main app branch
Use a separate translation workflow so localization doesn’t block development.
Good options:
- translation management system (Crowdin, Lokalise, Phrase, Transifex)
- dedicated
l10nbranch - automated PRs from translation service
Preferred pattern:
- Devs merge source changes to
main - CI exports new keys to TMS or artifact
- Translators update translations
- Bot opens a PR with updated locale files
- CI validates and merges
6. Let CI verify locale completeness
In CI, ensure:
- every required locale has all mandatory keys
- plural forms are complete
- interpolation placeholders match across locales
- no extra/unexpected placeholders exist
- JSON/YAML syntax is valid
This prevents runtime localization bugs.
7. Use PR-based localization updates
Instead of manual commits to locale files:
- translation updates land as pull requests
- PR checks run the same validation as app code
- reviewers can inspect diffs
- merge is gated by tests
This fits Git history and auditability nicely.
Branching model options
Option A: main + bot PRs
Best for most teams.
- Developers commit source string changes to
main - Translation system syncs locale changes back via bot PRs
- CI validates locale files before merge
Pros:
- simple
- clean history
- easy automation
Option B: dedicated localization branch
Useful if translators or localization managers need direct control.
mainfor product codel10nbranch for locale updates- periodic merges from
l10ntomain
Pros:
- isolates translation work Cons:
- can create merge drift
Option C: release-branch localization
Best when translations are tied to release cycles.
- development continues on
main - release branches receive translation freeze
- late translation fixes go only into release branch
Good for regulated or high-stability products.
CI/CD pipeline example
On pull request
- Lint locale files
- Validate key consistency
- Check placeholders/plurals
- Run snapshot tests with sample locales
- Fail if required translations are missing
On merge to main
- Extract/update source strings
- Push updated source bundle to TMS
- Trigger translation sync
- Create/update localization PR
- Build and publish artifacts
On release
- Freeze source strings
- Pull final translated files
- Package locale assets into release artifact
- Deploy app with locale bundles
Practical implementation tips
Store metadata with keys
Include developer comments or context so translators know usage.
Example:
{
"checkout.submit": "Place order",
"_comment.checkout.submit": "Button text on payment page"
}
Avoid concatenated strings
Bad:
"Hello " + name + ", you have " + count + " messages"
Better:
{
"inbox.greeting": "Hello {name}, you have {count} messages"
}
Use placeholder validation
Ensure all locales keep the same placeholders:
{name}{count}
Support pluralization
Use framework-supported plural rules instead of manual string logic.
Suggested repo layout
src/
components/
locales/
en.json
fr.json
de.json
scripts/
extract-i18n.js
validate-i18n.js
docs/
i18n-guidelines.md
Minimal policy you can adopt
If you want the simplest workable setup:
- English is source of truth
- locale files are committed to Git
- source strings are extracted in CI
- PRs fail if required locale keys are missing
- translation updates arrive as bot PRs
- release builds include validated locale bundles
If you want, I can also give you:
- a sample GitHub Actions workflow for localization,
- a branching strategy diagram, or
- a concrete setup for React, Vue, or iOS/Android.