# deepl-quick
**Repository Path**: geekkkk404/deepl-quick
## Basic Information
- **Project Name**: deepl-quick
- **Description**: 贴在屏幕边缘的 DeepL 翻译小窗 / A pill-style DeepL translator widget for Windows — single-file, zero-dependency, fully local
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2026-11-14
- **Last Updated**: 2026-11-18
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# deepl-quick
> 一枚贴在屏幕边缘的「译」胶囊 —— DeepL API 驱动的桌面翻译小窗:自动检测源语言、多语言一键复制、纯本地、零依赖。
> A tiny pill that sits quietly at the edge of your screen — a DeepL-powered translator widget for Windows. Pure tkinter, zero dependencies, fully local.
平时缩成一枚胶囊
,悬停即展开 —— 看不懂 → 拿走译文,呼吸之间
    
当前版本:**v0.3.9** ・ License:[MIT](LICENSE)
[中文](#-中文) ・ [English](#english)
---
## 🇨🇳 中文
### 这是什么
`deepl-quick` 是一款 Windows 桌面翻译小窗:平时缩成一枚「译」胶囊贴在屏幕右缘,鼠标移上去即展开;粘贴或输入任意文本,DeepL 自动检测源语言,把译文同时翻成你勾选的几门常驻语言,逐语种一键复制。呼吸之间完成「看不懂 → 拿走译文」。
同门项目:[QuadTodo](https://github.com/geekkkk404/quad-todo)(四象限待办小窗)—— 同一套「单文件、零依赖、纯本地」的打法。
### 特性
- **贴边药丸常驻**:鼠标离开约 0.75s 自动折叠成 39×30 胶囊,悬停展开、静止不弹跳、拖动中不折叠;窗口位置与药丸位置均有记忆;后台轮询自动重申置顶(含深度自愈:即便置顶标志位残留为「开」,只要窗中心命中测试被普通窗口赢走,即重排置顶带序并落取证日志)并把窗口夹回屏内(分辨率变化 / 睡眠唤醒 / RDP 重连自愈),运行痕迹落 `%TEMP%\dq_exit.log` 可事后排查
- **开机自启(可选)**:设置弹窗勾选即写 HKCU Run 键(免管理员),登录后直接缩成贴边药丸;Windows 任务管理器「启动应用」可随时停用;自带单实例保护,不会叠出两枚药丸
- **看门狗保活(可选)**:设置勾选即注册 Windows 计划任务(免管理员),进程意外死亡(如待机转换中被外部硬杀)后自动拉起——每 30 分钟兜底 + 待机唤醒即时检查;主动 ✕ 关闭不会被拉活(尊重用户意图);任务在「任务计划程序」的 `\deepl-quick\watchdog` 透明可见,取消勾选即注销;拉活判据复用取证日志(`exit: clean` = 用户关闭,不拉活)
- **自动检测源语言**:无需选择源语言,DeepL 返回检测结果并显示在界面上
- **常驻目标语言**:默认英/日/中,可从完整语言清单勾选(上限 16 个);清单支持在线刷新(DeepL 现已支持 111 门目标语言),DeepL 新增语言不用升级本工具;语言名以原生名显示(日本語 / Deutsch / Français…);已选语言即结果卡片列表本身,点卡片头部「×」移除、「⏸」临时停用(本次不翻译、不扣额度,点「▶」恢复,清单不丢)
- **界面多语言**:界面自动跟随 Windows 系统语言(中文 / English),可在设置中强制指定,切换即时生效
- **逐语种一键复制**:每张译文卡片独立复制;「复制全部」按【语言】前缀合并
- **长译文完整展示**:卡片高度随译文自适应(窗口缩放后自动重排),长译文完整展开,配合列表滚动 / 拖高窗口查看——不再固定两行截断
- **省额度三件套**:翻译缓存(同文本同语言命中零消耗)、用量仪表(80%/95% 变色预警)、目标语懒加载;临时停用目标语(卡片头部「⏸」)可直接砍掉本次不需要的语种消耗
- **本地翻译历史**:可在设置中关闭或一键清空;双击历史条目回填原文
- **高质量模式**:可选 DeepL 下一代模型(`quality_optimized`),不额外消耗额度
- **纯本地、零依赖**:密钥、历史、缓存全部只存本机;可选「重启时清空缓存 / 历史」隐私开关;Python 3.8+ 标准库即可运行(tkinter + urllib),空闲内存 ~30 MB
### 下载
**绿色免安装包已就绪**:到 [Releases 最新版](https://github.com/geekkkk404/deepl-quick/releases/latest) 下载 `deepl-quick-vX.Y.Z-win64-portable.zip`(文件名带版本号,以 latest 页为准),解压后双击 `deepl-quick.bat` 即可——包内自带 Python 运行时,无需安装任何东西。也可从源码运行:装好 Python 3.8+,下载本仓库,双击 `deepl_quick.pyw`(见下)。
### 快速开始
1. **拿一把 DeepL API key**:在 [DeepL 官网](https://www.deepl.com/pro#api) 注册 Developer 计划(免费;新账号含 1,000,000 字符一次性额度;存量 API Free 订阅为 500,000 字符/月)。创建 key 后复制备用。
2. **运行**:双击 `deepl_quick.pyw`(需已安装 Python 3.8+,无需 pip 安装任何东西)。
3. **贴 key**:首次启动点标题栏「设」,粘贴 key,保存。key 只会写进脚本同目录的 `.deepl-key` 文件。
4. 鼠标碰到药丸展开,输入文本,`Ctrl+Enter` 翻译。
### 使用
| 操作 | 方式 |
|------|------|
| 翻译 | `Ctrl+Enter` 或点「翻译」 |
| 复制某门语言 | 该卡片右上角「⧉」 |
| 复制全部译文 | 「复制全部」 |
| 增删常驻语言 | 「+语言」勾选;卡片头部「×」移除 |
| 临时停用某语言(省额度) | 卡片头部「⏸」停用、「▶」恢复(仅本会话有效) |
| 历史 | 标题栏「史」,双击条目回填原文 |
| 设置(key / 高质量模式 / 历史开关 / host / 开机自启 / 看门狗保活 / 界面语言) | 标题栏「设」 |
| 折叠 / 展开 | 标题栏「—」;或鼠标离开 / 悬停自动 |
| 拖动 / 调整大小 | 拖标题栏;右下角「◢」 |
| 置顶开关 | 标题栏「钉」(绿=开) |
### 隐私
- **API key 只存本机** `.deepl-key`(已在 `.gitignore`,永不入库、永不随包分发)
- **无遥测**:唯一的网络请求是直连 DeepL 官方 API(免费档 `api-free.deepl.com`)
- **历史与缓存纯本地**(`history.json` / `cache.json`),可在设置里关闭、清空
- 翻译内容只会发给 DeepL——这是它的工作方式
### 已知限制
- 界面语言提供中文与英文;其他语言的系统会回落到英文界面
- 阿拉伯语 / 希伯来语等从右到左(RTL)书写的译文正常显示,但界面本身不支持 RTL 布局
- 语言选择器中,内置 35 门常用语言以原生名显示;在线刷新拉到的其余语言显示 DeepL 返回的英文名
- 隐私边界(本地文件之外的平台固有暴露面,工具无法代管):①复制的译文会进 Windows **剪贴板**——若开启了剪贴板历史(Win+V)与跨设备同步,内容会被微软侧保存/同步,敏感译文建议在系统设置关闭该功能;②原文/译文驻留内存,睡眠/**休眠**时随 RAM 落盘(hiberfil.sys/页面文件);③源文本必然经过 DeepL 服务端(API 固有)。本工具本地落盘的用户文本仅 `cache.json` 与 `history.json` 两处,可在设置中开启「重启时清空」或在弹窗中手动清空
### 额度说明
计费按**源文本字符数**:同一段文本翻 3 门语言 = 3 次请求 = 3 倍字符。本工具为此内置:缓存优先(命中零消耗)、默认手动触发(防抖自动翻可开)、每次翻译前显示预估消耗、卡片头部「⏸」临时停用本次不需要的语种、额度耗尽(HTTP 456)明确提示不再重试。
### 自检
```bash
python deepl_quick.pyw --smoke
```
78 项自检全部离线运行(数据文件重定向到临时目录、注册表读写走 scratch 键、计划任务 roundtrip 走 scratch 任务名且不武装触发器,不发任何网络请求)。
### License
[MIT](LICENSE)
---
## English
### What is this
`deepl-quick` is a tiny translator widget for Windows: it normally shrinks into a single-character 「译」pill docked at the right edge of your screen. Hover to expand, paste any text, and DeepL auto-detects the source language while translating into your pinned target languages at once — each result one click away from your clipboard.
### Features
- **Edge pill, always resident** — auto-collapses (~0.75s) to a 39×30 pill when the mouse leaves; hover to expand; no bounce while idle, no collapse while dragging; both window and pill positions are remembered; the background poll re-asserts always-on-top — including a deep self-heal where a center hit-test that loses to an ordinary window triggers a band re-assert plus a forensic log line, even when the topmost flag still reads "on" — and keeps the window inside the screen (self-heals after resolution changes / sleep-resume / RDP reconnects); runtime trace goes to `%TEMP%\dq_exit.log` for post-mortem checks
- **Optional auto-start** — tick it in settings to register an HKCU Run key (no admin needed); the pill docks itself at login; disable anytime from Task Manager → Startup apps; single-instance guard included
- **Keep-alive watchdog (optional)** — tick it in settings to register a Windows scheduled task (no admin needed); after an unexpected process death (e.g., hard-killed during a power transition) the pill is revived automatically — a 30-minute safety net plus an instant check on standby resume; deliberately closing the window (✕) is respected and never revived; the task is visible and removable in Task Scheduler under `\deepl-quick\watchdog`; the revive decision reuses the forensic log (`exit: clean` = user closed → don't revive)
- **Auto source detection** — no language picking; DeepL returns the detected language and the UI shows it
- **Pinned target languages** — EN/JA/ZH by default, pick from the full language list (up to 16); the list can be refreshed online (DeepL currently serves 111 target languages), so new DeepL languages appear without upgrading this tool; languages are shown by their native names (日本語 / Deutsch / Français…); the card list itself shows which languages are pinned — temporarily pause one with "⏸" on its card header (skipped this round, costs nothing; "▶" restores it, the pinned list never changes), remove with "×"
- **Multilingual UI** — the interface follows your Windows system language (Chinese / English), and can be pinned to either in Settings; switching applies instantly
- **One-click copy per language** — each card copies independently; "copy all" merges with language-name prefixes
- **Full-length output** — card heights auto-fit their translation (re-fitting on window resize); long translations expand in full with list scrolling / window resizing — nothing is clipped to two fixed lines anymore
- **Quota-friendly trio** — translation cache (cache hits cost nothing), usage badge (amber ≥80%, orange ≥95%), per-request cost estimate before translating; temporarily pause languages you don't need this round with the card-header "⏸"
- **Local history** — toggleable and clearable in settings; double-click an entry to refill the source text
- **High-quality mode** — optionally uses DeepL's next-gen model (`quality_optimized`) at no extra quota cost
- **Fully local, zero dependencies** — key, history and cache never leave your machine; optional "clear cache / history on restart" privacy switches; runs on the Python 3.8+ standard library only (tkinter + urllib); ~30 MB idle memory
### Download
**A portable no-install package is ready**: download `deepl-quick-vX.Y.Z-win64-portable.zip` from the [latest release](https://github.com/geekkkk404/deepl-quick/releases/latest) (the filename carries the version; the latest page is authoritative), extract, and double-click `deepl-quick.bat` — the Python runtime is bundled, nothing to install. Or run from source: install Python 3.8+, grab this repo, and double-click `deepl_quick.pyw` (see below).
### Getting started
1. **Get a DeepL API key**: sign up for the free Developer plan at [deepl.com/pro#api](https://www.deepl.com/pro#api) (new accounts include a one-time 1,000,000-character quota; legacy API Free subscriptions get 500,000 characters per month). Create and copy a key.
2. **Run**: double-click `deepl_quick.pyw` (requires Python 3.8+; nothing to pip-install).
3. **Paste the key**: click 「设」 in the title bar on first launch, paste, save. The key is stored only in the local `.deepl-key` file next to the script.
4. Hover the pill to expand, type, press `Ctrl+Enter`.
### Privacy
- **The API key stays on your machine** (`.deepl-key`, git-ignored, never committed or shipped)
- **No telemetry** — the only network traffic is your own translation requests to DeepL's official API (free tier: `api-free.deepl.com`)
- **History and cache are local files** (`history.json` / `cache.json`), toggleable and clearable in settings
- Your text goes to DeepL — that's the job
### Known limitations
- The UI ships in Chinese and English; other system languages fall back to English
- RTL scripts (Arabic, Hebrew…) display fine as translation output, but the UI itself does not mirror
- In the language picker, the 35 built-in languages show native names; the rest of the online list shows DeepL's English names
- Privacy boundary (platform-inherent exposures beyond local files, which no widget can manage for you): ① copied translations land in the Windows **clipboard** — with clipboard history (Win+V) and cross-device sync enabled, Microsoft keeps/syncs the content; disable it in system settings for sensitive text; ② source/translation text lives in memory and spills to disk (hiberfil.sys / pagefile) on sleep/**hibernation**; ③ source text necessarily transits DeepL servers (inherent to the API). Locally, the only files persisting user text are `cache.json` and `history.json` — enable the "clear on restart" switches or clear them from Settings
### Quota notes
Usage is counted in **source characters**: translating one text into 3 languages = 3 requests = 3× characters. This tool therefore ships with: cache-first requests (hits cost nothing), manual trigger by default (debounced auto-translate is optional), a per-request cost estimate, a card-header "⏸" to pause languages you don't need this round, and a clear stop on quota exhaustion (HTTP 456).
### Self-test
```bash
python deepl_quick.pyw --smoke
```
78 offline checks (data files go to a temp directory, registry writes go to a scratch key, the scheduled-task roundtrip uses a scratch task name without arming triggers; no network requests).
### License
[MIT](LICENSE)