Prompt
How do I set up a localization workflow for a web app?
Latest observation
A good localization workflow for a web app usually has 5 parts:
- Extract text into translation files
- Use stable translation keys
- Wire translations into your app
- Track and manage translation updates
- Automate validation and deployment
Here’s a practical setup.
1) Pick your localization strategy
Recommended approach
Use message keys + translation files rather than hardcoding strings.
Example:
// en.json
{
"home.title": "Welcome",
"home.subtitle": "Manage your account"
}
Then in code:
t("home.title")
This keeps copy separate from code and makes translations easier to maintain.
Avoid
- Hardcoding text directly in UI components
- Using sentence text itself as the key
- Mixing translated strings with business logic
2) Organize translation files
A common structure:
locales/
en/
common.json
auth.json
fr/
common.json
auth.json
de/
common.json
auth.json
Or one file per language if the app is small.
Good practice
Split by feature/domain:
commonauthcheckoutprofile
This makes files easier to manage as the app grows.
3) Use an i18n library
Choose one based on your stack:
- React:
react-i18next,FormatJS,Lingui - Vue:
vue-i18n - Angular: built-in i18n or
ngx-translate - Next.js:
next-intl,next-i18next,react-intl
What the library should handle
- Language detection
- Translation lookup
- Pluralization
- Interpolation
- Fallback languages
- Date/number formatting
4) Use proper translation keys
Prefer semantic keys:
{
"cart.itemsCount": "You have {{count}} items"
}
Avoid:
{
"msg_1042": "You have {{count}} items"
}
Semantic keys are easier for developers and translators to understand.
Rule of thumb
Keys should describe meaning, not appearance:
button.saveerror.networkprofile.header
5) Handle interpolation and plurals
Interpolation
t("cart.itemsCount", { count: 3 })
Pluralization
Use ICU/message-format support if possible:
{
"cart.itemsCount": "{count, plural, one {# item} other {# items}}"
}
This is important for non-English languages, where plural rules are more complex.
6) Decide how translators will work
Typical workflow:
Developer workflow
- Add/modify keys in source language files
- Run extraction or update scripts
- Commit changes
- Send files to translators or localization platform
- Merge translated files back
Translator workflow
- Translators work in a localization platform such as:
- Phrase
- Lokalise
- Crowdin
- Transifex
- Weblate
These tools help with:
- Translation memory
- Glossaries
- Review workflow
- Missing string detection
- Machine translation suggestions
7) Automate extraction and syncing
If your library supports extraction, use it.
Example flow
- Scan source code for
t("...") - Extract keys into a base locale file
- Compare with existing translations
- Mark missing keys
This prevents drift between code and translation files.
Helpful automation
- Pre-commit hook to validate keys
- CI check for missing translations
- Script to sort keys consistently
- Script to remove unused keys
8) Add fallbacks
Always define a fallback language, usually English.
If fr is missing a key, the app should:
- Try
fr - Fall back to
en - Optionally show a placeholder if missing entirely
This prevents broken UI in partially translated releases.
9) Format locale-sensitive data
Don’t manually format:
- Dates
- Times
- Numbers
- Currencies
- Percentages
Use locale-aware APIs:
new Intl.DateTimeFormat(locale).format(date)
new Intl.NumberFormat(locale, { style: "currency", currency: "EUR" }).format(1234.56)
This ensures correct formatting per region.
10) Support RTL languages early
If you may support languages like Arabic or Hebrew:
- Use CSS logical properties where possible
- Test layout flipping
- Ensure icons and spacing behave correctly
- Add
dir="rtl"handling
11) Create a release process
A practical release flow:
- Dev adds new strings
- Base locale is updated
- Translation files are sent to localization tool
- Translators complete work
- QA reviews UI in each locale
- Release translations with the app
- Monitor for missing keys or layout issues
Good idea
Translate in parallel with development, not at the end.
12) Add quality checks
Use CI to catch problems like:
- Missing keys
- Extra keys
- Empty translations
- Invalid placeholders
- Broken ICU syntax
Example checks:
- All locales have the same keys
- Placeholder names match across languages
- No untranslated strings in production
13) Test localization in the app
Test:
- Long translations
- Short translations
- Pseudo-localization
- Plurals
- RTL layouts
- Date/number formatting
- Font support for all target scripts
Pseudo-localization
This is very useful:
- Expands text length
- Reveals hardcoded strings
- Exposes layout overflow
- Catches encoding issues
Example pseudo-text:
[!!! Wëlcømë !!!]
14) Keep content and code separate
For maintainability:
- Let product/UX copy live in translation files
- Don’t duplicate strings across components
- Use shared reusable keys for common UI
- Avoid reusing a translation key for different meanings
15) A simple recommended workflow
If you want a straightforward setup:
- Use
enas source language - Store translations in JSON files
- Use
react-i18next/vue-i18n/ equivalent - Manage keys by feature
- Sync to a localization platform
- Add CI checks for missing keys
- Use
Intlfor dates/numbers/currency - Test with pseudo-localization and RTL
Example workflow in practice
1. Add text in code
t("checkout.payNow")
2. Add base translation
{
"checkout.payNow": "Pay now"
}
3. Extract/sync to localization tool
4. Translators fill:
{
"checkout.payNow": "Payer maintenant"
}
5. App loads based on user locale
setLocale("fr")
If you want, I can also give you:
- a React-specific localization setup
- a Next.js localization workflow
- or a step-by-step CI/CD pipeline for translations