kiss-translator README

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

KISS Translator 简约翻译

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

GitHub Release License: GPL-3.0 PRs Welcome

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

kiss-translator.webm

感谢以下赞助商对本项目的支持

APIMart 是专注 AI 图片/视频生成的低价 API 平台,GPT-Image-2 低至 $0.006/张,1 美元可出图 160+ 张。图片、视频一套异步 API 通吃,提交任务拿 ID、回调取结果,跑批万张不超时、换模型不改代码。按量付费、无月费,通过此注册链接注册即可开用。
ePhone AI 是一个面向开发者的 AI 模型 API 中转与聚合平台,支持 OpenAI、Claude、Gemini、DeepSeek、GLM 等多家大模型。

功能概览

提示:本文档对应当前分支代码,新增功能(接口插件、本地 AI、文件翻译及剪贴板自动翻译等)目前面向 Chrome/Edge、Firefox 扩展版本提供,油猴脚本及其他客户端暂不包含这些入口。具体 AI 能力取决于所用浏览器、设备硬件及所选模型。

翻译场景与交互

服务配置与接口插件

本地 AI(边缘端计算)

文件翻译

规则、设置与同步

快速上手

基础使用(3 步极速上手)

  1. 添加翻译服务:打开扩展设置中的「服务配置」,添加所需内置服务,填写 API 地址、API Key 和模型名称,点击「测试」确认可用后保存。
  2. 场景关联服务:在「场景设置」中(网页翻译、划词查词、输入框翻译或字幕翻译)勾选对应服务(仅具备对应能力的服务会出现在列表中);可在「提示词管理」中定制 Prompt 模板。
  3. 启动翻译体验:点击网页浮动图标或使用快捷键 Alt+Q 启动网页翻译;使用 Alt+D 打开独立窗口可同时对比多个服务的翻译质量。

进阶功能上手

安装

建议优先使用浏览器扩展:

  • 浏览器扩展提供更完整的能力(本地语言识别、独立窗口、文件翻译、本地 AI、右键菜单等)。
  • 油猴脚本受浏览器沙箱限制,缺少扩展专有 API,且可能遇到跨域或脚本管理器兼容性问题。

浏览器扩展

油猴脚本

关联项目

常见问题

如何设置自定义快捷键?

由于浏览器快捷键管理的限制,需要在浏览器内置的管理页中进行设置:

翻译规则的生效优先级是怎样的?

规则按照以下层级覆盖生效: 个人规则 > 订阅规则 > 全局规则(全局规则作为基础默认配置)。

如何在网页上可视化编辑规则?

  1. 打开网页翻译面板,点击「编辑网站规则」,选择规则用途(如翻译目标、排除区域、保留原文等)。
  2. 在网页上点击目标元素,或手动输入 CSS 选择器。支持调整祖先路径层级、对比定位候选并实时查看匹配元素数量。
  3. 草稿机制:所有的修改、删除与撤销/重做均仅保存在临时草稿中;点击「保存规则」后才会真正写入并触发数据同步。「预计翻译范围」仅对当前已加载的 DOM 节点进行高亮预览,不向翻译服务发送请求。
  4. 继承与重置:「恢复此组继承」将重新沿用订阅或全局规则;「清空此组」设置显式空值(清空根容器将不再扫描整页)。
  5. 注:可视化选取目前支持桌面端标准 DOM 页面,暂不支持 iframe 内部嵌套、Shadow DOM 内部、Canvas 渲染文本及触屏手势。

服务测试失败怎么办?

为什么在设置中找不到本地 AI、文件翻译或接口插件入口?

油猴脚本如何访问外部服务及进入设置页?

未来规划

本项目为业余开源项目,无严格发布时间表,非常欢迎社区共建与提交 PR!

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

开发指引

文档与协作导航:开发者指南 | 系统架构 | 贡献指南 | 行为准则 | 安全策略 | 更新日志 | AI 协作指南 | 文档总目录

本地编译与调试

环境要求:Node.js >= 20(推荐 Node 22/24),pnpm >= 9

# 1. 克隆代码并切换至 dev 分支
git clone https://github.com/fishjar/kiss-translator.git
cd kiss-translator
git checkout dev # 提交 PR 建议基于 dev 分支

# 2. 安装依赖
pnpm install

# 3. 常用开发与构建命令
pnpm build:chrome      # 构建 Chrome/Edge 扩展(输出至 build/chrome)
pnpm build:firefox     # 构建 Firefox 扩展(输出至 build/firefox)
pnpm start             # 启动 Web 端本地开发调试(http://localhost:3000)
pnpm check:pr          # 提交 PR 前代码格式化与构建自检
pnpm build             # 全量打包构建所有平台

在浏览器中加载扩展(以 Chrome / Edge 为例)

  1. 打开浏览器并访问 chrome://extensions(Edge 访问 edge://extensions)。
  2. 开启页面右上角或侧栏的 「开发者模式」。
  3. 点击 「加载已解压的扩展程序」,选择项目根目录下的 build/chrome 目录。
  4. 修改代码后重新执行 pnpm build:chrome,并在扩展管理页点击对应卡片的刷新按钮即可生效。

插件开发请阅读 插件开发指南,并参考 OpenAI 兼容协议插件 或 DeepSeek 插件。

如需通过外部网页脚本、书签脚本或鼠标手势触发翻译,请参阅 开发者指南 - 外部事件触发接口。

交流

赞赏

如果您觉得 KISS Translator 对您有所帮助,欢迎赞赏支持作者继续维护!

appreciate

kiss-translator (fishjar/kiss-translator)

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
42.4 MB
Stars
13.4K
Age
3y
Commits · 90 Days