Google 翻译需联网,部分用户需配置代理,网络不通时建议改用 Bing;阿里云翻译需先配置 accessKeyId 和 accessKeySecret;@translate 功能需预先安装并授权 GitHub Copilot Chat 扩展
vscode-comment-translate
intellismMIT更新放缓VS Code 插件,能在不干扰代码的前提下翻译注释、字符串、报错信息和变量名,方便快速读懂源码。
This extension helps developers translate comments, strings, code hints, error messages, and variable names in their code. 注释翻译插件, 不干扰正常代码,方便快速阅读源码。
在 VSCode 扩展市场搜索并安装 comment-translateREADME 未说明
VSCode 注释翻译插件,悬停或沉浸式翻译注释、字符串和变量名,不干扰正常代码
VS Code 插件,能在不干扰代码的前提下翻译注释、字符串、报错信息和变量名,方便快速读懂源码。
核心能力
- 用 TextMate 识别注释和字符串,通过 Hover 悬停显示译文
- 开启沉浸式阅读后自动翻译注释,可并排显示或替换原文
- 把描述翻译成英文并生成多个变量名供选择替换
- 支持 Google、Bing、阿里云、DeepL 及自定义翻译服务
- 扩展 GitHub Copilot Chat,用 @translate 在对话框内翻译
容易踩的坑
- v3.1.0最新正式版2026-03-04 · 2026-03-04 11:57 UTC
Add
- 沉浸式: 支持Markdown
- 支持Markdown翻译
- 新增互译开关配置
- Terminal右键支持翻译到github copilot chat
Change
- Concise模式改为可翻译2个字符可以Hover翻译。不再支持Ctrl or Command按下才翻译
- 优化isCode判断逻辑,减少误判
Fixed
- 修复Python等语言内容有Html标签时,翻译结果不显示问题。 #266 #281 #260
- 修复 Markdown 文档浏览翻译链路在部分语法场景下中断的问题(
invalid pattern in look-behind) - 修复
toggleDocumentBrowseMode在 Markdown 场景下偶发不生效问题 - 修复 browse 与 hover 状态耦合导致的开关行为不一致
Refactor
- 重构 Markdown browse 主路径,优先走文档段落扫描;TextMate scope fallback 失败时自动降级,保证主功能可用
- 调整注释翻译策略,忽略无效 token 参数并清理部分冗余状态字段
What's Changed
- feat: add tencent transmart translate by @Henvy-Mango in https://github.com/intellism/vscode-comment-translate/pull/241
- docs: add deepseek extension to translate source service table. by @Satone7 in https://github.com/intellism/vscode-comment-translate/pull/253
- feat&fix: 修复几个问题,优化翻译缓存机制,实现markdown的沉浸式翻译 by @sanchuanhehe in https://github.com/intellism/vscode-comment-translate/pull/290
New Contributors
- @Henvy-Mango made their first contribution in https://github.com/intellism/vscode-comment-translate/pull/241
- @Satone7 made their first contribution in https://github.com/intellism/vscode-comment-translate/pull/253
- @sanchuanhehe made their first contribution in https://github.com/intellism/vscode-comment-translate/pull/290
Full Changelog: https://github.com/intellism/vscode-comment-translate/compare/v3.0.0...v3.1.0
- v3.0.02024-09-19 · 2024-09-19 12:11 UTC
查看更新说明
Add
- 沉浸式: 注释
- 变量翻译替换
- github copilot翻译
需要github copilot插件,并授权调用模型
- Markdown,Hover 段落翻译
Change
- 互译支持,待翻译文本是目标语言,反向翻译源语言(可以设置
commentTranslate.sourceLanguage,默认English) - 优化文档,默认改为英文文档。
Fixed
- 移除 划词翻译 引起的编辑失焦
- v2.0.12022-02-15 · 2022-02-15 10:45 UTC
查看更新说明
- 识别并翻译代码中注释部分。支持不同语言,单行、多行注释。
- 任意选择区域翻译(划词翻译)
- 翻译并快速替换文本
- 快速选中最后一次翻译区域命令
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
VSCode Comment Translation Extension
This extension helps developers translate comments, strings, code hints, error messages, and variable names in their code.
Introduction
Many excellent projects have extensive comments to help users quickly understand the code's intent. If users are not familiar with the language of the comments, it can be challenging to understand. This extension provides multiple translation scenarios to help developers comprehend and write multilingual code more easily. It supports common translation services like Google, Bing, AliCloud, and DeepL, and allows developers to add custom translation services.

