fix(workspace): localize the local source and status-only route labels - #5421
Conversation
The English Workspace showed the local control-plane source as 本机 and the status-only chat route as 仅查状态 because both labels were hard-coded. Render them through the existing workspace dictionary; Chinese text is unchanged. The locale browser smoke now asserts both directions. Signed-off-by: huangruiteng <huangrt01@163.com>
Signed-off-by: huangruiteng <huangrt01@163.com>
Signed-off-by: huangruiteng <huangrt01@163.com>
…5421-refine Signed-off-by: huangruiteng <huangrt01@163.com>
Signed-off-by: huangruiteng <huangrt01@163.com>
huangruiteng
left a comment
There was a problem hiding this comment.
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
English verdict: APPROVE - Workspace labels follow the existing locale owner without changing source identity, runtime routing or authority.
Exact head: 501bef4. No blocking finding remains.
动机
已有 Workspace 支持语言设置与浏览器语言检测,但英文界面的本机来源和只读 Runtime 仍写死为中文。用户在英文入口中会把这些中文标签理解成另一种来源或模式。本次补齐这几个系统标签,让现有语言设置在普通查看状态的路径上保持一致,范围是界面标签,不声称所有业务内容已翻译。
改动思路
沿用现有 i18n 字典、浏览器语言检测和保存的 locale,不另建翻译层。来源的 kind 和 id 仍供原有连接逻辑使用,只有 local 来源的显示名称取本机翻译;SSH 及自定义来源保留自身名称。只读 Runtime 的标识仍是 status-only,描述和回复身份由同一个翻译 owner 生成。点击只读状态入口依旧读取当前投影,不启动 Agent Turn,也不改变模型选择权限或执行边界。
具体改动
关键代码讲解
StatusSourceSwitcher按已有source.kind === "local"选择source.local,不把源的名称改写回 catalog,不改 source id、URL 或 SSH 路由。英文使用 This machine,中文使用本机;其他来源仍使用原来的 label。agentOptions和sendManagerQuestion在只读路径使用header.statusOnlyAgent、header.statusOnlyDescription与header.statusProjection。用户看到 Status only 或仅查状态,状态回复的身份和内部来源标签一致随当前语言生成;原始 Runtime id 保持不变。verifyWorkspaceLocales在原来的语言场景里增加本机显示和只读回复身份检查,选择 status-only 后发送普通状态问题,并明确断言 Agent Turn 请求数为零。检查用户可见的回复身份,而不等待未在界面展示的内部 sourceLabel。保留原有的设置切换、保存、重新加载与移动视口检查。
仅四个文件、二十八行新增和七行删除,没有协议迁移、能力启用字段或新的配置状态。依赖的 #5415 已合入;最终祖先合并没有改变构建输入,集成打包版的语言场景也通过。
对主干的风险
最可能的回归是翻译时误改来源身份,或只读选择意外切到可执行 Agent。代码只替换显示字符串,保留 source.kind、source id 和 status-only 路由;浏览器场景对“不发起 Agent Turn”提供独立断言。实际打包 App 使用隔离真实后端,英文来源和 Runtime 标签已确认,保存的英文选择在 reload 后仍成立。主干对照版同样选 English,却仍显示本机和仅查状态,说明测试针对的是已存在的显示缺口。
13 个浏览器偏好、无效/受限存储场景及双向语言保存检查在开发和打包模式通过,打包构建与共享 TS 类型检查通过,最终 premerge 和公共边界扫描通过。浏览器 API fixture 只证明语言与请求边界,真实后端回读补足打包路径;没有把 fixture 当成模型执行证据。Goal 自己的文本及既有状态摘要正文可能仍是中文,属于原有内容,不能用本次标签修复宣称全面双语完成。
我的整体评价
这是范围合适的体验修复:没有新增模式或 authority,持续工作路径和持久化状态保持原有语义;用户选择语言后,系统来源和只读身份更加清楚,刷新也能保留选择。未来维护整理已限于现有翻译键和原有语言 smoke,未引入新 wrapper、状态机或备用字典。词表新增属于本地展示键,不是共享协议;风险已由可见标签、只读请求边界和真实打包回读覆盖,准予合入。
English Workspace users still saw Chinese labels for the local status source and status-only chat route. This change uses the existing locale dictionary for those labels, the read-only description, and reply attribution, while preserving source identity, runtime routing and the no-Agent-turn boundary.
The existing locale browser smoke now checks the visible status-only reply identity and asserts zero Agent Turn requests. Scope remains labels: Goal content and the existing status-summary paragraph are not translated by this PR. The packaged Workspace is the affected entry point; CLI and Lark do not render these labels.
Validation: dashboard TypeScript check and packaged build passed; development and packaged locale scenarios passed, including browser/storage variants, language save/reload and mobile clipping. An isolated real backend confirmed English labels and saved-locale readback. The main comparison still displayed the old Chinese labels in English. Final premerge selected five checks, all passed; the public-boundary scan was clean and the exact-diff change-quality receipt is valid. No manual hold remains.
Future-facing refinement stays within the existing dictionary and locale smoke; no new translation layer or shared vocabulary. Dependency #5415 is merged.