feat(i18n): localize plugin catalog names and shell preset desc

Catalog entry names (15 tab + 4 viewer) and the dsh-desktop shell preset
desc were raw hardcoded zh strings rendered straight into the add-plugin
modals and the title-bar scheme dropdown. Mirror the existing desc
pattern exactly: PluginEntry.name / ShellPreset.desc widen to the
i18n-friendly string-or-() =>-string union, the catalogs carry lazy
t('pluginXxxName') / t('presetDshDesktopDesc') lookups, and the
add-plugin modal (render, search filter, aria-labels) plus the scheme
SelectMenu resolve them like every other copy. The plain-string arm of
the union stays as the raw-name fallback, and t() itself never yields
empty text (missing keys render the key), so a dict gap can never blank
a name.

20 new dictionary keys added to zh/en (locales.ts), ja (locales-ja.ts),
and all 18 third-language dictionaries — tests/locales.spec.ts enforces
key-set equality against zh for every shipped dict (precedent: 9cc642b),
so the 'leave other locales-* untouched' shortcut would fail the hard
parity gate; real translations are provided instead.

Spec follow-ups (behavior change: names/descs now render through t()):
- plugin-list.spec.ts: name non-empty assertion resolves the union.
- add-plugin-modal.spec.tsx: sentinel/office name assertions resolve
  from the catalog (en locale in tests) instead of pinning zh literals.
- shell-presets.spec.ts: desc non-empty assertion resolves the union.
This commit is contained in:
Menghuan1918
2026-09-03 19:59:00 +08:00
parent 9e1a034527
commit fa301da29e
29 changed files with 510 additions and 57 deletions
+40
View File
@@ -428,6 +428,26 @@ export const zh = {
pluginDocsPanelDesc: 'DSH 侧边栏里的「全局文档」:全局 Markdown 笔记,任何工作区随时可读——列表点选阅读、悬浮大纲跳转、Chrome / VS Code 外部打开、代码复制,目录可配置(默认 ~/.dsh/docs)',
pluginEgoBrowserDesc: '把 CitroLabs/ego-lite 接进 DeepSeek Harness 的 agent 浏览器:32 个 ego_* 工具驱动真实 Chromium,侧边栏原生「ego 浏览器」Tab 实时观察 agent 逛的每个页面,可直接点击/拖拽/输入接管;装 better-sidebar 时自动注册 Tab,没装则退回浮动浮窗',
pluginBilingualReaderDesc: '在 DSH 侧边栏读论文 PDF:原生 PDF 显示,选中一段文字即用大模型划词翻译,结合上下文、完全隔离主对话,只作阅读辅助',
pluginSentinelName: 'dsh-sentinel 唤醒系统',
pluginEgoBrowserName: 'ego-browser Agent 浏览器',
pluginBetterOverleafName: 'dsh-better-overleaf Overleaf 标签页',
pluginDocsPanelName: 'dsh-docs-panel 全局文档',
pluginFlowglassName: 'dsh-flowglass 流镜',
pluginGitForgeName: 'dsh-git-forge Git 凭据',
pluginGitRemotesName: 'dsh-git-remotes Git 远程',
pluginGithubWorkbenchName: 'dsh-github-workbench GitHub 工作台',
pluginSidebarQaName: 'dsh-sidebar-qa 划选追问',
pluginSidenoteName: 'dsh-sidenote 侧边聊天',
pluginServerDeckName: 'dsh-server-deck 服务器甲板',
pluginSuhuangScrollName: 'dsh-suhuang-scroll 苏黄共阅',
pluginSshTunnelName: 'dsh-ssh-tunnel SSH 隧道',
pluginTurnReviewName: 'dsh-turn-review 本轮审查',
pluginBilingualReaderName: 'dsh-bilingual-reader 双语阅读',
pluginOfficeName: 'Office 预览插件',
pluginMdExportName: 'Markdown 导出插件',
pluginCodeNavName: '代码预览导航',
pluginVideoPreviewName: '视频预览插件',
presetDshDesktopDesc: 'Electron 高级模式(无边框):macOS 顶栏 20px、Windows 无 WCO 时 32px 标题栏让位',
}
/** The en dictionary (key-set-equal to zh, enforced by the type annotation). */
@@ -837,6 +857,26 @@ export const en: Record<keyof typeof zh, string> = {
pluginEgoBrowserDesc: 'The agent browser for DeepSeek Harness: 32 ego_* tools drive a real Chromium, with a native sidebar "ego browser" tab giving a live view of every page the agent visits — you can click, drag, and type to take over. Registers the tab automatically when better-sidebar is present, otherwise falls back to a floating bubble',
pluginBetterOverleafDesc: 'Overleaf tab for better-sidebar: direct-CDP browser login (third-party Chromium supported), project list/switch, local git mirrors under <workspace>/overleaf/, two-way git sync with read-only API fallback, and file preview through the sidebar workbench',
pluginBilingualReaderDesc: 'Read paper PDFs in the DSH sidebar: native PDF rendering, select text to translate it with the LLM, using context while staying fully isolated from the main conversation — a reading aid only',
pluginSentinelName: 'dsh-sentinel Wake-up System',
pluginEgoBrowserName: 'ego-browser Agent Browser',
pluginBetterOverleafName: 'dsh-better-overleaf Overleaf Tab',
pluginDocsPanelName: 'dsh-docs-panel Global Docs',
pluginFlowglassName: 'dsh-flowglass Flowglass',
pluginGitForgeName: 'dsh-git-forge Git Credentials',
pluginGitRemotesName: 'dsh-git-remotes Git Remotes',
pluginGithubWorkbenchName: 'dsh-github-workbench GitHub Workbench',
pluginSidebarQaName: 'dsh-sidebar-qa Select & Ask',
pluginSidenoteName: 'dsh-sidenote Side Chat',
pluginServerDeckName: 'dsh-server-deck Server Deck',
pluginSuhuangScrollName: 'dsh-suhuang-scroll Suhuang Scroll',
pluginSshTunnelName: 'dsh-ssh-tunnel SSH Tunnel',
pluginTurnReviewName: 'dsh-turn-review Turn Review',
pluginBilingualReaderName: 'dsh-bilingual-reader Bilingual Reader',
pluginOfficeName: 'Office Preview',
pluginMdExportName: 'Markdown Export',
pluginCodeNavName: 'Code Preview Navigator',
pluginVideoPreviewName: 'Video Preview',
presetDshDesktopDesc: 'Electron advanced (frameless) mode: macOS reserves a 20px top strip; Windows reserves a 32px title bar when WCO is unavailable',
}
/**