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): localize dock, command and launcher titles with titleLocales (#417)
* feat(hub): localize dock, command and launcher titles with titleLocales
A registrant adds translations next to its plain title:
`titleLocales: { 'zh-CN': '构建', ja: 'ビルド' }`. The plain title stays the
default, so a reader that ignores the map keeps working. resolveTitle()
and matchLocale() from @devframes/hub pick the closest tag; the reference
hub UI resolves every entry and command against its own language setting,
and the example hosts resolve against the browser language.
refs #398
* fix(hub-ui): import matchLocale from its new home in the language setting
* fix(hub): keep the latest dock selection while a page script loads
A dock switch that waits on a page script no longer overrides a newer
switch that committed meanwhile, so clicking a dock while the previous
one still loads its script keeps the click.
* test(e2e): start the Next hub server without pnpm exec
pnpm 12.6 starts an exec child in its own process group, so Playwright's
teardown killed only the shell and the orphaned Next server held the
stdout pipe open: every e2e run hung until the 15-minute job limit.
Copy file name to clipboardExpand all lines: docs/content/1.guide/16.hub.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,6 +46,23 @@ ctx.commands.register({
46
46
47
47
`args` takes positional [Standard Schema](https://standardschema.dev/) schemas (a single `v.object(...)` unwraps into the input); omit for zero-arg. `safety` defaults to `'action'`; `when` clauses are unenforced for agent calls.
48
48
49
+
## Localized titles
50
+
51
+
A dock entry, a command, and a launcher each carry a plain `title` and an optional `titleLocales` map of translations by BCP 47 tag. The plain `title` stays the default, so a hub UI that ignores the map still shows it. The reference hub UI picks the translation closest to its own language setting (`zh-HK` falls back to `zh-TW`, `pt-PT` to `pt-BR`, `en-GB` to `en`):
52
+
53
+
```ts
54
+
ctx.docks.register({
55
+
type: 'iframe',
56
+
id: 'app:build',
57
+
title: 'Build',
58
+
titleLocales: { 'zh-CN': '构建', 'ja': 'ビルド' },
59
+
icon: 'ph:hammer-duotone',
60
+
url: '/__build/',
61
+
})
62
+
```
63
+
64
+
A devframe localizes the dock a hub synthesizes for it through `dock: { titleLocales }` in its definition. A hub UI provider resolves a title with `resolveTitle(entry, locale)` from `@devframes/hub/client`.
65
+
49
66
## Nested commands
50
67
51
68
A command's `children` nest arbitrarily deep. The palette drills into each level, and every command in the tree is bindable at any depth: a shortcut assigned to a leaf several levels down fires as directly as one on a top-level command, and each appears as its own row under **Settings → Shortcuts**, indented by nesting level.
Copy file name to clipboardExpand all lines: docs/content/8.references/6.hub-api.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -147,7 +147,7 @@ The origin-locked `postMessage` protocol on `devframe:frame-nav`: [Shared-iframe
147
147
148
148
## Dock entry types
149
149
150
-
The built-in variants of the open dock union (`DevframeDockEntryRegistry`, `@devframes/hub/types`) a hub UI provider renders: [Build Your Own Hub UI](/guide/build-your-own-hub-ui). Each entry's `icon` takes any of the [icon values](/references/node-api#icon-values).
150
+
The built-in variants of the open dock union (`DevframeDockEntryRegistry`, `@devframes/hub/types`) a hub UI provider renders: [Build Your Own Hub UI](/guide/build-your-own-hub-ui). Each entry's `icon` takes any of the [icon values](/references/node-api#icon-values). Each entry's `title` has an optional `titleLocales` map of translations, resolved with `resolveTitle(entry, locale)` from `@devframes/hub/client`; commands and launchers carry the same pair.
0 commit comments