Skip to content

refactor(i18n): migrate KDS and Server App components to use-intl - #402

Merged
khaira777 merged 4 commits into
mainfrom
chore/379-i18n-migration-5d
Aug 19, 2026
Merged

khaira777 merged 4 commits into
mainfrom
chore/379-i18n-migration-5d

Conversation

@khaira777

Copy link
Copy Markdown
Contributor

Intent

Migrate the Kitchen Display System (dashboard-embedded /kds and standalone /kds-standalone pages), the Server App standalone page, and the associated KDS components and connection hook from the legacy useI18n()/t() flat-key API to use-intl useTranslations(), completing Phase 3 batch 5D (issue #379) of the i18n migration epic (#372).

Scope is the KDS/Server App surface: the 3 pages (kds/page.tsx, kds-standalone/page.tsx, server-standalone/page.tsx), the 7 KDS components (KdsColumn, KdsHeader, KdsItemModal, KdsKanbanBoard, KdsLoginForm, KdsTabsView, KdsHtmlLang), the useKdsConnection hook, and the shared order-types map. KdsHtmlLang and useServerKdsInfo already use registry helpers / server-sync and required no functional change.

Key decisions:

  • Each component uses useTranslations(namespace) with typed leaf keys; multi-namespace files split into per-namespace translators (tKds/tAuth/tNav/tCommon/tOrders/tTables/tServerApp).
  • useKdsConnection.ts: STATUS_CONFIG.labelKey converted from dotted 'kds.statusX' to exhaustively typed leaf keys (satisfies Record<KitchenStatus, {labelKey: KdsKey, ...}>); the hook now uses useTranslations('kds') + useTranslations('nav') (the nav.confirmLogout defaultValue dropped since the key exists).
  • order-types.ts: ORDER_TYPE_LABEL_KEYS converted from Record<string,string> dotted keys to exhaustively typed orders leaf keys (satisfies Record<Order['type'], OrdersKey>); KDS badge renderers look up the leaf key and fall back to the raw order.type string for unknown types.
  • server-standalone/page.tsx: itemStatusIcon takes a typed serverApp translator; toastApiError (shared legacy dotted-key helper) bridged with a no-op apiError adapter since there are no top-level apiError.* message keys, preserving the existing fallback behavior.
  • KdsHtmlLang and useServerKdsInfo are left untouched: they already use registry direction helpers and fetchServerInfo respectively and contain no legacy t()/useI18n calls.

Constraints: no wording, logic, WebSocket lifecycle, reconnection timing, server language inheritance, or RTL behavior changes; no new dependencies or migrations; the legacy useI18n bridge stays for the remaining batch 5E (#380) and is removed by #381; the two e2e assertions pinning setup/fa behavior must not be altered.

What Changed

  • Migrated KDS dashboard and standalone pages (/kds, /kds-standalone), Server App (/server-standalone), and related KDS components (KdsColumn, KdsHeader, KdsItemModal, KdsKanbanBoard, KdsLoginForm, KdsTabsView) from legacy useI18n() flat keys to useTranslations() from use-intl.
  • Converted ORDER_TYPE_LABEL_KEYS and useKdsConnection STATUS_CONFIG mappings to exhaustively typed orders and kds namespace leaf keys.
  • Added E2E tests in frontend/e2e/i18n-batch-5d.spec.ts verifying localized rendering and layout across KDS and Server App views in English, Spanish, and Persian (RTL).

Risk Assessment

✅ Low: The migration from legacy flat-key useI18n to typed use-intl useTranslations across KDS and Server App surfaces is cleanly implemented with exhaustively typed leaf keys and no behavioral regressions.

Testing

Executed comprehensive targeted validation covering translation schema parity, leaf key safety, RTL/LTR layout invariants, KDS contract tests, and Playwright end-to-end flows. Captured visual screenshots across all migrated surfaces (KDS Login, Tabs View, Item Modal, Kanban Board, Server App Login, and Server App Tableside Ordering) in both English and Persian (RTL) with all checks passing.

  • Evidence: KDS Login Form (English) (local file: /var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0D9465DMYWJPCZS0XR240HB/kds-login-en.png)
  • Evidence: KDS Login Form (Persian RTL) (local file: /var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0D9465DMYWJPCZS0XR240HB/kds-login-fa.png)
  • Evidence: KDS Tabs View (English) (local file: /var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0D9465DMYWJPCZS0XR240HB/kds-tabs-en.png)
  • Evidence: KDS Tabs View (Persian RTL) (local file: /var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0D9465DMYWJPCZS0XR240HB/kds-tabs-fa.png)
  • Evidence: KDS Item Modal (English) (local file: /var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0D9465DMYWJPCZS0XR240HB/kds-item-modal-en.png)
  • Evidence: KDS Item Modal (Persian RTL) (local file: /var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0D9465DMYWJPCZS0XR240HB/kds-item-modal-fa.png)
  • Evidence: KDS Kanban Board (English) (local file: /var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0D9465DMYWJPCZS0XR240HB/kds-kanban-en.png)
  • Evidence: KDS Kanban Board (Persian RTL) (local file: /var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0D9465DMYWJPCZS0XR240HB/kds-kanban-fa.png)
  • Evidence: Server App Login Form (English) (local file: /var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0D9465DMYWJPCZS0XR240HB/server-login-en.png)
  • Evidence: Server App Login Form (Persian RTL) (local file: /var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0D9465DMYWJPCZS0XR240HB/server-login-fa.png)
  • Evidence: Server App Tableside Ordering (English) (local file: /var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0D9465DMYWJPCZS0XR240HB/server-standalone-en.png)
  • Evidence: Server App Tableside Ordering (Persian RTL) (local file: /var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M0D9465DMYWJPCZS0XR240HB/server-standalone-fa.png)
  • Outcome: ⚠️ 1 info across 1 run (7m8s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 1 info
  • ℹ️ frontend/e2e/i18n-batch-5d.spec.ts - new test file written by agent: frontend/e2e/i18n-batch-5d.spec.ts
  • npm run test:translations
  • npm run test:rtl-kds-server-whatsapp
  • npm run test:kds-integration
  • npm run test:kds-contract
  • npm run test:kds-frontend-conflict
  • npm run test:kds-window-hardening
  • npx playwright test e2e/kds-login.spec.ts
  • npx playwright test e2e/kds-kanban-skip-confirm.spec.ts
  • npx playwright test e2e/i18n-batch-5d.spec.ts
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Phase 3 batch 5D (issue #379). Replace useI18n()/t() with useTranslations() across the dashboard and standalone KDS pages, the Server App page, seven KDS components, and the useKdsConnection hook. STATUS_CONFIG.labelKey and ORDER_TYPE_LABEL_KEYS are now exhaustively typed leaf-key maps; the order-type badge renderers and the server-app toastApiError bridge handle the dynamic dotted-key cases. KdsHtmlLang and useServerKdsInfo already used registry helpers/server-sync and needed no change. No wording or logic changes; the legacy bridge remains for batch 5E.
@khaira777
khaira777 merged commit a804a5e into main Aug 19, 2026
12 checks passed
@khaira777
khaira777 deleted the chore/379-i18n-migration-5d branch August 19, 2026 18:12
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