Skip to content

The agent that grows with you

fix(desktop): every chrome pane tab, zone menu row and drag ghost follow the display language

teknium1c2c0248ff65b
diff --git a/apps/desktop/src/app/contrib/controller.tsx b/apps/desktop/src/app/contrib/controller.tsx
index a0e1a3948c5..cf70279452b 100644
--- a/apps/desktop/src/app/contrib/controller.tsx
+++ b/apps/desktop/src/app/contrib/controller.tsx
@@ -177,6 +177,7 @@ registry.registerMany([
// (zone menu Show/Hide rows + the auto-registered ⌘K toggle below).
hideOnly: true,
tabTitle: () => <LocalizedTabTitle select={t => t.sidebar.sessions} />,
+ tabTitleText: () => translateNow('sidebar.sessions'),
width: `${SIDEBAR_DEFAULT_WIDTH}px`,
minWidth: `${SIDEBAR_DEFAULT_WIDTH}px`,
maxWidth: `${SIDEBAR_MAX_WIDTH}px`
@@ -200,7 +201,8 @@ registry.registerMany([
{
id: 'terminal',
area: 'panes',
- title: 'terminal',
+ // Register-time sample; the tab renders `tabTitle` (see sessions).
+ title: translateNow('sidebar.terminal'),
// revealOnPreset: choosing a layout that places the terminal (e.g.
// "Terminal deck") turns takeover on so the zone actually shows, instead of
// staying collapsed behind the ⌃` toggle. height sizes the fixed track (a
@@ -215,14 +217,16 @@ registry.registerMany([
height: '20vh',
maxHeight: '80vh',
revealOnPreset: true,
- lifecycleKeepAlive: true
+ lifecycleKeepAlive: true,
+ tabTitle: () => <LocalizedTabTitle select={t => t.sidebar.terminal} />,
+ tabTitleText: () => translateNow('sidebar.terminal')
},
render: () => <WiredPane part="terminal" />
},
{
id: 'files',
area: 'panes',
- title: 'files',
+ title: translateNow('sidebar.files'),
// dock: re-adoption target after a stale dismissal (see sessions).
data: {
placement: 'right',
@@ -231,14 +235,16 @@ registry.registerMany([
revealAliases: ['file-browser'],
width: FILE_BROWSER_DEFAULT_WIDTH,
minWidth: FILE_BROWSER_MIN_WIDTH,
- maxWidth: FILE_BROWSER_MAX_WIDTH
+ maxWidth: FILE_BROWSER_MAX_WIDTH,
+ tabTitle: () => <LocalizedTabTitle select={t => t.sidebar.files} />,
+ tabTitleText: () => translateNow('sidebar.files')
},
render: () => idle(<FilesPane />)
},
{
id: 'review',
area: 'panes',
- title: 'review',
+ title: translateNow('sidebar.review'),
// The second right sidebar: hidden until ⌘G ($reviewOpen) — bound below
// like the other chrome toggles; its zone collapses while hidden.
data: {
@@ -247,7 +253,9 @@ registry.registerMany([
revealAliases: [REVIEW_PANE_ID],
width: FILE_BROWSER_DEFAULT_WIDTH,
minWidth: FILE_BROWSER_MIN_WIDTH,
- maxWidth: FILE_BROWSER_MAX_WIDTH
+ maxWidth: FILE_BROWSER_MAX_WIDTH,
+ tabTitle: () => <LocalizedTabTitle select={t => t.sidebar.review} />,
+ tabTitleText: () => translateNow('sidebar.review')
},
render: () => idle(<ReviewPaneContent />)
}
@@ -632,7 +640,7 @@ const syncLogsPane = (open: boolean) => {
unregisterLogsPane ??= registry.register({
id: 'logs',
area: 'panes',
- title: 'logs',
+ title: translateNow('sidebar.logs'),
// Same tool-panel sizing rule as the terminal above — no minHeight, so
// the sash floors it at COLLAPSED_ZONE_PX and folds the zone to its rail
// rather than leaving a sliver. dock: its OWN zone beside the terminal —
@@ -641,7 +649,9 @@ const syncLogsPane = (open: boolean) => {
placement: 'bottom',
dock: { pane: 'terminal', pos: 'right' },
height: '20vh',
- maxHeight: '80vh'
+ maxHeight: '80vh',
+ tabTitle: () => <LocalizedTabTitle select={t => t.sidebar.logs} />,
+ tabTitleText: () => translateNow('sidebar.logs')
},
render: () => idle(<LogsPane />)
})
diff --git a/apps/desktop/src/app/contrib/sessions-pane-tab-title.test.tsx b/apps/desktop/src/app/contrib/sessions-pane-tab-title.test.tsx
index 1bcdbc24a4e..e158e9d545b 100644
--- a/apps/desktop/src/app/contrib/sessions-pane-tab-title.test.tsx
+++ b/apps/desktop/src/app/contrib/sessions-pane-tab-title.test.tsx
@@ -8,7 +8,7 @@ import type { ReactNode } from 'react'
import { renderToStaticMarkup } from 'react-dom/server'
import { describe, expect, it } from 'vitest'
-import { I18nProvider } from '@/i18n'
+import { I18nProvider, setRuntimeI18nLocale } from '@/i18n'
const { registry } = await import('@/contrib/registry')
@@ -18,6 +18,7 @@ describe('the Sessions pane tab label', () => {
it('follows the live locale instead of the register-time title', () => {
const sessions = registry.getArea('panes').find(c => c.id === 'sessions')!
const tabTitle = (sessions.data as { tabTitle: () => ReactNode }).tabTitle
+
const inLocale = (locale: string) =>
renderToStaticMarkup(
<I18nProvider configClient={null} initialLocale={locale}>
@@ -28,4 +29,35 @@ describe('the Sessions pane tab label', () => {
expect(inLocale('ru')).toBe('Сеансы')
expect(inLocale('en')).toBe('Sessions')
})
+
+ it('is joined by every other string-titled chrome pane, with a string twin for the zone menu / drag ghost', () => {
+ const chrome = (id: string) =>
+ registry.getArea('panes').find(c => c.id === id)!.data as {
+ tabTitle: () => ReactNode
+ tabTitleText: () => string
+ }
+
+ const inLocale = (id: string, locale: string) =>
+ renderToStaticMarkup(
+ <I18nProvider configClient={null} initialLocale={locale}>
+ {chrome(id).tabTitle()}
+ </I18nProvider>
+ )
+
+ expect(inLocale('terminal', 'ru')).toBe('Терминал')
+ expect(inLocale('files', 'ru')).toBe('Файлы')
+ expect(inLocale('review', 'en')).toBe('Review')
+
+ // The non-React readers (zone menu Show/Hide rows, drag ghost chip) call
+ // the string twin at menu-open / drag-start, so it follows the runtime
+ // locale set after registration — not the English `title` sampled at import.
+ setRuntimeI18nLocale('ru')
+
+ try {
+ expect(chrome('sessions').tabTitleText()).toBe('Сеансы')
+ expect(chrome('files').tabTitleText()).toBe('Файлы')
+ } finally {
+ setRuntimeI18nLocale('en')
+ }
+ })
})
diff --git a/apps/desktop/src/components/pane-shell/tree/hide-only-strip-tabs.test.ts b/apps/desktop/src/components/pane-shell/tree/hide-only-strip-tabs.test.ts
index e18913aaea7..5bdf117dbcb 100644
--- a/apps/desktop/src/components/pane-shell/tree/hide-only-strip-tabs.test.ts
+++ b/apps/desktop/src/components/pane-shell/tree/hide-only-strip-tabs.test.ts
@@ -52,6 +52,20 @@ afterEach(() => {
})
describe('hide-only strip tabs', () => {
+ it('labels the zone menu rows from the pane string localizer, not the register-time title', () => {
+ registerPane('sessions', { placement: 'left', hideOnly: true, tabTitleText: () => 'Сеансы' })
+ registerPane('hermes-bots:pane', { placement: 'left', hideOnly: true })
+ registerPane('workspace', { placement: 'main', uncloseable: true })
+ $layoutTree.set(
+ split('row', [
+ group(['sessions', 'hermes-bots:pane'], { active: 'sessions', id: 'g-side' }),
+ group(['workspace'], { active: 'workspace', id: 'g-main' })
+ ])
+ )
+
+ expect(hideOnlyZoneTabs('g-side').map(tab => tab.title)).toEqual(['Сеансы', 'hermes-bots:pane'])
+ })
+
it('hides and shows a chrome tab, keeping the pane in the tree', () => {
sessionsBotsTree()
diff --git a/apps/desktop/src/components/pane-shell/tree/renderer/track-model.ts b/apps/desktop/src/components/pane-shell/tree/renderer/track-model.ts
index 8b03ddecb48..2e5a97b168a 100644
--- a/apps/desktop/src/components/pane-shell/tree/renderer/track-model.ts
+++ b/apps/desktop/src/components/pane-shell/tree/renderer/track-model.ts
@@ -113,6 +113,13 @@ interface PaneChrome extends PaneSizing {
* whole panes area, so the label subscribes for itself instead. Absent, or
* returning nothing, falls back to `title`. */
tabTitle?: () => React.ReactNode
+ /** The STRING form of the tab label for the non-React readers of `title` —
+ * the zone menu's Show/Hide rows and the drag ghost chip. `title` is
+ * sampled once at `register` (for bundled panes: module import, before the
+ * locale has loaded), so a pane whose label follows the locale supplies
+ * this and the readers resolve it at menu-open / drag-start time. Absent,
+ * they fall back to `title`. */
+ tabTitleText?: () => string
}
export const paneChrome = (c: Contribution | undefined) => (c?.data ?? {}) as PaneChrome
diff --git a/apps/desktop/src/components/pane-shell/tree/renderer/tree-group.tsx b/apps/desktop/src/components/pane-shell/tree/renderer/tree-group.tsx
index c1958e6865e..b72afec1684 100644
--- a/apps/desktop/src/components/pane-shell/tree/renderer/tree-group.tsx
+++ b/apps/desktop/src/components/pane-shell/tree/renderer/tree-group.tsx
@@ -425,6 +425,9 @@ export function TreeGroup({
// A pane's own live label when it has one, else its registered string.
const tabLabel = (paneId: string) => paneChrome(paneFor(paneId)).tabTitle?.() ?? paneFor(paneId)?.title ?? paneId
+ // String twin of `tabLabel` for the drag ghost / edit veil: resolved at
+ // drag start, so a locale-following pane reads its LOADED-locale label.
+ const tabText = (paneId: string) => paneChrome(paneFor(paneId)).tabTitleText?.() ?? paneFor(paneId)?.title ?? paneId
// Collapse/restore a tool panel (or plain minimize elsewhere) — the header
// chevron, routed so ⌃`/the titlebar toggle stay truthful. The strip itself
@@ -561,7 +564,7 @@ export function TreeGroup({
event,
node.minimized ? () => restoreTreePane(activeId) : undefined,
undefined,
- active?.title ?? activeId
+ tabText(activeId)
)
}
}}
@@ -589,7 +592,7 @@ export function TreeGroup({
const isActive = paneId === activeId && !node.minimized
const chrome = paneChrome(paneFor(paneId))
const closeable = closeableTab(paneId)
- const title = paneFor(paneId)?.title ?? paneId
+ const title = tabText(paneId)
const isSelected = tabSelection?.groupId === node.id && tabSelection.ids.has(paneId)
const tab = (
@@ -822,7 +825,7 @@ export function TreeGroup({
// barely-tinted wash; the light blur reads as "edit mode" the same
// way the zone editor's backdrop does.
className="absolute inset-x-0 bottom-0 z-50 flex cursor-grab items-center justify-center outline-1 -outline-offset-2 outline-dashed backdrop-blur-[2px]"
- onPointerDown={e => startPaneDrag(activeId, e, undefined, undefined, active?.title ?? activeId)}
+ onPointerDown={e => startPaneDrag(activeId, e, undefined, undefined, tabText(activeId))}
style={{
top: topEdge ? TITLEBAR_HEIGHT + (tabsBelowControls && headerVisible ? 28 : 0) : headerVisible ? 28 : 0,
background:
@@ -832,7 +835,7 @@ export function TreeGroup({
>
<span className="flex max-w-[calc(100%-1rem)] items-center gap-1.5 rounded-md border border-(--ui-stroke-secondary) bg-popover px-2 py-1 text-[0.64rem] font-semibold uppercase tracking-[0.16em] text-(--ui-text-secondary)">
<Codicon className="shrink-0" name="gripper" size="0.8125rem" />
- <span className="min-w-0 truncate">{active?.title ?? activeId}</span>
+ <span className="min-w-0 truncate">{tabText(activeId)}</span>
</span>
</div>
</ZoneMenu>
diff --git a/apps/desktop/src/components/pane-shell/tree/store.ts b/apps/desktop/src/components/pane-shell/tree/store.ts
index 170e3a0e666..a37047c3211 100644
--- a/apps/desktop/src/components/pane-shell/tree/store.ts
+++ b/apps/desktop/src/components/pane-shell/tree/store.ts
@@ -697,12 +697,15 @@ export function hideOnlyZoneTabs(groupId: string): { hidden: boolean; id: string
return group.panes.flatMap(id => {
const pane = panes.find(p => p.id === id)
+ const chrome = pane?.data as { hideOnly?: boolean; tabTitleText?: () => string } | undefined
- if (!(pane?.data as { hideOnly?: boolean } | undefined)?.hideOnly) {
+ if (!chrome?.hideOnly) {
return []
}
- return [{ hidden: hidden.has(id), id, title: String(pane?.title ?? id) }]
+ // Menu-open time, so a locale-following label (`tabTitleText`) resolves
+ // against the LOADED locale rather than the register-time `title`.
+ return [{ hidden: hidden.has(id), id, title: chrome.tabTitleText?.() ?? String(pane?.title ?? id) }]
})
}
diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.ts
index 5c28ebd392e..d9e6bc5f106 100644
--- a/apps/desktop/src/i18n/ar.ts
+++ b/apps/desktop/src/i18n/ar.ts
@@ -1979,6 +1979,10 @@ export const ar = defineLocale({
results: 'النتائج',
pinned: 'المثبتة',
sessions: 'الجلسات',
+ terminal: 'الطرفية',
+ files: 'الملفات',
+ review: 'المراجعة',
+ logs: 'السجلات',
cronJobs: 'المهام المجدولة',
groupAriaGrouped: 'الجلسات مجمعة حسب مساحة العمل',
groupAriaUngrouped: 'الجلسات غير مجمعة',
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index 55b4ddab2d6..5bf31ad4f02 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -2798,6 +2798,10 @@ export const en: Translations = {
results: 'Results',
pinned: 'Pinned',
sessions: 'Sessions',
+ terminal: 'Terminal',
+ files: 'Files',
+ review: 'Review',
+ logs: 'Logs',
cronJobs: 'Cron jobs',
groupAriaGrouped: 'Show sessions as a single list',
groupAriaUngrouped: 'Group sessions by workspace',
diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.ts
index 5688ddf44b9..5f08bc4f2ea 100644
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@ -2310,6 +2310,10 @@ export const ja = defineLocale({
results: '結果',
pinned: 'ピン留め',
sessions: 'セッション',
+ terminal: 'ターミナル',
+ files: 'ファイル',
+ review: 'レビュー',
+ logs: 'ログ',
cronJobs: 'Cronジョブ',
groupAriaGrouped: 'セッションを単一リストとして表示',
groupAriaUngrouped: 'ワークスペースごとにセッションをグループ化',
diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.ts
index 57101c8bccf..f3a71c18a6d 100644
--- a/apps/desktop/src/i18n/ru.ts
+++ b/apps/desktop/src/i18n/ru.ts
@@ -2573,6 +2573,10 @@ export const ru = defineLocale({
results: 'Результаты',
pinned: 'Закреплённые',
sessions: 'Сеансы',
+ terminal: 'Терминал',
+ files: 'Файлы',
+ review: 'Проверка',
+ logs: 'Журналы',
cronJobs: 'Cron-задачи',
groupAriaGrouped: 'Показать сеансы одним списком',
groupAriaUngrouped: 'Сгруппировать сеансы по рабочим пространствам',
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index 8ce9c42e2b3..bc8d835bf4b 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -2365,6 +2365,10 @@ export interface Translations {
results: string
pinned: string
sessions: string
+ terminal: string
+ files: string
+ review: string
+ logs: string
cronJobs: string
groupAriaGrouped: string
groupAriaUngrouped: string
diff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.ts
index 1acdb95bc4e..d80035cba6c 100644
--- a/apps/desktop/src/i18n/zh-hant.ts
+++ b/apps/desktop/src/i18n/zh-hant.ts
@@ -2298,6 +2298,10 @@ export const zhHant = defineLocale({
results: '結果',
pinned: '已釘選',
sessions: '工作階段',
+ terminal: '終端機',
+ files: '檔案',
+ review: '審查',
+ logs: '記錄',
cronJobs: '排程任務',
groupAriaGrouped: '以單一清單顯示工作階段',
groupAriaUngrouped: '依工作區分組工作階段',
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index e1ea38abf38..2e296bc78ea 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -2946,6 +2946,10 @@ export const zh = defineLocale({
results: '结果',
pinned: '已置顶',
sessions: '会话',
+ terminal: '终端',
+ files: '文件',
+ review: '审查',
+ logs: '日志',
cronJobs: '定时任务',
groupAriaGrouped: '以单一列表显示会话',
groupAriaUngrouped: '按工作区分组会话',
diff --git a/apps/desktop/src/plugins/hermes-bots/plugin.tsx b/apps/desktop/src/plugins/hermes-bots/plugin.tsx
index cc2b5fbeee0..ebee3d9c3e2 100644
--- a/apps/desktop/src/plugins/hermes-bots/plugin.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/plugin.tsx
@@ -398,6 +398,7 @@ export default {
collapsible: true,
hideOnly: true,
tabTitle: () => <LocalizedTabTitle select={t => t.common.bots} />,
+ tabTitleText: () => translateNow('common.bots'),
dock: {
pane: 'sessions',
pos: 'center',
@@ -429,6 +430,7 @@ export default {
title: translateNow('cron.title'),
data: {
tabTitle: () => <LocalizedTabTitle select={t => t.cron.title} />,
+ tabTitleText: () => translateNow('cron.title'),
placement: 'main',
// Repair persisted layouts that stranded Cronjobs in the Bots tab strip.
dock: {