feat(web): add i18n for all website locales (en, pt, es, ja, zh-CN, fr, de) #2

Merged
ellamizuki merged 2 commits from feat/i18n-en-pt into main 2026-09-08 23:18:55 +00:00
ellamizuki commented 2026-09-08 22:57:09 +00:00 (Migrated from github.com)

Summary

Adds internationalization to the public site covering every locale supported by the website: English, Portuguese, Spanish, Japanese, Simplified Chinese, French, and German.

  • URL structure: English at the root, other locales under their prefix (/pt/, /es/, /ja/, /zh-CN/, /fr/, /de/) — website convention; existing URLs unchanged, no redirects
  • Locale prefix rules mirror the website: as-needed style (default locale unprefixed) and canonical zh-CN casing, matched case-insensitively (/zh-cn/ resolves to /zh-CN/)
  • New src/i18n/ module: typed dictionaries (en source of truth, all locales key-complete), {placeholder} formatting, idempotent locale path builder (/zh-CN never doubles), client locale detection via <html lang>, and Intl locale tags for date/number formatting
  • All static pages (home, host, 404) exist in all 7 languages with hreflang alternates for every locale plus x-default, and correct lang attributes
  • All React components (overview, host telemetry, chart) accept a locale prop and render every label, state, legend, axis caption, tooltip, host-card link, and timestamp from the dictionary
  • Worker routing: /<locale>/hosts/<id> serves the matching locale host shell, localized soft-404 for prefixed unknown paths (status kept at 200 with localized content), host-id validation unchanged
  • Dates, times, and chart labels format via Intl with per-locale tags (pt-BR, ja-JP, zh-CN, es-ES, fr-FR, de-DE, en-US)

Validation

  • pnpm lint && pnpm typecheck && pnpm test && pnpm build green (25 tests, 21 pages built)
  • New tests: locale registry mirroring the website config, dictionary key parity and translation checks for all locales, path idempotency incl. zh-CN casing, worker locale routing and host-page detection
  • Local worker run verified: /, /pt/, /es/, /ja/, /zh-CN/, /fr/, /de/, /<locale>/hosts/<id> all 200 with correct lang, titles, labels, and links; /<locale>/<unknown> → localized 404; root / 404 behavior unchanged
  • Browser-checked hydration in ja and zh-CN (chart labels, legend, metrics, host-card links carry the locale prefix); English regression-checked
  • Mobile 375px: no horizontal overflow in either checked locale
## Summary Adds internationalization to the public site covering every locale supported by the website: English, Portuguese, Spanish, Japanese, Simplified Chinese, French, and German. - URL structure: English at the root, other locales under their prefix (`/pt/`, `/es/`, `/ja/`, `/zh-CN/`, `/fr/`, `/de/`) — website convention; existing URLs unchanged, no redirects - Locale prefix rules mirror the website: `as-needed` style (default locale unprefixed) and canonical `zh-CN` casing, matched case-insensitively (`/zh-cn/` resolves to `/zh-CN/`) - New `src/i18n/` module: typed dictionaries (en source of truth, all locales key-complete), `{placeholder}` formatting, idempotent locale path builder (`/zh-CN` never doubles), client locale detection via `<html lang>`, and Intl locale tags for date/number formatting - All static pages (home, host, 404) exist in all 7 languages with `hreflang` alternates for every locale plus `x-default`, and correct `lang` attributes - All React components (overview, host telemetry, chart) accept a `locale` prop and render every label, state, legend, axis caption, tooltip, host-card link, and timestamp from the dictionary - Worker routing: `/<locale>/hosts/<id>` serves the matching locale host shell, localized soft-404 for prefixed unknown paths (status kept at 200 with localized content), host-id validation unchanged - Dates, times, and chart labels format via `Intl` with per-locale tags (`pt-BR`, `ja-JP`, `zh-CN`, `es-ES`, `fr-FR`, `de-DE`, `en-US`) ## Validation - `pnpm lint && pnpm typecheck && pnpm test && pnpm build` green (25 tests, 21 pages built) - New tests: locale registry mirroring the website config, dictionary key parity and translation checks for all locales, path idempotency incl. `zh-CN` casing, worker locale routing and host-page detection - Local worker run verified: `/`, `/pt/`, `/es/`, `/ja/`, `/zh-CN/`, `/fr/`, `/de/`, `/<locale>/hosts/<id>` all 200 with correct `lang`, titles, labels, and links; `/<locale>/<unknown>` → localized 404; root `/` 404 behavior unchanged - Browser-checked hydration in ja and zh-CN (chart labels, legend, metrics, host-card links carry the locale prefix); English regression-checked - Mobile 375px: no horizontal overflow in either checked locale
Sign in to join this conversation.
No description provided.