Prompt
How do I keep app strings and translations in sync with Git?
Latest observation
A good way to keep app strings and translations in sync with Git is to make one source of truth and use repeatable, automated workflows around it.
Recommended workflow
1. Keep source strings in version control
Store your base language strings in Git, for example:
en.jsonstrings.xmlLocalizable.stringsmessages.po
Treat this as the canonical file that developers edit.
2. Use a translation file structure that is diff-friendly
Prefer formats that are easy to review in Git:
- JSON/YAML for web/mobile apps
.pofiles for localization workflows- Apple
.strings/.xcstrings - Android
strings.xml
Avoid formats that are hard to merge or diff if possible.
3. Extract strings automatically
Don’t hand-edit translated files if you can avoid it.
Use tooling to:
- scan code for new/changed strings
- update the source language file
- mark missing/obsolete entries
Examples:
- i18next extraction
- Flutter intl tooling
- Android Studio string resources
- Xcode string catalogs
- gettext extractors
4. Commit translation updates separately
A common pattern:
- commit 1: code changes + source string updates
- commit 2: translation file updates
- commit 3+: translated locale updates
This makes diffs easier to review and reduces merge conflicts.
5. Use a translation management system if needed
If translations are handled by humans or translators, use a TMS such as:
- Lokalise
- Phrase
- Crowdin
- Transifex
- POEditor
These tools can sync with Git:
- push source strings from Git
- pull translated strings back into Git
- keep branch/PR workflows clean
6. Automate sync in CI/CD
Add checks in CI to ensure:
- source strings are up to date
- no locale is missing required keys
- obsolete keys are flagged
- formatting/escaping is valid
You can fail builds if:
- a new key exists in one locale but not another
- a translation file is malformed
- untranslated strings were accidentally committed
7. Protect against merge conflicts
To reduce conflicts:
- sort keys consistently
- keep one key per line when possible
- avoid reformatting entire files
- update files with tooling rather than manual edits
- keep each locale file independently generated
8. Use a stable key naming scheme
Examples:
home.titleauth.login.buttonerrors.network.unavailable
This helps translators and developers understand context and reduces churn when text changes.
9. Don’t use the UI text as the key
Bad:
"Save"→"Save"
Better:
"settings.save_button"→"Save"
That way you can change the visible text without renaming keys.
10. Add metadata/context for translators
Include:
- comments
- screenshots
- developer notes
- character limits
- placeholders/examples
This helps prevent incorrect translations and reduces back-and-forth.
Simple Git-based pattern
A practical setup looks like this:
locales/en.json— source stringslocales/fr.json,locales/de.json, etc. — translated files- CI job validates key parity
- a script extracts/updates
en.json - translators work via TMS or PRs
- Git stores every change and history
If you want a very simple rule set
- Edit only source strings in code.
- Extract/update locale files with a script.
- Commit source changes first.
- Sync translations via TMS or dedicated PRs.
- Validate all locales in CI.
If you want, I can also show:
- a Git workflow example
- a CI check script
- or recommendations for React / iOS / Android / Flutter specifically.