Repository navigation
Description
Refs: #372
Depends on: #375
Can parallel with: #376, #377, #378, #379
Context
Migrate settings management, administrative dialogs, catalog management (products, categories, addon groups), staff management, support, WhatsApp integration, and print-test pages from legacy useI18n() to useTranslations() from use-intl.
Global Component Migration Rules
- Use
const t = useTranslations('namespace')fromuse-intl. - Access keys via namespaced identifiers (e.g.
useTranslations('settings'),useTranslations('products'),useTranslations('whatsapp')). - Use compile-time type-safe keys verified against
AppConfig. - Eliminate template-literal dynamic key construction; use exhaustively typed lookup mappings.
- Regional formatting guardrail: This issue changes translation access only. Do not replace FloCafe's tenant-aware money, number, date, or time formatting helpers with
IntlProvider's default UI-locale formatting. Business values remain governed by tenant country, currency, timezone, calendar, digit, and display preferences.useFormatter()may only be used where formatting intentionally follows UI language and no tenant-regional business semantics apply. - Do NOT remove the compatibility adapter or legacy hook in this PR. Issue refactor(i18n): remove legacy custom i18n implementation #381 owns final removal once all batches are complete.
- Do NOT alter translation wording or settings storage contracts.
Files to Migrate (15 files)
Settings & Administrative Dialogs (8 files)
frontend/src/app/(dashboard)/settings/page.tsxfrontend/src/components/settings/HealthCheckDialog.tsxfrontend/src/components/settings/InitializeDatabaseDialog.tsxfrontend/src/components/settings/LocalePreferencesPanel.tsxfrontend/src/components/settings/MasterPinPrompt.tsxfrontend/src/components/settings/PaymentMethodsSettings.tsxfrontend/src/components/settings/TaxConfigurationPanel.tsxfrontend/src/components/settings/WhatsAppEnableCard.tsx
Catalog, Staff, Support & Admin Pages (7 files)
frontend/src/app/(dashboard)/products/page.tsxfrontend/src/app/(dashboard)/addon-groups/page.tsxfrontend/src/app/(dashboard)/staff/page.tsxfrontend/src/app/(dashboard)/support/page.tsxfrontend/src/app/(dashboard)/whatsapp/page.tsxfrontend/src/app/(dashboard)/print-test/page.tsxfrontend/src/components/products/ImageUploader.tsx
Dynamic Key Handling
whatsapp/page.tsx
Currently uses template literals for message statuses and message kinds:
t(`whatsapp.status.${status}`)
t(`whatsapp.kind.${m.kind}`)Replace with exhaustively typed mapping objects:
type WhatsAppStatus = 'queued' | 'typing' | 'sent' | 'delivered' | 'read' | 'failed';
const WHATSAPP_STATUS_KEYS = {
queued: 'status.queued',
typing: 'status.typing',
sent: 'status.sent',
delivered: 'status.delivered',
read: 'status.read',
failed: 'status.failed',
} as const satisfies Record<WhatsAppStatus, string>;
type WhatsAppMessageKind = 'text' | 'image' | 'document' | 'template';
const WHATSAPP_KIND_KEYS = {
text: 'kind.text',
image: 'kind.image',
document: 'kind.document',
template: 'kind.template',
} as const satisfies Record<WhatsAppMessageKind, string>;Settings Language Selector
Update the UI language selector in settings/page.tsx to derive options from LANGUAGES in frontend/src/lib/i18n/languages.ts (filtering for selectable: true) instead of maintaining hardcoded arrays.
Note: LocalePreferencesPanel.tsx manages regional country profiles and tax formatting preferences; keep UI translation language and country locale preferences as distinct, clean concerns.
What NOT to do
- Do NOT remove
frontend/src/hooks/useI18n.tsor the compatibility bridge infrontend/src/lib/i18n.ts(reserved for refactor(i18n): remove legacy custom i18n implementation #381). - Do NOT change any translation content or wording.
- Do NOT merge UI language support with country/tax pack configurations.
- Do NOT replace FloCafe's tenant-aware money, number, date, or time formatting helpers with
IntlProviderdefault formatting for business data.
Acceptance Criteria
- All 15 settings, admin, catalog, and WhatsApp files migrated to
useTranslations(). - No unchecked template-literal translation calls remain.
- Settings language selector dynamically renders options from the central registry.
- Compatibility bridge remains operational for unmigrated batches.
- Regional formatting guardrail observed: tenant-aware formatting helpers preserved for business values.
Verification
npm run lint
npm run build:frontend
npm test
npm run test:rtl-setup-auth-settings
Activity
refactor(i18n): migrate settings, admin, catalog, and WhatsApp to use…
khaira777 commentedon Aug 19, 2026
Migrated and merged via #404.
What changed
useI18n()/t()touseTranslations():settings,products,addon-groups,staff,support,whatsapp,print-testpages; settings components (HealthCheckDialog,InitializeDatabaseDialog,LocalePreferencesPanel,MasterPinPrompt,PaymentMethodsSettings,TaxConfigurationPanel,WhatsAppEnableCard); andproducts/ImageUploader.i18n-enums.tsremaining maps (ROLE_LABEL_KEYS,TENANT_STATUS_LABEL_KEYS,BUSINESS_TYPE_LABEL_KEYS,PAYMENT_STATUS_LABEL_KEYS) are now exhaustively typed against use-intl leaf keys.WHATSAPP_STATUS_KEYS/WHATSAPP_KIND_KEYS;whatsapp.apiError.*resolved via a typed namespace guard.LANGUAGESregistry (selectable: true) instead of hardcoded arrays.useFormatter()); legacy bridge left in place for refactor(i18n): remove legacy custom i18n implementation #381.Verification
npm run lint0 errors;tsc --noEmitclean;npm run build:frontendstatic export passed.npm run test:translations,npm run test:locale-chunks,npm run test:rtl-setup-auth-settings,npm run test:rtl-kds-server-whatsapp, and the 5E e2e specs — green.Acceptance criteria — all met. Epic #372 updated (5E checked).
khaira777 commentedon Aug 19, 2026
Closed — acceptance criteria met and merged in #404. Epic #372 updated.