kiss-translator README

The project's README from github.com/fishjar/kiss-translator. As one markdown file: README.md.

KISS Translator 简约翻译

English | 中文 | 日本語 | 한국어

一个简约、开源的 双语对照翻译扩展 & 油猴脚本。

kiss-translator.webm

特性

安装

注:基于以下原因,建议优先使用浏览器扩展

  • 浏览器扩展的功能更完整(本地语言识别、右键菜单等)
  • 油猴脚本会遇到更多使用上的问题(跨域问题、脚本冲突等)

关联项目

常见问题

如何设置快捷键

在插件管理那里设置,例如:

规则设置的优先级是如何的

个人规则 > 订阅规则 > 全局规则

其中全局规则优先级最低,但非常重要,相当于兜底规则。

如何在网页上直接编辑规则

打开网页翻译面板,点击「编辑网站规则」。选择规则用途后点击「选取元素」,在网页上点击锁定元素;通过祖先路径调整层级,比较不同定位候选及匹配数量,点击「确认添加定位」加入草稿,最后点击主面板的「保存规则」保存。也可以通过「手动添加」输入 CSS 选择器。选取链接时不会跳转,右键可取消选取;副面板中的 ← / → 可按页面顺序浏览匹配元素。

当前支持桌面普通 DOM 网页及其动态内容。iframe、Shadow DOM 内部、Canvas 文字和触屏专用操作暂未纳入可视化选取。油猴同源页面通过浏览器 Web Locks 协调写入;不同源页面共享的 GM 存储没有跨源原子事务保证,编辑器会在检测到外部变更时提示重新读取。

接口(Ollama等)测试失败

一般接口测试失败常见有以下几种原因:

填写的接口在油猴脚本不能使用

油猴脚本需要增加域名白名单,否则不能发出请求。

如何设置自定义接口的hook函数

自定义接口功能非常强大、灵活,理论可以接入任何翻译接口。

示例参考: custom-api_v2.md

如何直接进入油猴脚本设置页面

设置页面地址: https://fishjar.github.io/kiss-translator/options.html

未来规划

本项目为业余开发,无严格时间表,欢迎社区共建。以下为初步设想的功能方向:

如果你对某个方向感兴趣,欢迎在 Issues 中讨论或提交 PR!

开发指引

git clone https://github.com/fishjar/kiss-translator.git
cd kiss-translator
git checkout dev # 提交PR建议推送到dev分支
pnpm install
pnpm build

外部触发示例

// `toggle_translate`   切换翻译
// `toggle_styles`      切换样式
// `toggle_popup`       打开/关闭控制面板
// `toggle_transbox`    打开/关闭翻译弹窗
// `toggle_hover_node`  翻译鼠标悬停段落
// `input_translate`    翻译输入框
window.dispatchEvent(new CustomEvent("kiss_translator", {detail: { action: "toggle_translate" }}));

交流

赞赏

appreciate

赞助商


ePhone AI
一个面向开发者的 AI 模型 API 中转与聚合平台,支持 OpenAI、Claude、Gemini、DeepSeek、GLM 等多家大模型。

kiss-translator (fishjar/kiss-translator)

chrome-extension
Searching Database…

What is this?KISS Translator is an open-source side-by-side (bilingual) web translator, shipped both as a full browser extension and as a Greasemonkey/Tampermonkey userscript, that translates web pages, input boxes, selected text, and YouTube subtitles.
Is this a browser extension, a userscript, or both?Both: it ships as a full browser extension for Chrome/Edge, Firefox, Kiwi (Android), Orion (iOS), and Thunderbird, and also as a Tampermonkey/Violentmonkey userscript. The README recommends the extension since it has fuller features like local language detection and a right-click menu.
Do I need an API key for the translation engine?It depends on which service you pick: Google, Microsoft, Tencent, and Chrome's built-in AI translation work out of the box, while AI backends like OpenAI, Gemini, Claude, Ollama, DeepSeek, DeepL, or OpenRouter require you to supply your own API key or endpoint.
Should I use the extension or the userscript, and are there catches?The userscript version is more prone to issues like CORS errors and script conflicts, and you must manually add each translation API's domain to a whitelist for it to work at all; the browser extension avoids most of this friction.
Does it translate YouTube subtitles?Yes, it can bilingually translate video subtitles with any supported translation service, using a built-in (and optionally AI-assisted) subtitle merging and sentence-splitting algorithm, with customizable subtitle styling.
Can I write custom translation rules for a specific website?Yes, a visual editor lets you pick page elements with CSS selectors (target, excluded areas, root container, etc.), or you can add selectors manually; rules can be shared and subscribed to as community rule lists, with personal rules always overriding subscribed or global ones.
Can I compare results from multiple translation services on the same page?Yes, you can open a translation popup on any page and send the same text to several configured translation services to compare the results side by side.
What do the default keyboard shortcuts do?Alt+Q toggles page translation, Alt+C switches the display style, Alt+K opens the settings popup, Alt+S opens the translate popup or translates selected text, Alt+O opens the settings page, and Alt+I translates the active input box.
Creator
fishjar
Size
30 MB
Stars
12.9K
Age
3y
Commits · 90 Days