Skip to content

feat(i18n): translatable UI with on-demand language catalogs - #118

Merged
ParadoxInfinite merged 3 commits into
mainfrom
feat/i18n-extract
Jun 28, 2026
Merged

feat(i18n): translatable UI with on-demand language catalogs#118
ParadoxInfinite merged 3 commits into
mainfrom
feat/i18n-extract

Conversation

@ParadoxInfinite

@ParadoxInfinite ParadoxInfinite commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Makes the interface translatable, with languages delivered on demand so the
binary stays English-only and new translations ship without a release.

The translation layer

  • t(key, params) and tn(key, count, params) resolve UI text against the active
    locale, with {placeholder} interpolation and Intl-based plural rules.
  • English is bundled and is the per-key fallback, so a catalog that translates
    only some keys shows English for the rest.
  • The chosen locale is saved to the browser (like the theme), detected from the
    saved choice, then the browser language, then English.

On-demand catalogs

  • GET /api/i18n and GET /api/i18n/{locale} proxy the catalog files from the
    repo over a CDN, so a translation can be published or corrected without a new
    build. The browser talks only to the backend, which avoids CORS and works when
    outbound network is backend-only.
  • Responses are size-capped, validated as JSON, and cached on disk for a few
    hours; a failed refresh still serves a stale cached copy. The locale tag is
    bounded so it can't reach another path or host.
  • The UI pulls the published-locale list on startup and offers any it finds.

Coverage

  • Every panel, dialog, component, and controller resolves its text through the
    layer. Label lists that were built once (table headers, nav, command palette,
    status pills) are reactive, so text updates on a language switch without reload.

Only English ships here; this is the machinery plus the English catalog. Strings
the backend produces (error text, raw engine states) are still shown as received.

Testing

  • Backend tests cover the proxy cache, stale-on-outage fallback, non-JSON
    rejection, and tag validation.
  • A check confirms every key referenced in the source exists in the catalog.
  • npm run build, go build ./..., and go test ./... pass.

@ParadoxInfinite
ParadoxInfinite changed the base branch from feat/i18n-fetch to main June 28, 2026 09:46
@ParadoxInfinite ParadoxInfinite changed the title feat(i18n): route remaining UI text through the translation layer feat(i18n): translatable UI with on-demand language catalogs Jun 28, 2026
@ParadoxInfinite
ParadoxInfinite merged commit 676efa9 into main Jun 28, 2026
1 check passed
@ParadoxInfinite
ParadoxInfinite deleted the feat/i18n-extract branch June 28, 2026 09:49
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.

1 participant