Lingui (gettext) spike (#3) #34

Merged
miko merged 5 commits from feature/3-lingui-spike into development 2026-11-02 13:22:12 +01:00
Owner

Closes #3.

  • Lingui 6 with .po catalogs (English msgids, en + de), npm run i18n:extract / i18n:compile; compiled catalogs are git-ignored and built before dev/build and after install.
  • @lingui/swc-plugin pinned to 6.7.1: plugins.swc.rs doesn't list Next 16.4 yet, so the version was matched on the SWC crates inside Next's binary and the plugin wasm (swc_ecma_ast 29, swc_common 26). Works under Turbopack; re-check on every Next upgrade (ADR-0007).
  • Locale: kataba-locale cookie, else Accept-Language (q-values, region subtags), else en; no URL prefix.
  • Translated Server Components: Account, Titlebar home link. Translated Client Components: ThemeSwitch, new LocaleSwitch (sets the cookie via a Server Action). All locale reads under <Suspense>; routes stay partially prerendered.
  • Tests: resolveLocale unit tests, render tests with the German catalog (Babel macro in Vitest).

Open for later: <html lang> is en in the server HTML until hydration; the theme switch briefly shows in English for German visitors.

🤖 Generated with Claude Code

Closes #3. - Lingui 6 with `.po` catalogs (English msgids, `en` + `de`), `npm run i18n:extract` / `i18n:compile`; compiled catalogs are git-ignored and built before dev/build and after install. - `@lingui/swc-plugin` pinned to 6.7.1: plugins.swc.rs doesn't list Next 16.4 yet, so the version was matched on the SWC crates inside Next's binary and the plugin wasm (`swc_ecma_ast` 29, `swc_common` 26). Works under Turbopack; re-check on every Next upgrade (ADR-0007). - Locale: `kataba-locale` cookie, else `Accept-Language` (q-values, region subtags), else `en`; no URL prefix. - Translated Server Components: `Account`, Titlebar home link. Translated Client Components: `ThemeSwitch`, new `LocaleSwitch` (sets the cookie via a Server Action). All locale reads under `<Suspense>`; routes stay partially prerendered. - Tests: `resolveLocale` unit tests, render tests with the German catalog (Babel macro in Vitest). Open for later: `<html lang>` is `en` in the server HTML until hydration; the theme switch briefly shows in English for German visitors. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Lingui 6 with .po catalogs (English msgids, en and de), extract/compile
scripts, @lingui/swc-plugin pinned to 6.7.1 to match Next 16.4.3's SWC
crates. The locale comes from a cookie, else Accept-Language, else en.
Account and the home link are translated Server Components; the theme
switch and a new language switch are translated Client Components under
<Suspense>. Setup notes in ADR-0007.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Locale and i18n instance are cached per request, the provider takes only
the locale (one createI18n helper), lingui.config reuses LOCALES, and the
ADR notes that the per-user language setting is still to come.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every user-visible string goes through Lingui: pages, forms, editors,
Editor.js's own interface, metadata, and the error messages of actions
and validation (descriptors in plain modules, translated in the action).
Locale-dependent headings moved under <Suspense>; dates use the viewer's
locale. German catalog complete (279 messages, `lingui compile --strict`).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
miko merged commit 97db6e0402 into development 2026-11-02 13:22:12 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MassiveDynamic/kataba!34
No description provided.