Repository navigation
refactor(i18n): install use-intl and establish language registry and provider - #395
Merged
Merged
Conversation
…ider foundation - Install use-intl v4 in the frontend - Add centralized language registry (frontend/src/lib/i18n/languages.ts) with derived Language/Locale types and locale/direction/selectability metadata - Relocate translation JSON files to frontend/src/lib/i18n/messages/ - Add use-intl AppConfig module augmentation (messages.d.ts) - Add and mount I18nProvider in the root layout - Preserve legacy t()/useI18n() consumers via backward-compatible re-exports Refs #373
7 tasks
This was referenced Aug 19, 2026
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
Implement FloCafe issue #373, the first sub-issue of epic #372 (migrate the hand-rolled i18n system to use-intl v4). Install use-intl v4 in the frontend; create the centralized language registry (frontend/src/lib/i18n/languages.ts) with derived Language/Locale types plus per-language locale/direction/selectability metadata; relocate the four translation JSON files into frontend/src/lib/i18n/messages/; add the use-intl v4 AppConfig module augmentation (messages.d.ts) for compile-time message/locale typing; create and mount an I18nProvider in the root layout; and keep every existing t()/useI18n() consumer working through backward-compatible re-exports in frontend/src/lib/i18n.ts. Hard scope exclusions for this change: no async lazy loading (#375), no flat-to-nested key conversion (#374), no component migration to useTranslations (#376-380), no removal of the legacy t()/useI18n engine (#381), no translation copy/wording changes, and Persian stays selectable:false (user-facing enablement remains governed by #241). Also updated the two tests that read translation JSON paths (tests/translations.test.ts, tests/e2e-argentina-flow.test.ts) to the new messages/ directory.
What Changed
use-intland mounted a newI18nProviderin the frontend root layout to provide active locale and translation context.frontend/src/lib/i18n/languages.tsas a central registry for supported languages and metadata, addeduse-intltype declarations infrontend/src/lib/i18n/messages.d.ts, and preserved backward-compatible re-exports infrontend/src/lib/i18n.ts.frontend/src/lib/i18n/messages/and updated test references intests/translations.test.tsandtests/e2e-argentina-flow.test.ts.Risk Assessment
✅ Low: The changes cleanly introduce use-intl and the centralized language registry while maintaining full backward compatibility with existing i18n callers without regressions.
Testing
Executed targeted backend compilation, Next.js static build, i18n translation integrity tests, RTL regression suites, and Playwright end-to-end browser tests across auth, setup, POS, dashboard, orders, products, and settings screens in English, Spanish, Portuguese, and Persian, capturing 28 visual screenshots into the designated evidence directory; all checks and tests passed with 0 failures.
/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/auth-login-ltr-en.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/auth-login-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/auth-recover-ltr-en.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/auth-recover-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/pos-ltr-en.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/pos-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/dashboard-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/settings-store-ltr-en.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/settings-store-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/settings-account-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/settings-taxes-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/settings-health-check-dialog-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/setup-step1-ltr-en.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/setup-step1-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/setup-step1-fa-locale-fa-option.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/setup-step2-master-pin-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/setup-step3-owner-account-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/orders-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/products-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/addon-groups-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/customers-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/customer-display-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/tables-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/staff-modal-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/support-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/print-test-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/mobile-dashboard-appbar-rtl-fa.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9/mobile-sidebar-sheet-rtl-fa.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:translationsnpm run test:e2e-argentina-flownpm run test:rtl-foundationnpm run test:rtl-setup-auth-settingsnpm run test:rtl-dashboard-pos-commonnpm run test:rtl-kds-server-whatsappnpm run buildcd frontend && npx cross-env NEXT_BUILD_MODE=desktop npm run buildcd frontend && EVIDENCE_DIR=/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9 npx playwright test e2e/rtl-setup-auth-settings.spec.tscd frontend && EVIDENCE_DIR=/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0BMX544WJWEKZT88B3623A9 npx playwright test e2e/rtl-dashboard-pos-common.spec.tsTargeted runtime validation ofLANGUAGESregistry metadata, BCP-47 locales (en,es,pt-BR,fa-IR), text directions (ltr/rtl),selectable: falsefor Persian per #241, backward-compatible re-exports fromfrontend/src/lib/i18n.ts, andI18nProviderReact root rendering✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.