Skip to content

refactor(i18n): component migration 5D — KDS, Server App #379

Closed

Description

@khaira777

Refs: #372
Depends on: #375
Can parallel with: #376, #377, #378, #380

Context

Migrate the Kitchen Display System (embedded dashboard KDS, standalone KDS device view), Server App standalone view, and associated KDS connection hooks from useI18n() to useTranslations() from use-intl.

Global Component Migration Rules

  • Use const t = useTranslations('kds') (or relevant namespace) from use-intl.
  • Access keys via namespaced identifiers.
  • Use compile-time type-safe keys verified against AppConfig.
  • Do NOT remove the compatibility adapter or legacy hook in this PR. Issue refactor(i18n): remove legacy custom i18n implementation #381 owns final removal.
  • Do NOT alter KDS WebSocket lifecycle, status transitions, or server synchronization logic.

Files to Migrate (12 files)

KDS Pages & Views (3 files)

  • frontend/src/app/(dashboard)/kds/page.tsx
  • frontend/src/app/kds-standalone/page.tsx
  • frontend/src/app/server-standalone/page.tsx

KDS Components (7 files)

  • frontend/src/components/kds/KdsColumn.tsx
  • frontend/src/components/kds/KdsHeader.tsx
  • frontend/src/components/kds/KdsItemModal.tsx
  • frontend/src/components/kds/KdsKanbanBoard.tsx
  • frontend/src/components/kds/KdsLoginForm.tsx
  • frontend/src/components/kds/KdsTabsView.tsx
  • frontend/src/components/kds/KdsHtmlLang.tsx (uses registry direction helper)

Hooks (2 files)

  • frontend/src/hooks/useKdsConnection.ts
  • frontend/src/hooks/useServerKdsInfo.ts

Hook Migration Guidance

useKdsConnection.ts is a React hook executed within the React component tree beneath I18nProvider. Migrate it to use useTranslations('kds') directly for its user-facing status toasts and error messages (t('statusWaiting'), t('authFailed'), t('itemMarked', { status })), ensuring stable callback references.

Ensure status label mappings in STATUS_CONFIG use typed translation keys rather than unchecked strings.

Preserve:

  • Standalone KDS language inheritance via server synchronization.
  • Server App language inheritance.
  • Offline and local LAN resilience (zero external network dependencies).
  • RTL layout mirroring for kitchen views.

What NOT to do

  • Do NOT remove frontend/src/hooks/useI18n.ts or the compatibility bridge in frontend/src/lib/i18n.ts.
  • Do NOT change any translation content or wording.
  • Do NOT alter WebSocket reconnection timing or REST fallback logic.

Acceptance Criteria

  • All 12 KDS and Server App files migrated to useTranslations() / registry helpers.
  • useKdsConnection.ts properly translates status transitions and error states.
  • Standalone KDS and Server App pages inherit tenant language correctly.
  • RTL rendering verified on KDS and Server App views.
  • Compatibility bridge remains operational for unmigrated batches.

Verification

npm run lint
npm run build:frontend
npm test
npm run test:rtl-kds-server-whatsapp
npm run test:kds-contract
npm run test:kds-integration

Activity

  1. added
    enhancement
    area:frontend
    on Aug 17, 2026
  2. self-assigned this
    on Aug 19, 2026
  3. khaira777 commented on Aug 19, 2026

    @khaira777
    ContributorAuthor

    Migrated and merged via #402.

    What changed

    • KDS/Server App migrated from legacy useI18n()/t() to useTranslations(): (dashboard)/kds, kds-standalone, server-standalone (+ its layout), and the KDS components KdsColumn, KdsHeader, KdsItemModal, KdsKanbanBoard, KdsLoginForm, KdsTabsView. KdsHtmlLang and useServerKdsInfo already used the registry direction/language helpers and needed no change.
    • ORDER_TYPE_LABEL_KEYS (order-types.ts) and STATUS_CONFIG.labelKey (useKdsConnection.ts) are now exhaustively typed against use-intl leaf keys instead of unchecked dotted strings.
    • Standalone KDS and Server App language inheritance and RTL mirroring preserved. The legacy compatibility bridge remains in place for the final cleanup batch.

    Verification

    • npm run lint 0 errors; tsc --noEmit clean; npm run build:frontend (25/25 routes).
    • npm run test:rtl-kds-server-whatsapp, npm run test:translations, npm run test:locale-chunks, and the KDS backend suites — green.
    • CI green on merge; a 5D evidence e2e spec was added and a KDS drag-race was made deterministic.

    Acceptance criteria — all met. Epic #372 updated (5D checked).

  4. khaira777 commented on Aug 19, 2026

    @khaira777
    ContributorAuthor

    Closed — acceptance criteria met and merged in #402. Epic #372 updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:frontendenhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions