Skip to content

feat(i18n): drive region locale preferences from country profile - #352

Merged
khaira777 merged 1 commit into
mainfrom
feat/241-iran-locale-profile
Aug 17, 2026
Merged

khaira777 merged 1 commit into
mainfrom
feat/241-iran-locale-profile

Conversation

@khaira777

Copy link
Copy Markdown
Contributor

Intent

Make Iran-specific locale display settings (currency display unit Rial/Toman/Toman-shorthand, digit style Persian/Latin, calendar Shamsi/Gregorian) data-driven so they appear only when the IR country is selected and never clutter other regions' UI. The user approved the 'data-driven country profile' approach: declare a localeOptions field on the IR country profile, render controls through a generic LocalePreferencesPanel that only shows when a profile declares options, with no hard-coded country conditionals in the Settings JSX and no behavior change for EN/ES/PT or any non-Iran tenant. Storage stays raw IRR (never converted); these are display-only preferences. Keep the country-based visibility trigger (currency is read-only derived from country) while formatters already key off currency === IRR. No DB migration, no new backend route. Add regression tests that IR exposes localeOptions and non-IR profiles expose none.

What Changed

  • Added CountryLocaleOptions to country types and declared localeOptions on the Iran (IR) country profile for currency display, digit mode, and calendar options.
  • Replaced hard-coded Iran conditional markup in SettingsPage with a dynamic LocalePreferencesPanel that only renders when a country profile defines locale options.
  • Added tests verifying that the IR profile exposes locale display options and non-IR country profiles define none.

Risk Assessment

✅ Low: The change is a clean, well-bounded refactor that drives Iran locale display preferences through country profile data and a generic panel with no hard-coded country conditionals and full test coverage.

Testing

Executed targeted automated test suites for currency and locale formatting, verified successful TypeScript compilation and Next.js static export build, and performed end-to-end browser validation capturing full visual evidence of dynamic Iran locale display preferences in both editable admin, read-only non-admin, and RTL modes.

  • Evidence: Settings UI with US selected (no Iran locale panel rendered) (local file: /var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M08HBND6XXQKN9ZGSF5F14FV/01-settings-non-iran-us.png)
  • Evidence: Settings UI with Iran selected in Admin mode (Locale Preferences Panel rendered with dropdowns) (local file: /var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M08HBND6XXQKN9ZGSF5F14FV/02-settings-iran-admin.png)
  • Evidence: Settings UI with configured Iran preferences (Toman, Latin digits, Gregorian calendar) (local file: /var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M08HBND6XXQKN9ZGSF5F14FV/03-settings-iran-admin-selected-options.png)
  • Evidence: Settings UI switched to India (Iran locale preferences panel cleanly unmounted) (local file: /var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M08HBND6XXQKN9ZGSF5F14FV/04-settings-switched-back-to-india.png)
  • Evidence: Settings UI in Persian (fa) RTL language with Iran display preferences (local file: /var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M08HBND6XXQKN9ZGSF5F14FV/05-settings-iran-persian-rtl.png)
  • Evidence: Settings UI with Iran preferences in Non-Admin read-only mode (local file: /var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M08HBND6XXQKN9ZGSF5F14FV/06-settings-iran-readonly.png)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • npm run test:currency (tests/currency.test.ts, tests/country-profile.test.ts, tests/locale-iran.test.ts)
  • npx ts-node --transpile-only -P tests/tsconfig.json tests/rtl-setup-auth-settings.test.ts
  • npx ts-node --transpile-only -P tests/tsconfig.json tests/translations.test.ts
  • npm run build
  • npm run build:frontend
  • Playwright E2E UI verification: dynamic visibility of LocalePreferencesPanel when switching between non-IR (US/IN) and IR, admin option modifications, non-admin read-only presentation, and Persian (fa) RTL layout
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Move Iran locale display options out of hard-coded Settings JSX into
the IR country profile and render them through a generic
LocalePreferencesPanel that only appears when a profile declares
localeOptions. Non-Iran tenants see no extra UI and EN/ES/PT behavior is
unchanged.

Refs #241
@khaira777
khaira777 requested a review from itsbkm as a code owner August 17, 2026 19:05
@khaira777
khaira777 merged commit 4bd9840 into main Aug 17, 2026
12 checks passed
@khaira777
khaira777 deleted the feat/241-iran-locale-profile branch August 17, 2026 19:10
@khaira777 khaira777 self-assigned this Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant