Prompt
need to centralize strings across web, app, and email
Latest observation
To centralize strings across web, app, and email, the cleanest approach is to create a single source of truth for all user-facing text and have each channel consume it in a format it can use.
Recommended approach
1) Create a shared localization source
Use one centralized content store for:
- UI labels
- Button text
- Validation messages
- Email subjects and bodies
- Error messages
- CTA copy
Common options:
- JSON/YAML files in a shared repo/package
- Translation management system like Lokalise, Phrase, Crowdin, Transifex
- CMS/content service if marketing/content teams need to edit copy
2) Structure strings by keys, not hardcoded text
Example:
{
"auth": {
"login_title": "Sign in",
"login_button": "Continue",
"forgot_password": "Forgot password?"
},
"email": {
"reset_subject": "Reset your password",
"reset_body": "Click the link below to reset your password."
}
}
Then each platform references keys like:
auth.login_titleemail.reset_subject
3) Share the same translation keys across platforms
Use the same key names for web, mobile, and email when the meaning is the same.
This makes updates consistent and easier to maintain.
4) Build platform-specific rendering layers
Each channel should have its own adapter:
- Web: i18n library like
i18next,react-intl,next-intl - App:
react-native-localize,i18next,formatjs,flutter intl - Email: template engine like
MJML,Handlebars,Liquid, orReact Email
The shared source provides content; each layer handles formatting and layout.
5) Support variables and formatting
Strings often need dynamic values:
{
"account": {
"welcome": "Welcome, {{name}}",
"trial_ends": "Your trial ends in {{days}} days"
}
}
Each platform can substitute values safely.
6) Add locale and fallback handling
Recommended pattern:
enen-GBesfr
Fallback order:
- exact locale
- base language
- default locale
7) Keep email copy in the same system
Emails often get separated, but they benefit most from centralization:
- subject lines
- preview text
- body copy
- legal/footer text
- unsubscribe text
If email templates are HTML-based, keep the copy centralized even if the layout is separate.
Best implementation patterns
Option A: Shared package in a monorepo
Best if web/app/email are in the same org and deploy together.
Example:
packages/contentpackages/webpackages/mobilepackages/email
Pros:
- simple sync
- type-safe keys possible
- easy versioning
Option B: Translation service + sync pipeline
Best if multiple teams or frequent copy changes.
Flow:
- source of truth in translation tool
- export to JSON for web/app
- export to templates/data for email
Pros:
- non-dev edits
- collaboration workflow
- approval process
Option C: API-driven content service
Best if copy changes often and needs runtime updates.
Pros:
- dynamic
- one backend source
- can localize centrally
Cons:
- more complexity
- offline/email rendering can be harder
Practical recommendation
If you want the most maintainable setup:
- Use a translation management platform as the source of truth
- Export to versioned JSON in a shared package
- Consume it via:
- web i18n library
- app i18n library
- email template renderer
Things to watch out for
- Don’t reuse text keys for meaningfully different copy
- Avoid hardcoding strings in components
- Handle pluralization and gender correctly
- Keep email formatting separate from text content
- Add linting/tests to detect missing translations
If you want, I can also give you:
- a folder structure for web/app/email shared strings,
- a sample JSON schema, or
- a monorepo implementation example.