Prompt
How do I keep locale updates in sync with Git and app builds
Latest observation
To keep locale updates in sync with Git and app builds, you want a process that makes translation changes:
- easy to track in version control
- predictable in builds
- hard to forget or partially apply
A solid setup usually looks like this:
1) Put all locale files under Git
Store translation files in the repo, for example:
locales/en.jsonlocales/fr.jsonlocales/es.json
This lets Git track exactly what changed and when.
2) Use a consistent source of truth
Pick one canonical workflow:
- Code-first: developers add/update keys in source, then translators fill values
- Translation-platform-first: translators work in a tool, then changes are pulled into Git
- Hybrid: keys are added in code, translations synced from a service
Whatever you choose, avoid multiple unsynchronized sources.
3) Make locale updates part of the build pipeline
Add a build step that checks locale files before packaging:
- validate JSON/YAML syntax
- ensure all required keys exist in every locale
- fail the build if keys are missing or malformed
- optionally sort keys or normalize formatting
This prevents “works locally, breaks in CI” problems.
4) Automate sync with a script or CI job
Common pattern:
- translation updates land in a dedicated branch or PR
- a sync script pulls/pushes locale files
- CI runs validation and tests
- merge only if locale files pass checks
Example checks:
- all locales contain the same key set
- no empty strings for required languages
- placeholder variables match across locales (
{name},%s, etc.)
5) Commit locale changes separately
Keep translation-only changes in their own commits/PRs when possible.
Benefits:
- easier review
- clearer Git history
- easier rollback if a translation breaks something
6) Generate locale artifacts during build if needed
If your app uses compiled translation assets, generate them from source locale files in CI/build, not by hand.
For example:
- source files:
*.json - generated bundle: compiled locale module or minified output
Then the generated output is always derived from Git-tracked source.
7) Add a diff/check for missing or extra keys
A simple comparison script can catch drift:
- keys added in
enbut missing in other locales - keys removed from source but still present in others
- placeholder mismatches
This is one of the best ways to keep builds in sync.
8) Use a release process for translation updates
If your app ships on a cadence:
- freeze locale files before release
- merge late translation changes only through a controlled PR
- tag the release with the locale version
That keeps app builds reproducible.
9) If using a translation service, sync both directions
Tools like Lokalise, Phrase, Transifex, Crowdin, etc. usually support:
- importing source language keys from Git
- exporting translated files back to Git
- PR-based sync
Set up:
- source import on key changes
- export on translation approval
- CI validation after export
10) Document the workflow
Write a short LOCALE_WORKFLOW.md covering:
- where source strings live
- how to add a new key
- how to update translations
- how CI validates them
- who approves locale changes
That prevents accidental drift over time.
A practical recommended setup
If you want a simple, reliable approach:
- Keep locale source files in Git
- Update source keys in code or a translation manifest
- Use a sync script to update locale files
- Run a CI validation step that checks:
- syntax
- missing keys
- placeholder consistency
- Fail the build on errors
- Merge locale updates through PRs only
Example CI checks
You could run something like:
npm run lint:localesnpm run test:translationsnpm run build
Where lint:locales checks:
- all locale files parse
- all keys match the base locale
- no broken placeholders
If you want, I can also give you:
- a GitHub Actions example
- a Node/Python script to compare locale keys
- a recommended folder structure for locale files
Brands