You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(hub-ui): translate the hub UI and add a language setting
Every hub-ui string now goes through a small in-house t() with ten
locales (en, zh-CN, zh-TW, ja, ko, es, fr, de, pt-BR, ru) and English as
the fallback. A Language select in Settings > Appearance persists the
visitor's pick per browser; createUi({ locale }) seeds the default via
ConnectionMeta.configs.ui.locale, and the running UI writes the effective
language back into the connection it publishes so same-origin frames read
it at boot.
refs #398
Copy file name to clipboardExpand all lines: .agents/06-design-system.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,7 @@ Two shadow-root gotchas the ahead-of-time CSS builder MUST compensate for (both
28
28
-**A surface keeping its own component CSS** (inspect, a11y) sources every color from `@antfu/design`'s semantic shortcuts via `--at-apply` (expanded by `transformerDirectives`) rather than hardcoding a palette, so it tracks the shared theme and the `.dark` class.
29
29
-**Plain `.ts`/vanilla views** MUST opt `.ts` into UnoCSS extraction (`content.pipeline.include` for Vite, or `content.filesystem` globs for the `@unocss/postcss` setup Next uses), since UnoCSS only scans framework files by default.
30
30
- Before making new components or inline DOM elements, always check whether an `@antfu/design` component can be reused.
31
+
-**hub-ui text goes through `t()`.** Every user-facing string in `packages/hub-ui/src/client` (templates, tooltips, `aria-label`s, command titles, confirm copy) MUST be a key in `client/i18n/locales/en.json` rendered with `t()` / `tAround()` from `client/i18n`, never a literal. A new key lands in every locale file in the same change; the i18n test enforces the lockstep. Brand names and `DF` diagnostics stay untranslated.
Copy file name to clipboardExpand all lines: docs/content/1.guide/18.hub-initiate.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,6 +59,9 @@ interface DevframeHubUi {
59
59
-`'normal'` (default): shows immediately.
60
60
-`'passive'`: hidden until `Shift+Alt+D`, then persisted per-origin (later browser sessions start shown).
61
61
-`'hidden'`: hidden until `Shift+Alt+D`, that browser session only.
62
+
-**`locale`** sets the default UI language, one of the tags in `HUB_UI_LOCALES` (`en`, `zh-CN`, `zh-TW`, `ja`, `ko`, `es`, `fr`, `de`, `pt-BR`, `ru`). Without it the UI follows the browser language and falls back to English. A visitor's own pick in Settings → Appearance wins and persists per browser. The hub UI writes the language it resolved back into `ConnectionMeta.configs.ui.locale` on its window, so a same-origin frame that inherits the connection (see [Client](/guide/client)) reads the effective language at boot.
63
+
64
+
To add a language, add its tag and native name to `packages/hub-ui/src/locales.ts`, translate a copy of `packages/hub-ui/src/client/i18n/locales/en.json` under that tag, and register the file in the `messages` map in `packages/hub-ui/src/client/i18n/index.ts`. The i18n test fails on a missing key or a changed `{slot}`.
0 commit comments