mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-20 13:07:57 +09:00
## Summary Follow-up to #1193. `requests.nomadkaraoke.com` always served the English board (the old redirect was also hard-coded to `/en/requests`). - **Worker (`requests-host`, already deployed):** `/` serves `/{locale}/requests/`. The locale comes from the `nk_requests_locale` cookie, else `Accept-Language` (primary-subtag match like gen's `LocaleRedirect`, so `pt-BR` → `pt` and `nn` → `nb`), else `en`. `/{locale}/` (e.g. `/es/`) forces a language. Responses send `Vary: Accept-Language, Cookie`. - **Board header:** gen's `LanguageSwitcher` sits top-right. On the vanity host it sets the cookie and reloads `/`, so the copyable URL stays bare. On gen it behaves as before (`router.replace` to `/{locale}/requests`). - **`LanguageSwitcher`:** new optional `onSelectLocale` prop that replaces the default navigation. ## Testing - Worker: `node --test infrastructure/cloudflare/requests-host/`, 10 pass. This includes a check that the Worker's locale list matches `frontend/i18n/routing.ts`. - New `components/__tests__/LanguageSwitcher.test.tsx` (2 tests); the 703 component tests pass. - Live checks against the deployed Worker: `es`, `ja`, `pt-BR`, `en-US` each get the translated board, and the cookie beats `Accept-Language`. - Mobile (390px) screenshot of a local build: the switcher shows as a compact flag top-right and the dropdown fits the screen. - Prod E2E spec extended with a browser-language check and a switcher round-trip. It will run after deploy. Local CodeRabbit review: no findings. @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_016FYpoNVXzJzqKFaowqpwxr --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>