Features
Markdown Translation Preview
The extension supports Markdown format translation preview, allowing you to quickly translate and preview content in Markdown files.

Code Reading
The extension identifies multilingual content like comments and strings in the source code using TextMate, translates them quickly, and displays them via Hover, minimizing disruption to development.
Hover Translation: Move the mouse over comments, strings, or selected areas to see the translated content in a hover box. Other hover content like exceptions and code documentation are also translated and displayed.
Immersive Reading: Turn on immersive comment translation to automatically translate comments and display them in the document. The translated results can be shown alongside the original text or in place of it; toggle the display mode with Ctrl+Shift+B.

Translation and Replacement
The extension can translate source code content and quickly replace it in the document. For instance, translate a description and use it as a variable name; in multilingual development scenarios, translate a string and replace it in the document.
Translate Variable Naming: Translate the current description into English and provide various variable names to choose from, then replace the original description.

Hover Replacement: The hover box provides the ability to replace text with the translation result, which replaces the original content.

Full Text Replacement Translation: Supports translating and replacing strings, comments, and selected areas with one click.

GitHub Copilot Chat Participant: @translate
- Requires pre-installation of the GitHub Copilot Chat extension and authorization.
- For GitHub Copilot users, translation is currently supported in the Chat box, but not for comments, text, etc.
This extension extends GitHub Copilot by enabling translations in the Chat box using Copilot's AI model. The target language is set by CommentTranslate. Select text in the Editor and send it to GitHub Copilot Chat for quick translation using commands.

Useful Commands
Mac:
ctrl+shift+?/ Windows:alt+shift+?
The extension provides translation or replacement commands for various scenarios, with shortcuts for some common functionalities. Users can also customize shortcuts according to their habits.
- Immersive Comment Translation: Toggle immersive translation reading for the current document
ctrl+shift+z - Immersive Display Mode: Toggle cross-display/placeholder read mode
ctrl+shift+b - Translate Variable Naming: Translate the current descriptive word and provide named variables
ctrl+shift+n - Translation and Replacement: Translate selected content and replace it at the current location
ctrl+shift+t - Copilot Quick Translation: Translate selected content or clipboard content in GitHub Copilot Chat
ctrl+shift+y
Translation Services
The extension supports the following translation services:
- Google Translate: Built-in, free version, used by default.
- Note: Requires a network connection, some users may need a proxy. If encountering network issues, it is recommended to use Bing.
- Bing Translate: Built-in, free version.
- AliCloud Translate: Built-in, requires configuration of accessKeyId & accessKeySecret.
Third-party translation services can be found by searching for @tag:translateSource in the plugin market. Users can choose the desired translation service through the plugin configuration or expand it by customizing the translation service. More Links
Common Configurations
commentTranslate.hover.enabled: Enable/disable hover translation (quickly set through status)commentTranslate.hover.concise: Enable/disable concise mode. Only triggers hover translation when pressing ctrl or commandcommentTranslate.hover.string: Enable/disable string hover translationcommentTranslate.hover.content: Enable/disable translation of hover contentcommentTranslate.multilineMerge: Merge multiline commentscommentTranslate.targetLanguage: Translation target language, uses the local VSCode language if not set (quickly set through status)commentTranslate.source: Translation service source configuration. It is recommended to set it through commands. Supports plugin extensions for translation service sources. examplecommentTranslate.maxTranslationLength: Maximum translation length configuration to avoid excessive charges for long character translationscommentTranslate.browse.enabled: Enable/disable project immersive browsing translation functioncommentTranslate.markdown.scopeFallback: Enable/disable TextMate scope fallback after Markdown fenced-code detectioncommentTranslate.googleTranslate.mirror: Resolves the issue of domestic services being inaccessible. Documentation
Support Us
If you find this extension helpful, please consider supporting us in the following ways:
- Give us a star on GitHub intellism/vscode-comment-translate
- Submit feedback and suggestions
- Share with your friends and colleagues