feat(ui): init l10n - #8
Merged
Merged
Conversation
Reviewer's Guide为 Mutsumi VS Code 扩展引入完整的本地化(l10n/NLS)支持,覆盖 package.json 中的贡献配置、运行时 UI 文本,以及英文和简体中文的新本地化资源包。 File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your Experience访问你的 dashboard 以:
Getting HelpOriginal review guide in EnglishReviewer's GuideIntroduce full localization (l10n/NLS) support for the Mutsumi VS Code extension, covering package.json contributions, runtime UI strings, and new localization bundles for English and Simplified Chinese. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
嗨,我给出了一些整体层面的反馈:
- 建议统一本地化(l10n)键的命名方式(例如使用类似
debug.outputChannel.title这样的命名空间标识符,而不是重复使用面向用户的文案字符串,比如t('Mutsumi Debug')),这样可以让本地化包更易于维护,并避免键名意外冲突。 - 对于包含结构化内容的消息(例如侧边栏树条目中的 Markdown 提示),把完整的 Markdown 模板保存在 l10n 包中可能会更清晰,而不是在代码中拼接多个已本地化片段,这样译者可以查看并调整整条字符串的布局。
给 AI Agents 的提示词
Please address the comments from this code review:
## Overall Comments
- Consider standardizing l10n keys (e.g., using namespaced identifiers like `debug.outputChannel.title` instead of reusing user-facing strings such as `t('Mutsumi Debug')`) to keep the bundles easier to maintain and to avoid accidental key collisions.
- For messages that embed structured content (e.g., Markdown tooltips in sidebar tree items), it may be clearer to keep the full Markdown template in the l10n bundle rather than concatenating localized fragments in code, so translators can see and adjust the entire string layout.帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据这些反馈来改进后续的代码审查。
Original comment in English
Hey - I've left some high level feedback:
- Consider standardizing l10n keys (e.g., using namespaced identifiers like
debug.outputChannel.titleinstead of reusing user-facing strings such ast('Mutsumi Debug')) to keep the bundles easier to maintain and to avoid accidental key collisions. - For messages that embed structured content (e.g., Markdown tooltips in sidebar tree items), it may be clearer to keep the full Markdown template in the l10n bundle rather than concatenating localized fragments in code, so translators can see and adjust the entire string layout.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider standardizing l10n keys (e.g., using namespaced identifiers like `debug.outputChannel.title` instead of reusing user-facing strings such as `t('Mutsumi Debug')`) to keep the bundles easier to maintain and to avoid accidental key collisions.
- For messages that embed structured content (e.g., Markdown tooltips in sidebar tree items), it may be clearer to keep the full Markdown template in the l10n bundle rather than concatenating localized fragments in code, so translators can see and adjust the entire string layout.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
- move notebookController.displayName from package.nls.* to runtime bundle - add missing notebook.noCodeCell to zh-cn bundle - localize approval flow content strings (shell/mkdir/edit actions) - localize selectModel current marker and default effort row - keep LLM-facing rejection messages in English - remove dead keys, unify output channel key style, fix whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed issue #3.
This Pull Request contains AI-generated content.
该PR含有AI生成内容。
实现内容
1. package.json 贡献点本地化(NLS)
在
package.json中:"l10n": "./l10n"字段,指向 l10n bundle 目录contributes中的displayName、视图名称、命令title、configuration描述等硬编码字符串全部替换为%key%占位符新增两个 NLS 文件(VS Code 根据
package.nls.<locale>.json命名约定自动加载):package.nls.json— 英语基线package.nls.zh-cn.json— 简体中文2. 运行时字符串本地化(l10n bundle)
新增
src/i18n.ts,封装vscode.l10n.t(),提供t(message, ...args)简洁导入,支持{0}/{1}占位符替换。新增 l10n bundle 文件(由
package.json的"l10n"字段指向):l10n/bundle.l10n.json— 英语基线l10n/bundle.l10n.zh-cn.json— 简体中文3. 源码替换
将以下文件中所有面向用户的通知、QuickPick、tooltip、状态栏、Output 通道名称等替换为
t()调用:src/extension.ts— HTTP Server 警告、新建 Agent、复制引用、清缓存、Notebook Controller 名称src/controller.ts— 执行错误通知src/agent/agentRunner.ts— LLM 错误通知src/notifications.ts— 系统通知src/debugLogger.ts、src/tools.d/toolsLogger.ts— Output 通道名称src/sidebar/agentTreeItem.ts— Agent 状态标签(运行中/等待中/已完成/待命)src/sidebar/approvalTreeItem.ts— 审批 tooltip 与状态src/sidebar/shellTaskTreeItem.ts— Shell 任务 tooltipsrc/sidebar/contextTreeItem.ts— 上下文树分类、规则/技能切换提示、裁剪提示src/notebook/commands/selectModel.ts— 模型选择、推理强度描述src/notebook/commands/toggleAutoApprove.ts— 自动批准切换src/notebook/commands/pruneGhostBlocks.ts— Ghost 版本裁剪src/notebook/commands/debugContext.ts— 调试上下文src/notebook/commands/renameSession.ts— 重命名会话src/notebook/commands/testRagSearch.ts— RAG 测试搜索src/notebook/commands/compressConversation.ts— 压缩对话src/notebook/completionProvider.ts— 补全项 detailsrc/notebook/serializer.ts— 默认 Agent 名称src/tools.d/permission.ts— 拒绝流程输入框src/tools.d/edit_file.ts— 重新打开编辑器错误工作机制
VS Code 根据用户界面语言(
"locale": "zh-cn")自动选择对应 bundle:package.nls.json/l10n/bundle.l10n.json:英语(默认回退)package.nls.zh-cn.json/l10n/bundle.l10n.zh-cn.json:简体中文用户将 VS Code 显示语言切换为中文后,命令面板、侧边栏、设置页、通知、tooltip 等均显示中文;切回英文则显示英文,无需修改任何代码或配置。
Summary by Sourcery
为 VS Code 插件 UI 引入完整的本地化支持,包括运行时字符串和配置,并提供英文和简体中文资源包。
新特性:
package.json中的 contributes 元数据,并提供英文和简体中文资源。Original summary in English
Summary by Sourcery
Introduce full localization support for the VS Code extension UI, including runtime strings and configuration, with English and Simplified Chinese bundles.
New Features: