Architecture decisions
0003 — Internationalization
0003 — Internationalization
Status
Accepted.
Context
The product must support multiple languages. The repository also forbids hardcoded user-facing strings. A single mechanism should satisfy both.
Decision
- Use
react-i18nextinapps/web, configured inshared/i18nand provided at theapplayer. - Centralize all copy in locale resources under
shared/i18n/locales/<lang>/<namespace>.json. Components reference keys only. - Ship English (default/fallback) and Chinese. Language is detected from localStorage + browser and persisted; a language switch lives in the app shell.
- Namespaces mirror surfaces:
common,trips,planner,auth. - Numbers/currency go through shared
Intl-based formatters; the trip currency (JPY) is data-driven, independent of UI language.
Consequences
- Adding a language is additive: drop in a locale folder, register it, add a switch label.
- The "no hardcoded strings" rule is satisfied by construction.
- Slightly more indirection when writing components (keys instead of literals), accepted for translation coverage and consistency. See ../frontend/i18n.md.