Skip to content

fix(i18n): add missing en-US dashboard translations - #9896

Merged
RC-CHN merged 2 commits into
AstrBotDevs:masterfrom
yunyancuo:fix/dashboard-en-us-i18n
Sep 2, 2026
Merged

fix(i18n): add missing en-US dashboard translations#9896
RC-CHN merged 2 commits into
AstrBotDevs:masterfrom
yunyancuo:fix/dashboard-en-us-i18n

Conversation

@yunyancuo

@yunyancuo yunyancuo commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

问题

英文界面的 MCP 服务器同步对话框直接渲染了原始键名(如 [MISSING: features.tooluse.syncProvider.status.selectProvider]),另有几处文案回退为中文。根因:en-US 相比 zh-CN 缺失 26 个翻译键。

问题出在哪

涉及 4 个语言文件,两类问题:

1. 不只是缺翻译,而是放错了位置 —— features/tool-use.json

整个 syncProvider 子树(22 个键)zh-CN 里有,但嵌在 dialogs. 之下。键解析逻辑如下:

  • loader.tsfeatures/tool-use.json 映射到命名空间 features.tooluse(无连字符)
  • McpServersSection.vue 通过 useModuleI18n('features/tooluse') 消费,tm('syncProvider.status.selectProvider') 解析为 features.tooluse.syncProvider.status.selectProvider

所以这个子树必须位于 tool-use.json根级;嵌在 dialogs. 下(zh-CN 目前就是这么放的)命名空间查找永远不可达,界面就会渲染 [MISSING: ...]。zh 界面同样受此影响(存量问题,见下文)。

2. 单纯缺失 —— 三个文件

  • features/provider.jsonproviders.description.vllm_rerank(由 utils/providerUtils.js 消费)
  • features/config-metadata.jsonai_group.knowledgebase.hint / ai_group.websearch.hintdefault.py 中 schema 的 hint 为空串,i18n_utils.py 仍会转换为 i18n 键,语言包必须提供文案)
  • features/subagent.jsonform.personaPreview —— 核实为死键SubAgentPage.vue 消费的是 cards.personaPreview(两种语言都已存在),因此刻意未复制

解决方案

  • syncProvider 移至 tool-use.json 根级,落入正确的命名空间(diff 为纯子树迁移)。
  • 为真正缺失的键补上英文翻译,键顺序与 zh-CN 保持一致。
  • 死键不复制;zh-CN 的键位错留作显式的后续小 PR(会改变 zh 界面表现,值得单独提交)。

验证

  • 全量消费审计(audit_i18n.py,可提供):解析 loader.ts 模块映射,扫描 62 个 dashboard 文件的全部 942 个字面量 tm()/t() 键,经命名空间映射解析后对照三种语言包。结果:en-US 全量可解析;全部语言包中仅存的缺口是 zh-CN 的 3 个 syncProvider 键(即上述存量 bug)与 ru-RU 的约 70 键。
  • 本 PR 断言套件(18 项):消费的 syncProvider 键在 en-US 全部存在;子树完整(8 个 section);死键不存在;四个文件均为合法 JSON。
  • pnpm build(vue-tsc + vite)通过——locale JSON 在构建期解析,可捕获任何语法错误。
  • en-US 对 zh-CN 的键覆盖率现为 100%(全文件键集 diff)。

后续(刻意不在本 PR 范围内)

  • 将 zh-CN 的 syncProvider 子树同样移到根级(修复 zh 界面的 [MISSING: ...])。
  • ru-RU 缺失约 70 键(集中在 config-metadata 与 extension)——可另行 PR 补齐。

Fill 26 keys present in zh-CN but missing from en-US locale files:
- tool-use: the whole dialogs.syncProvider subtree (MCP server sync
  dialog showed untranslated keys in English UI)
- config-metadata: section hints for knowledgebase and websearch
- provider: vllm_rerank description
- subagent: personaPreview label

Verified all en-US locale files now have full key parity with zh-CN.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@yunyancuo

Copy link
Copy Markdown
Contributor Author

Closing this for now — will revisit with a cleaner patch after double-checking key usage against the components.

@yunyancuo yunyancuo closed this Sep 1, 2026
McpServersSection.vue resolves features.tooluse.syncProvider.* (the
subtree must sit at the file root); the previous commit had mirrored
zh-CN's placement under dialogs, which the namespace lookup never
reaches. Also drop form.personaPreview: the component consumes
cards.personaPreview (already present); form.personaPreview is an
unused key.
@yunyancuo

Copy link
Copy Markdown
Contributor Author

Reopened after corrections — see the new commit. Every added key is now verified against actual component usage (grep of tm()/t() calls resolved through the i18n namespace map in loader.ts):

  • dialogs.syncProvider was the wrong place entirely: the component resolves features.tooluse.syncProvider.* (loader maps features/tool-use.json to the tooluse namespace), so the subtree now sits at the file root and all consumed keys resolve. (zh-CN keeps it under dialogs, so the zh UI currently renders [MISSING: ...] for these keys — pre-existing, happy to fix in a follow-up.)
  • Dropped form.personaPreview: unused — the component consumes cards.personaPreview, which already existed in both locales.
  • provider.json vllm_rerank and the two config-metadata hints verified against their consumers.

Diff is now +15/−52 across 2 files (moved subtree + removed one dead key). Verification script and method available on request.

@yunyancuo yunyancuo reopened this Sep 1, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery assessment

Approved.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@RC-CHN
RC-CHN merged commit 6ee1ddd into AstrBotDevs:master Sep 2, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants