Skip to content

Phase B: i18n / RTL / responsive sweep #7

@abdout

Description

@abdout

Goal

Make every visible string come from the dictionary, every layout RTL-clean, every responsive breakpoint verified, and flip the default locale to Arabic per the global rule.

Scope

B.1 Dictionary infra

  • Lenient useDictionary() (clone hogwarts pattern — current version throws when no provider mounted, blocking client components in dictionary-less subtrees)
  • Consolidate locale logic: delete src/components/internationalization/middleware.ts, keep only src/proxy.ts
  • Default locale enar in src/components/internationalization/config.ts
  • <link rel="alternate" hreflang="..." /> in [lang]/layout.tsx head

B.2 Translation coverage

  • Kill the 103 inline lang === 'ar' ? ... : ... ternaries
  • Wire the 51 pages that don't currently use useDictionary() / getDictionary()
  • Priority order: transport/page.tsx, home-content.tsx, host/page.tsx, all transport-host/[id]/* editors, (nondashboard)/searching/[id]/new-page.tsx, transport/booking/checkout/content.tsx

B.3 Locale-aware formatting

  • Replace 20+ raw toLocaleDateString() / toLocaleString() with formatDate(date, lang) etc. from src/lib/i18n/formatters.ts

B.4 RTL polish

  • Wrap 14 directional icons (ChevronLeft/ChevronRight/ArrowLeft/ArrowRight) — DirectionAwareIcon helper that flips via rtl:rotate-180

B.5 Responsiveness + touch targets

  • Wrap HeartButton and the report-issue trigger in 44×44 hit areas
  • Sample 5 main routes at 320 / 768 / 1024 — fix any clipped CTAs

Verification

  • scripts/i18n-anti-pattern-check.sh greps for inline ternaries / hardcoded JSX / raw toLocaleDateString(); exits non-zero if any found
  • pnpm i18n:check script wires it up
  • Lefthook pre-commit runs pnpm i18n:check
  • Playwright tests/e2e/seo.spec.ts extended to assert <html lang="ar" dir="rtl"> on /ar/* and <html lang="en" dir="ltr"> on /en/*

Out of scope

  • Modular dictionary split (defer; current monolithic dict is tractable)
  • Full WCAG audit (Phase D)

Refs #5

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions