kbkmflbdmdalljmkkolmhijpciccjcgb
连续按三次空格键即可将文本翻译到选定目标语言(支持多语言) # 沉浸式翻译闪电版 Chrome 扩展 一个简单易用的Chrome扩展,通过连续按三次空格键来快速翻译输入框中的文本到选定目标语言。 ## 功能特点 - 🚀 **快速翻译**: 连续按三次空格键即可翻译输入框内容 - ⌨️ **多重快捷键**: 支持输入框翻译(三次空格)、页面段落翻译(Ctrl+Shift+L)和原位翻译(Ctrl+Q) - 🔄 **多语言支持**: 支持翻译到中文、英文、日文、韩文、德文、法文、西班牙文或自定义语言 - 🌍 **全页面支持**: 支持所有网页的输入框、文本框和富文本编辑器 - 📄 **智能段落提取**: 自动识别并翻译页面中的文本段落 - 🔑 **安全私密**: API密钥本地存储,确保隐私安全 - ⚡ **实时响应**: 基于Google Gemini API,翻译准确快速 - 🎨 **现代界面**: 美观的模态窗口和实时通知反馈 ## 安装方法 ### 方法一:开发者模式安装 1. 打开Chrome浏览器 2. 进入扩展管理页面 `chrome://extensions/` 3. 启用右上角的"开发者模式" 4. 点击"加载已解压的扩展程序" 5. 选择本项目文件夹 ### 方法二:打包安装 1. 在扩展管理页面点击"打包扩展程序" 2. 选择项目文件夹并生成.crx文件 3. 将.crx文件拖拽到扩展管理页面安装 ## 配置方法 1. 安装扩展后,点击浏览器工具栏中的扩展图标 2. 获取Gemini API密钥: - 访问 [Google AI Studio](https://makersuite.google.com/app/apikey) - 登录Google账号 - 创建新的API密钥(免费) 3. 在弹窗中输入API密钥并保存 4. 选择翻译方向(目标语言)和界面语言 5. 点击"测试连接"确认配置正确 ## 使用方法 ### 快捷键翻译输入框内容 1. 在任意网页的输入框中输入任意语言的文本 2. **连续快速按下三次空格键**(需在500毫秒内完成) 3. 扩展会将文本翻译到预设的目标语言 4. 翻译结果会自动替换原文本 **快捷键操作要点:** - ⏱️ **时间限制**: 三次空格必须在500毫秒内连续按下 - 🎯 **精确操作**: 第三次空格会被自动拦截,不会在输入框中显示 - 🔄 **实时反馈**: 翻译过程中会显示进度通知 - ⚠️ **注意事项**: 如果间隔超过500毫秒,计数器会重置 ### 快捷键翻译页面段落内容 1. 在任意网页上按下 **Ctrl+Shift+L**(Windows)或 **Cmd+Shift+L**(Mac) 2. 扩展会自动提取页面中的段落内容 3. 在弹出的模态窗口中查看和翻译段落 4. 支持批量翻译、隐藏原文、自动翻译等功能 **段落翻译功能:** - 📄 **智能提取**: 自动识别页面中的文本段落 - 🔄 **批量翻译**: 一键翻译所有段落内容 - 👁️ **显示控制**: 可选择隐藏原文,仅显示翻译结果 - ⚡ **自动翻译**: 开启后自动翻译新提取的段落 - 🎨 **美观界面**: 现代化的模态窗口设计 ### 快捷键原位翻译页面内容 1. 在任意网页上按下 **Ctrl+Q**(Windows)或 **Cmd+Q**(Mac) 2. 扩展会自动识别页面中的所有文本元素并添加编号 3. 直接在原位置显示翻译结果,无需弹窗 4. 适合左手单手操作,提高翻译效率 **原位翻译功能:** - 🎯 **原位显示**: 翻译结果直接替换原文,保持页面布局 - 🔢 **智能编号**: 为每个文本元素添加编号,便于跟踪翻译进度 - 👈 **左手友好**: Ctrl+Q组合键适合左手单手操作 - ⚡ **批量处理**: 自动分批翻译所有页面文本元素 - 🔄 **状态保护**: 防止重复触发,确保翻译过程稳定 ## 支持的输入框类型 - ✅ 标准input输入框 - ✅ textarea文本域 - ✅ 富文本编辑器(contentEditable) - ✅ 各种在线编辑器(如Gmail、微信网页版等) ## 项目结构 ``` Ex_translation/ ├── manifest.json # 扩展清单文件 ├── content.js # 内容脚本(核心功能) ├── popup.html # 弹窗界面 ├── popup.js # 弹窗脚本 ├── icons/ # 图标文件夹 │ ├── icon16.png # 16x16图标 │ ├── icon48.png # 48x48图标 │ └── icon128.png # 128x128图标 └── README.md # 说明文档 ``` ## 技术实现 - **监听机制**: 使用事件委托监听所有输入框的键盘事件 - **翻译引擎**: 基于Google Gemini 2.0 Flash API - **语言检测**: 通过正则表达式检测中文字符 - **用户体验**: 实时通知反馈,支持动态页面元素 ## 隐私说明 - API密钥仅存储在本地Chrome存储中 - 翻译请求直接发送到Google服务器 - 扩展不会收集或存储用户的翻译内容 ## 常见问题 **Q: 为什么要连续按三次空格?** A: 这是为了避免误触发,确保用户是有意进行翻译操作。三次空格的设计既不会干扰正常输入,又能快速触发翻译功能。 **Q: 为什么有时候三次空格没有反应?** A: 请检查以下几点: 1. 三次空格是否在500毫秒内连续按下 2. 当前焦点是否在支持的输入框内 3. 输入框中是否有文本内容 4. API密钥是否正确配置 **Q: Ctrl+Shift+L快捷键有什么用?** A: 这个快捷键用于打开段落翻译模态窗口,可以翻译整个页面的文本内容,适合阅读外语文章时使用。 **Q: 支持哪些语言?** A: 支持翻译到中文、英文、日文、韩文、德文、法文、西班牙文,以及自定义语言。 **Q: API密钥是否安全?** A: API密钥存储在Chrome的本地存储中,不会上传到任何服务器。 **Q: 为什么翻译没有反应?** A: 请检查: 1. 是否正确设置了API密钥 2. 网络连接是否正常 3. 输入框是否包含有效文本 4. 是否在500ms内连续按下三次空格 ## 开发者信息 这是一个开源项目,欢迎提交Issue和Pull Request来改进功能。 ## 许可证 MIT License
Translator for Telegram™ Web
Support multiple translation engines, intelligent recognition of scene languages, and translation using the enter key (unofficial) Usage scenario: When communicating with foreign friends using Telegram, we often encounter language barriers. By using our plugin, we only need to set my language and the language of the contact person, and the chat content can be automatically translated. The content entered in the input box can also be translated into the target language using shortcut keys. Disclaimer: Telegram is a trademark registered in Russia and other countries. Telegram ™ Real time translation is an independent project and has no relationship with Telegram officials. The translation engine used in the plugin also has no association, authorization, recognition or official contact with Google.
Translator for Messenger™ Web
Support multiple translation engines, intelligent recognition of scene languages, and translation using the enter key (unofficial) Function Description: This is a Facebook Messenger web page message translation plug-in that is compatible with message translation under the three domain names of www.facebook.com, www.messenger.com, and business.facebook.com. We have also developed translation plug-ins for other platforms. Installation link attached. Usage scenario: When communicating with friends abroad using Messenger, we often encounter language barriers. By using our plugin, we only need to set my language and the language of the contact person, and the chat content can be automatically translated. The content entered in the input box can also be translated into the target language using shortcut keys. Disclaimer: Facebook is a trademark registered in the United States and other countries. Messenger ™ Real time translation is an independent project and has no relationship with the official Facebook website. The translation engine used in the plugin also has no association, authorization, recognition or official contact with Google.
Translator for Instagram™ Web
Support multiple translation engines, intelligent recognition of scene languages, and translation using the enter key (unofficial) Usage scenario: When communicating with friends abroad using Instagram, we often encounter language barriers. By using our plugin, we only need to set my language and the language of the contact person, and the chat content can be automatically translated. The content entered in the input box can also be translated into the target language using shortcut keys. Disclaimer: Instagram is a trademark registered by Instagram Inc. in the United States and other countries. Instagram ™ Real time translation is an independent project and has no relationship with the official Instagram or Instagram Inc. The translation engine used in the plugin also has no association, authorization, recognition or official contact with Google.
TransOver
Hover, click or select to translate (with text-to-speech). Translator. Translate word (or text selection) from any language to the language of your choice by single click or hover over. Also available: - text-to-speech - reverse translate: from your own language to the language of your choice - type and translate in a popup - copy translation to clipboard "Your data on all websites": TransOver should be able to read any word on a page - "Your data ..." - in order to translate it. On any website you want it working - "... on all websites". 1.74 - Better popup positioning 1.73 - When reverse translating, tts now speaks "target" language, as opposed to the "source" one 1.72 - Fix double translation (flicker) when translating selection 1.71 - Make tts great again - Add more languages 1.70 - Fix for google translate api changes 1.69 - Add 'Disable everywhere' toggle 1.68 - Upgrade Google Analytics from UA to GA4 1.67 - Fix "only show when key pressed" having no effect in some cases 1.66 - Fix not working on youtube.com 1.65 - Fix typo in the api fallback 1.64 - Prevent Chrome page translation tool from translating popup (see https://github.com/facebook/react/issues/17256; thanks https://github.com/dotdioscorea) 1.63 - Fix remember language in "type and translate" popup being scoped to a particular site 1.62 - Fix translation popup sometimes not appearing 1.61 - Remember language options in "type and trasnlate" popup - Fix double translation popup showing in certain scenarious 1.60 - Remove unnecessary required "tabs" permission. 1.59 - Re-enable clients5 API (it magically started working again). But keep the fallback to rate limited API in case it breaks again. 1.58 - Fix "not working on youtube" 1.57 - Fix usage tracking - Show error in the popup when google translate API rate limit is hit 1.56 - Better usage tracking (to see how many people hit Google Translate API rate limit) - Fix chrome build (production webpack generates invalid UTF-8 build) - this time for real 1.55 - Fix chrome build (production webpack generates invalid UTF-8 build) 1.54 - Fix API url 1.52 - Works on Firefox (involved numerous cleanups) 1.49 - Show translated noun gender where applicable 1.48 - Fix hover menus closing unintentionally 1.47 - Add ability to configure font size 1.46 - remove youtube fix - it seems to be no longer required 1.45 - fix not working on youtube 1.44 - make "translate into" field look more like a required field - fix occasional exception showing up in dev tools 1.43 - Add "disable on this page" checkbox to type-and-translate popup. - Changing options no longer requires to reload pages. - Fix web components deprecation warnings. 1.42 - Change google translate API url. The old one seems to be getting blocked more and more. 1.41 - Fix regression. T&T popup wasn't showing translation. 1.40 - Optionally show "translated from" language in a popup. Because source langage autodetect often makes funny choices and then people blame TransOver for incorrect/missing translations. This will hopefully act as a hint to go and change "translate from" option from autodetect to a set language. 1.39 - Add "copy translation" feature 1.38 - Fix errors in developer console 1.37 - Add option to translate on whitelisted sites only (credit https://github.com/yamanq/translate_onhover) 1.36 - Fix "reverse translate to" dropdown not being fully populated 1.35 - Fix TTS looping when key is pressed and held 1.34 - Smaller and crispier font 1.33 - if site is added to "don't translate on these sites", don't inject template elements. So that they don't show up in OWA new email form 1.32 - attempt to fix template content being appended to contenteditable body (OWA new email form) 1.31 - fix certain sites (e.g. facebook, youtube) being subtly broken for _some_ users. By not using html imports, since Chrome appears to be buggy in that respect. 1.30 - fix selection translation appearing in the corner - fix "letter-spacing" parent style leaking into the popup - dismiss popup on scroll 1.29 - new icon - slower tts - inner refactoring: iframes -> web components 1.28 - use Speech Synthesis API for text-to-speech 1.27 - add "from" to type-and-translate popup - don't use chrome.tts. Like ever again 1.26 - use chrome.tts api 1.25 - get back "Translate from" option 1.24 - fix exception showing up in js console 1.23 - fix showing only first sentence of selection translation 1.22 - fix hotkey setup - less ugly "type and translate" popup - better way to figure out unsuccessful translation 1.21 - support new google api 1.20 - configurable tts key 1.19 - rollback z-index increase - previous value was the correct maximum 1.18 - max z-index so that popup always stays on top 1.17 - revert "cache regexp" optimization 1.16 - don't use chrome.tts 1.15 - count apostrophes as word characters. So that d'abord, don't, etc. get proper translation. - fix tts 1.14 - skip editable divs (fixes google+, youtube, etc. comments) 1.13 - redirect to options after install 1.12 - fix tts for "type and translate" 1.11 - fix occasional exception in chrome js console 1.10 - fix xss security issue 1.9 - allow disabling reverse translate if "translate from" is chosen 1.8 - add option to choose show popup trigger (previously, 'alt' was the only option) 1.7 - fix large selection translation not getting proper height 1.6 - fix broken single word translation 1.5 - only show type-and-translate popup in top frame (so that bits of it do not show up in facebook, g+ buttons) - upgrade jquery to get rid of source map exception in dev console 1.4 - fix broken tts for multiword translation - better "don't translate clicking links" 1.3 - don't translate when clicking on links 1.2 - track source langage properly 1.1 - add google analytics 1.0 - better popup implementation (possibly fixes wrong popup size) - smaller dependencies 0.44 - fix "choose target lang" broken link 0.43 - fix missing icons 0.42 - improve popup layout in g+ - smaller package (so it installs faster) 0.41 - fix tts 0.40 - fix broken popup layout on latest chrome and chromium 0.39 - fixed major brokenness caused by google api changes - add option to only translate selection when alt pressed - add reverse translate when 'autodetect from word' is chosen 0.38 - translate all frames 0.37 - make 'Oops.. no translation' optional 0.36 - better ignore editable divs 0.35 - fix tts not working for type and translate mode 0.34 - ignore gmail and g+ editable divs 0.33 - button for 'type and translate' popup - popup more resilient to current page style (been moved to iframe) 0.32 - set text direction right-to-left for Arabic, Hebrew, Persian, Urdu and Yiddish - save options on Enter 0.31 - only offer to choose language once (per page load) 0.30 - change default autodetect method from locale to word 0.29 - add Esperanto 0.28 - translate in a popup 0.27 - fix broken translation for text that contains regex special characters: ), $, etc. 0.26 - bring back 'translate from' option 0.25 - reverse translate - reliable source language autodetect; as a result, getting rid of manual source language option - 'do not translate on sites' option is less confusing 0.24 - change 'translated only if X pressed' from 'shift' to 'alt' 0.23 - make Text-To-Speech optional and disabled by default 0.22 - expose 'translate from' option - redesign options page to hide advanced options behind separate link 0.21 - text to speech on ctrl press 0.20 - jquery updated to 1.7.1 0.19 - fix adjustment for parent font-size going not quite as planned 0.18 - fix translating wrong word (not the one behind cursor) in rare cases (that was due to * style font-size being different from element font-size) - hit between the lines confuses javascript getElementFromPosisition, resulting in visibly broken html after translation. Fixed. 0.17 - ignore mouse 'noise' movements (so popup does not flicker) - enable 'delay' option only when 'translate by point at word' and not 'shift only' - fixed unescaped html. again. 0.16 - 'translate by click' option added - fixed performance issue on pages with large text nodes 0.12 - selection translation popup no longer shows up anywhere on the page (#17) 0.11 - updated available languages 0.10 - gotten rid of calls to Google Translate API (since it is deprecated) 0.9 - proper cased (as opposed to always lower case) translation (#16) - make sure translation popup doesn't get out of the window (#14) 0.8 - more prominent translation popup (#13) - no longer attempts to translate selection in text inputs (#12) 0.7 - translation no longer changes styles of underlying text (#11). Thanks to Dmitriy Kostikov for pointing in the right direction 0.6 - no more explicit 'translate from' option - autodetect is good enough. Also fixes #8 - fixed: erases closing tag on html/xml listing (#6) - fixed: part of speech is now bold on every page (#9) 0.5 - text selection translate (#4) - fixed: drops text selection (#7) 0.4 - report translation fail. As opposed to simply not showing anything to user - hide translation on page scroll - prompt user to choose target language, in case it isn't set. Useful for new installs - source language is now a configurable option (defaults to 'autodetect') - translation delay is now configurable option - remove "don't translate from these languages" option - gotten rid of explicit api call to detect language. Turns out dictionary api can do it itself. - popup fadeIn/fadeOut. As opposed to hide/show 0.3 - reduced delay before translation start