JunweiHu0143 downloadsSelect text in any note and instantly see its Google translation in a side panel.
Select text in any note and instantly read its Google translation in a side panel — no buttons, no copy-paste.
在笔记中选中文本,右侧栏即时显示 Google 翻译 —— 无需按钮,无需复制粘贴。
If the video above does not play inline, click here to watch it · 若上方视频无法直接播放,点此查看
Most translation plugins make you open a panel, paste text into an input box, and click a button — then the result appears below the input. But the original text is already in your note. This plugin removes all of that friction:
Select text → the translation appears in the side panel. That's it.
The original text stays where it belongs (in your note on the left), and the panel shows only the translation.
main.js, manifest.json, and styles.css from the Releases page.google-selection-translate inside your vault's .obsidian/plugins/ directory.git clone https://github.com/JunweiHu0/obsidian-google-translate.git
cd obsidian-google-translate
npm install
npm run build # produces main.js
Then copy main.js, manifest.json, and styles.css into your vault plugin folder as above.
This repo ships a Claude Code skill, configure-google-translate.
In a Claude Code session at the repo root, run /configure-google-translate and answer the prompts —
it collects your API key and language preferences, optionally validates the key, and writes the
plugin's data.json into your vault for you.
| Setting | Description |
|---|---|
| Google API key | Your Cloud Translation API key. A Test button checks connectivity without consuming translation quota. |
| Source language | Language of the text you select. Detect language lets Google decide. |
| Target language | Language the translation is shown in. |
| Translate on selection | Automatically translate as soon as you select text. Turn off to translate only via the command/hotkey. |
| Merge hard line breaks | Join the line breaks that wrap paragraphs in PDFs/papers so a paragraph is translated as one block. |
| Selection delay (ms) | How long to wait after a selection settles before translating. |
| Cache translations | Reuse previously translated text/language pairs instead of calling the API again. |
| Persist cache across restarts | Keep the cache in the vault's plugin data so it survives reloading Obsidian (off by default). A Clear button empties it. |
Text copied from papers separates both wrapped lines and paragraphs with a single newline, so a newline is ambiguous. The plugin classifies each one heuristically: a newline becomes a paragraph break when the previous line ends a sentence and is noticeably shorter than the column width (or the next line starts a list/heading); otherwise it is treated as a soft wrap and joined. Hyphenated wraps (transla-\ntion) are stitched back together.
The Google Cloud Translation request logic and the HTTP error-code messages are adapted from obsidian-translate by Fevol, licensed under MIT. This project is a minimal, focused reimagining of the select-to-translate workflow.
大多数翻译插件的流程是:打开面板 → 把文本粘进输入框 → 点击翻译按钮 → 在下方看到结果。可原文明明就在你的笔记里。这个插件去掉了所有多余步骤:
选中文本 → 译文直接出现在右侧栏。就这么简单。
原文留在它该在的地方(左侧笔记里),右侧面板只显示译文。
main.js、manifest.json、styles.css。.obsidian/plugins/ 目录下新建文件夹 google-selection-translate。git clone https://github.com/JunweiHu0/obsidian-google-translate.git
cd obsidian-google-translate
npm install
npm run build # 生成 main.js
然后按上面的方式把 main.js、manifest.json、styles.css 拷到 vault 插件目录。
本仓库内置了一个 Claude Code 技能 configure-google-translate。
在仓库根目录的 Claude Code 会话里运行 /configure-google-translate,按提示回答即可 —— 它会收集你的
API Key 与语言偏好,(可选)校验密钥,并把插件的 data.json 直接写入你的 vault。
| 设置 | 说明 |
|---|---|
| Google API key | 你的 Cloud Translation API 密钥。Test 按钮可检测连通性,且不消耗翻译配额。 |
| Source language | 你选中文本的语言。Detect language 让 Google 自动判断。 |
| Target language | 译文显示的语言。 |
| Translate on selection | 选中文本即自动翻译。关闭后仅通过命令/快捷键触发。 |
| Merge hard line breaks | 合并 PDF/论文里折行的换行,让一个段落作为整体翻译。 |
| Selection delay (ms) | 选区稳定后等待多久再翻译。 |
| Cache translations | 复用已翻译过的文本/语言组合,不再重复调用 API。 |
| Persist cache across restarts | 把缓存写进 vault 的插件数据,重启 Obsidian 后仍然保留(默认关闭)。设置里有 Clear 按钮可清空。 |
从论文复制的文本里,折行和段落分隔都用单个换行符,因此换行存在歧义。插件用启发式逐个判定:当前一行以句末标点结尾且明显短于列宽(或下一行是列表/标题开头)时,该换行视为段落分隔;否则视为折行并合并。连字符断词(transla-\ntion)会被还原拼接。
Google Cloud Translation 的请求逻辑与 HTTP 错误码提示改编自 Fevol 的 obsidian-translate(MIT 许可)。本项目是对"选中即翻译"工作流的一次极简、专注的重新实现。