Repository navigation
Commit cb7d514
fix(i18n): title the AI drawer with the top-bar button's name in every locale (#34930)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBNgJrQDxaUNx2so1ektgf6A)_
repo:objectstack#3 · os-support-ai · session_01WGufzfrh8TiPJf1i2kMSoa
Fixes #34827
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:AI 助手抽屉的标题(侧边抽屉、铺满后、手机底部面板三处)现在和顶栏按钮同名,zh-Hans/zh-Hant 是「AI
助手」,en 是 "AI Assistant",其余 8 种语言也都用各自顶栏按钮那个词。
- 为什么改:验收时看到顶栏按钮叫「AI 助手」,点开后抽屉标题只写「助手」,同一个东西两个名字。
- 风险与回滚:只改了 11 个语言包里 `console.ai.dock.title`
的值,外加抽屉组件里同一个键的英文兜底文字;不动布局和行为。回滚即 revert 本 PR。
- 先看:`ui/packages/i18n/src/locales/zh-Hans.ts` 与 `en.ts` 的 `dock.title`
一行;`ui/packages/app-shell/src/layout/ChatDock.tsx` 两处 `defaultValue`;新测试
`ChatDock.titleMatchesTopBar-34827.test.tsx`。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/app-shell/src/layout/__tests__/ChatDock.titleMatchesTopBar-34827.test.tsx`,预期
4 个用例全过;或在中文界面点顶栏机器人,抽屉标题与按钮提示同为「AI 助手」。
- 需要你做的:无,席位落地。
## What changes
- `console.ai.dock.title` now carries the same value as
`topbar.aiAssistant` (the key the top-bar robot reads for its
`aria-label` and `title`) in all eleven built-in packs:
| pack | before | after |
|:--|:--|:--|
| en | Assistant | AI Assistant |
| zh-Hans / zh-Hant | 助手 | AI 助手 |
| ja | アシスタント | AI アシスタント |
| ko | 어시스턴트 | AI 어시스턴트 |
| de | Assistent | KI-Assistent |
| fr | Assistant | Assistant IA |
| es / pt-BR | Asistente / Assistente | Asistente de IA / Assistente de
IA |
| ru | Ассистент | ИИ-ассистент |
| ar | المساعد | مساعد الذكاء الاصطناعي |
- That one key is the title of all three drawer forms: the side rail and
the window-filling form (`ChatDockPanel`, the same header in both) and
the phone sheet (`ChatDockMobileSheet`). Nothing passes a `title` prop
to either in the Console (`useConsoleChatDock` mounts both without one),
and the Studio panel no longer mounts `ChatDockPanel`, so the value
change reaches exactly the drawer.
- `ChatDock.tsx`: the two inline `defaultValue`s for that key change
from `'Assistant'` to `'AI Assistant'`. This is not optional:
`check-i18n-call-site-keys` requires every literal inline default to
equal the en value, and its test
(`scripts/__tests__/check-i18n-call-site-keys.test.ts`, "main carries no
drift") went red on the value change alone. No layout or behaviour
change.
- The dispatch named the en button as `aiChat: 'AI assistant'`. That key
is `console.shortcuts.groups.aiChat`, the keyboard-shortcuts dialog's
group heading. The robot reads `topbar.aiAssistant`
(`AssistantTopBarButton`), whose en value is `AI Assistant`, so that is
the value matched.
- `console-namespace-3546.test.tsx` carried French `dock.title` =
`Assistant` as its one permitted en-identical cognate; French now reads
`Assistant IA`, so the exemption set is empty and the test now pins that
the three French values containing the word differ from en. One comment
in `marketplace-preview-namespace-3546.test.tsx` that counted that
cognate is corrected.
### Item 2: other self-names in the same panel
Checked against the keys the drawer actually renders (`ChatDock.tsx`,
`ChatDockConversation.tsx` and what it mounts: `ChatPane` from
`AiChatPage.tsx`, `ConversationsSidebar.tsx`):
| key | zh-Hans / en | verdict |
|:--|:--|:--|
| `console.ai.dock.description` (phone sheet, screen-reader only) | AI
助手对话 / AI assistant chat | already uses the full name; unchanged |
| `ConversationsSidebar` (history list): `chats`, `noChatsYet`,
`noChatsDescription`, `searchChats`, `newChat` | 对话 / Chats, … | no
self-name; unchanged |
| `console.ai.empty.build.*`, `console.ai.empty.ask.*` (empty states) |
用 AI 搭建 / Build with AI, 向你的数据提问 / Ask your data | no self-name;
unchanged |
| `console.ai.unavailableTitle` / `unavailableDescription` | AI 助手不可用 /
AI assistant unavailable | already the full name; unchanged |
| `console.ai.switchAssistant`, `chooseAgent`, `loadingAgents`,
`offlineDemoMode` | 切换助手, 选择助手…, … | 助手 here means an agent in the
picker, not the panel's name; unchanged |
| `console.ai.assistant` | 助手 / Assistant | the agent-label fallback in
`ChatPane` when no agent is found. `ChatPane` is shared with the Studio
panel (`StudioAiCopilot`), so changing it would rename text there too
(#34725's scope); unchanged |
| `console.ai.emptyDescription` | 可以直接提问,助手会结合… / Ask anything — the
assistant has access… | generic empty state in the same shared
`ChatPane`; same reason; unchanged |
| `console.ai.dock.open` | 打开助手 / Open assistant | read only by
`ChatDockLauncher`, which no Console path mounts (only its own test
renders it); unchanged |
## Tests
- New
`ui/packages/app-shell/src/layout/__tests__/ChatDock.titleMatchesTopBar-34827.test.tsx`
(its own file because the existing ChatDock harnesses mock
`useObjectTranslation` with the inline defaults and cannot see a pack
value). Real `AssistantTopBarButton`, `ChatDockPanel`,
`ChatDockMobileSheet`, real `I18nProvider` and packs:
- zh and en: the rail and the full window show the button's accessible
name; **control**: the resize handle's name from the same pack (`调整对话宽度`
/ `Resize chat`), so a pack that never loaded is not read as a pass;
- zh: the phone sheet heading;
- every built-in pack: `console.ai.dock.title === topbar.aiAssistant`.
- Ablation (one-shot, not kept): `scripts/ablation-replace.mjs` put
zh-Hans `dock.title` back to `'助手'` (the mutated blob `77e56f98` equals
the zh-Hans blob on `origin/main`), and the pin went red on the three zh
cases with the en case green (`Tests 3 failed | 1 passed (4)`); restore
verified by blob hash against HEAD and an empty `git diff HEAD`.
## Verification
All readings below are on head `b34dabff8` (the branch with
`origin/main` `fc5913e1` merged in), on a shared container.
<details><summary>Pin, package tests and type-check (through the shared
verification lock)</summary>
- `pnpm --dir ui exec vitest run packages/i18n/
packages/app-shell/src/layout/`: `Test Files 243 passed (243)`, `Tests
2890 passed | 13 skipped (2903)`; the new pin is in that set.
- `pnpm --dir ui exec vitest run
scripts/__tests__/check-i18n-call-site-keys.test.ts`: `Tests 152 passed
(152)` (this file was red, 3 failures, before the `defaultValue`
alignment).
- `pnpm --filter @object-ui/i18n run type-check` exit 0; `pnpm --filter
@object-ui/app-shell run type-check` exit 0.
- ESLint on the three changed test files and `en.ts`, from the ui root
and from each package dir: exit 0, no output.
- The full app-shell suite is left to CI's `Test UI`: the diff changes
one string literal in app-shell, and no app-shell test outside `layout/`
reads that key.
</details>
<details><summary>Eager budget (merged tree)</summary>
`pnpm --dir ui/apps/console exec vite build`, then `pnpm --dir ui run
check:eager-closure` exit 0: `i18n-locale-en 60.4 KB / 60.5 KB ceiling
(headroom 0.2 KB)`; the report gives the chunk as `gzipBytes: 61818`
against the `62_000` ceiling, so 182 bytes are left. The ceiling is not
touched.
</details>
<details><summary>Derived gate families</summary>
`node scripts/pm/dispatch-gates.mjs --commands` derived 40 commands. 39
were re-run on `b34dabff8`, each `:: exit 0`. The 40th, `pnpm --dir ui
exec vitest run scripts/`, was run on `6069d44b` (before the
`defaultValue` fix): `Test Files 1 failed | 170 passed | 2 skipped
(173)`, and the one failing file is the call-site-keys test, now green
as shown above. `--ran` reconciliation: `40 derived, 40 run, 0
NOT-MEASURED, 0 UNRUN`.
Also run: `check-i18n-call-site-keys.mjs`, `check-i18n-en-drift.mjs`
(`Every changed en value was followed by all 10 translation packs.`),
`check-i18n-dead-keys.mjs`, `check:new-line-citations` (`0 new
citation(s)`), each exit 0. `overlap-check`: `VERDICT clean exit 0`
before the first content push and on the merge head `b34dabff8` (that
run came right after its push, not before).
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzfrh8TiPJf1i2kMSoa)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01WGufzfrh8TiPJf1i2kMSoa
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzfrh8TiPJf1i2kMSoa -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 97cd541 commit cb7d514
16 files changed
Lines changed: 160 additions & 36 deletions
File tree
- .changeset
- ui/packages
- app-shell/src/layout
- __tests__
- i18n/src
- __tests__
- locales
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
| 329 | + | |
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
| |||
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
473 | | - | |
| 473 | + | |
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
160 | 158 | | |
161 | | - | |
162 | | - | |
| 159 | + | |
| 160 | + | |
163 | 161 | | |
164 | | - | |
| 162 | + | |
165 | 163 | | |
166 | 164 | | |
167 | 165 | | |
| |||
228 | 226 | | |
229 | 227 | | |
230 | 228 | | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
244 | 237 | | |
245 | 238 | | |
246 | 239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
| 238 | + | |
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2479 | 2479 | | |
2480 | 2480 | | |
2481 | 2481 | | |
2482 | | - | |
| 2482 | + | |
2483 | 2483 | | |
2484 | 2484 | | |
2485 | 2485 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2224 | 2224 | | |
2225 | 2225 | | |
2226 | 2226 | | |
2227 | | - | |
| 2227 | + | |
2228 | 2228 | | |
2229 | 2229 | | |
2230 | 2230 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2993 | 2993 | | |
2994 | 2994 | | |
2995 | 2995 | | |
2996 | | - | |
| 2996 | + | |
2997 | 2997 | | |
2998 | 2998 | | |
2999 | 2999 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2290 | 2290 | | |
2291 | 2291 | | |
2292 | 2292 | | |
2293 | | - | |
| 2293 | + | |
2294 | 2294 | | |
2295 | 2295 | | |
2296 | 2296 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2286 | 2286 | | |
2287 | 2287 | | |
2288 | 2288 | | |
2289 | | - | |
| 2289 | + | |
2290 | 2290 | | |
2291 | 2291 | | |
2292 | 2292 | | |
| |||
0 commit comments