Repository navigation
feat(i18n): drive region locale preferences from country profile - #352
Merged
Merged
Conversation
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
18 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
CountryLocaleOptionsto country types and declaredlocaleOptionson the Iran (IR) country profile for currency display, digit mode, and calendar options.SettingsPagewith a dynamicLocalePreferencesPanelthat only renders when a country profile defines locale options.IRprofile 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.
/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M08HBND6XXQKN9ZGSF5F14FV/01-settings-non-iran-us.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M08HBND6XXQKN9ZGSF5F14FV/02-settings-iran-admin.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M08HBND6XXQKN9ZGSF5F14FV/03-settings-iran-admin-selected-options.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M08HBND6XXQKN9ZGSF5F14FV/04-settings-switched-back-to-india.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M08HBND6XXQKN9ZGSF5F14FV/05-settings-iran-persian-rtl.png)/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.tsnpx ts-node --transpile-only -P tests/tsconfig.json tests/translations.test.tsnpm run buildnpm run build:frontendPlaywright E2E UI verification: dynamic visibility ofLocalePreferencesPanelwhen 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.