Skip to content

feat(web): add i18n framework with react-i18next#23

Open
Cawlumm wants to merge 4 commits into
mainfrom
feature/language-localization
Open

feat(web): add i18n framework with react-i18next#23
Cawlumm wants to merge 4 commits into
mainfrom
feature/language-localization

Conversation

@Cawlumm

@Cawlumm Cawlumm commented May 20, 2026

Copy link
Copy Markdown
Owner

Summary

Introduces the standard self-hosted localization stack (react-i18next + monolingual JSON, the layout Weblate expects) so the UI can be translated, plus a proof-of-concept slice covering the Login, Register, and Settings pages.

  • i18n config (web/src/i18n.ts) — react-i18next + browser language detector, a central SUPPORTED_LANGUAGES list, and <html lang> kept in sync on language change.
  • English base dictionary (web/src/locales/en.json) — monolingual i18next JSON.
  • Language preference detected from localStorage/navigator and persisted client-side (works on pre-login pages, no backend change).
  • Language selector added to Settings → Appearance.
  • String extraction on Login, Register, and Settings (120 t() calls) as the proven pattern; remaining pages to follow.

Adding a language later: drop a <code>.json next to en.json, import it, and add one line to SUPPORTED_LANGUAGES (or wire up Weblate to do it via PRs).

Test plan

  • npm run type-check passes
  • npm run build passes (3195 modules transformed)
  • All 120 t() keys resolve against en.json
  • i18next runtime resolution + interpolation/count verified
  • Dev server boots clean
  • Visual browser click-through (could not run a browser in this environment — verified at the i18next layer instead)

https://claude.ai/code/session_016WYyAzJvCGWDfDJGdvyRXr


Generated by Claude Code

claude added 4 commits May 20, 2026 20:17
Introduce the standard self-hosted localization stack so the UI can be
translated and is ready for community translations via Weblate:

- react-i18next + i18next + browser language detector, configured in
  src/i18n.ts with a central SUPPORTED_LANGUAGES list
- English base dictionary at src/locales/en.json (monolingual i18next
  JSON, the layout Weblate expects)
- language preference detected from localStorage/navigator and persisted
  client-side; <html lang> kept in sync on change
- language selector in Settings → Appearance
- extract all hardcoded strings on Login, Register, and Settings into
  translation keys as the proven pattern; remaining pages to follow

https://claude.ai/code/session_016WYyAzJvCGWDfDJGdvyRXr
Make translations contributable without touching code, so Weblate can
open translation PRs that work on merge:

- i18n.ts now auto-discovers every src/locales/<code>.json via
  import.meta.glob and labels each language by its autonym; adding a
  language is just committing one JSON file (no registration step)
- region locales fall back to the base language (de-AT -> de)
- .weblate CLI config at the repo root (server URL + default component;
  API token intentionally excluded)
- TRANSLATING.md: contributor guide for the Weblate and manual-PR flows,
  key/placeholder/plural conventions, and maintainer setup
- link the guide from CONTRIBUTING.md

https://claude.ai/code/session_016WYyAzJvCGWDfDJGdvyRXr
- scripts/weblate-provision.sh: create the Lyftr project + component on a
  self-hosted Weblate via its REST API (one command, idempotent re-runs),
  using the GitHub pull-request backend
- TRANSLATING.md: self-hosting section (official Docker stack + required
  env, then run the provisioning script)
- point .weblate at a self-hosted URL placeholder

https://claude.ai/code/session_016WYyAzJvCGWDfDJGdvyRXr
Lyftr is MIT + public, so it qualifies for Hosted Weblate's free libre
plan — same as wger. Make that the default path, default .weblate back to
hosted.weblate.org, and keep self-hosting as a documented alternative.

https://claude.ai/code/session_016WYyAzJvCGWDfDJGdvyRXr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants