T2: i18n (en/cs) #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "t2-i18n"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
T2 — i18n (en/cs)
Stacked on #1 (
t1-scaffold). Merge #1 first; this PR's base ist1-scaffold.What
src/i18n/en.tsis the source catalog.cs.tsissatisfies Messages, so a missing or extra key is a type error. A test also checks that keys and{placeholder}s match.t(key, params)with typed dotted keys (MessageKey),{name}interpolation, and fallback to English, then to the key. Lookup usesObject.hasOwn, so prototype paths can't resolve.localecookie →Accept-Language(q-values, region fallbackcs-CZ→cs,q=0excluded,*→default) →en.getLocale(root loader,staleTime: ∞) andsetLocale(validated againstLOCALES; cookie isHttpOnly; SameSite=Lax; Path=/, 1 year,Securewhen the request is https).<html lang>is set during SSR.I18nProvider/useI18n()context.LanguageSwitchin the root shell callsrouter.invalidate()after switching.Verified
bun run lint && bun run typecheck && bun run test(17 tests).bun run dev+ curl: defaultlang="en";Accept-Language: cs-CZ→lang="cs"with Czech text; the cookielocale=enoverridesAccept-Language: cs.Astra review (gpt-6-astra via
codex review)No actionable issues reported. Nothing to fix or dismiss.
🤖 Generated with Claude Code