Repository navigation
Closed
Labels
Description
Refs: #388
Depends on: #373 (merged)
Context
FloCafe supports multi-language UI localization across English (en), Spanish (es), Portuguese (pt), and Persian (fa). However, country selectors in Setup and Settings currently display hardcoded English country names regardless of the active UI language.
Verified Current Behavior
- Static Country Names (
main/countries.tslines 38, 103, 339):Country names inconst dn = new Intl.DisplayNames(['en'], { type: 'region' });
COUNTRIESare generated statically with English region names (dn.of(code)). - Frontend Export (
frontend/src/lib/countries.ts): Re-exportscountryName(code)from backendcountries.ts, which unconditionally returns English strings. - Consumer Interfaces (
frontend/src/app/setup/page.tsxandfrontend/src/app/(dashboard)/settings/page.tsx): RendercountryName(c.code), always presenting English text to Spanish, Portuguese, or Persian users.
Problem
When the user selects Spanish, Portuguese, or Persian as their interface language, country names in Setup and Settings (e.g. "Germany", "United States", "Spain", "Brazil") remain in English instead of "Alemania", "Estados Unidos", "España", "Brasil", or Persian equivalents.
Architectural Decision
- Persisted Country Identity: Remains strictly the ISO 3166-1 alpha-2 code (
CA,BR,DE,IR,US, etc.). Never store translated country names in the database, settings, or API contracts. - Presentation-Only Localization: Derive localized display names using native runtime
Intl.DisplayNames([activeUiLocale], { type: 'region' })with a fallback to the static English name or ISO code. - No JSON Translation Bloat: Do NOT copy hundreds of country names into message catalog files (
en.json,es.json,pt.json,fa.json). NativeIntl.DisplayNamesprovides standards-compliant, localized region names offline. - List Sorting: Sort displayed country lists based on the derived localized name in the active locale (while retaining pinned top items like
INandAR), not the English names. - Search Matching: Ensure country query filtering matches localized display names, English names, ISO codes, and currencies.
Exact Implementation Scope
- Frontend Localization Helper (
frontend/src/lib/countries.ts/ hook or utility):- Provide a helper (e.g.
getLocalizedCountryName(code: string, locale: string): string) that creates/caches anIntl.DisplayNames([locale], { type: 'region' })instance and resolves the localized name for a given ISO code.
- Provide a helper (e.g.
- Setup Country Selector (
frontend/src/app/setup/page.tsx):- Render localized country names based on the active wizard language.
- Re-sort filtered country options by their localized names when the active language changes.
- Support searching by localized country names.
- Settings Country Selector (
frontend/src/app/(dashboard)/settings/page.tsx):- Render localized country names based on current UI language.
- Sort options using localized names.
Required Behavior
- For UI language
es:DEdisplays as "Alemania",USas "Estados Unidos",JPas "Japón". - For UI language
pt:DEdisplays as "Alemanha",USas "Estados Unidos",JPas "Japão". - For UI language
fa:DEdisplays as "آلمان",USas "ایالات متحده". - For UI language
en: Displays in English. - Changing UI language immediately re-renders all country display names in the active language without page reload.
- Persisted tenant country setting remains the ISO alpha-2 code.
Backward Compatibility / Upgrade Behavior
- Completely non-breaking. Canonical data models and backend APIs continue to receive and store ISO codes.
Offline-First Requirements
- 100% offline.
Intl.DisplayNamesis built into modern JavaScript runtimes (V8/Node/Electron/browsers). Zero network requests.
Non-Goals / What NOT to Do
- Do NOT populate message JSON files with manual country translations.
- Do NOT sort using English strings while rendering localized labels.
- Do NOT modify backend ISO code storage or tax pack country matching.
- Do NOT add third-party country localization libraries.
Acceptance Criteria
- Country selectors in Setup and Settings dynamically render country names in the active UI locale.
- Country list sorting respects localized alphabetical order.
- Country search matches localized names, ISO codes, and currencies.
- Changing UI language updates country names dynamically.
- ISO alpha-2 codes remain the persisted tenant country value.
- Completely functional offline with zero network calls.
Verification
npm run lint
npm run build:frontend
npm run test:rtl-setup-auth-settings
npm testDependencies
- Depends on refactor(i18n): install use-intl and establish language registry/provider foundation #373 (Language registry and active locale provider foundation from refactor(i18n): migrate to scalable use-intl architecture #372).
Relationship to Epic
- Part of Phase 3 — Presentation Integration in Epic refactor(regionalization): harden country, regional formatting, and international data boundaries #388.
Activity
khaira777 commentedon Aug 20, 2026
Status update — 2026-08-20
⏳ Ready to start; not started. Dependency #373 is merged. There is currently no implementation branch, PR, or no-mistakes pipeline run for this issue.
khaira777 commentedon Aug 20, 2026
Status update — 2026-08-20
🔄 Implementation complete; validation in progress. Commit
e624e729remains intact. The no-mistakes run01M0GQR716R7VQGW1S7E2MESWMhas completed rebase, review, and tests; documentation is currently running on pipeline headb4981eb1.No PR has been opened yet. Next stages are lint, push, PR creation, and CI.
khaira777 commentedon Aug 21, 2026
Completed — PR #435 merged
Issue #392 is complete. PR #435 merged into
mainatedb980ad.