nicearrack/dsh-translator 预览 preview

nicearrack/dsh-translator

基于 DSH 的有道风格划词翻译:划选即现「译」按钮,harness 自带大模型,零 API key / Youdao-style word-selection translation for DSH: select text, click 「译」, powered by the harness's own LLM, no API keys

项目介绍Project Overview

dsh-translator 是 DSH 的划词翻译插件:在消息、侧栏或输入框选中文本,点击浮动「译」按钮,即由 harness 已配置的 LLM 给出翻译卡片,无需额外 API 密钥;支持自动方向、主语言设置、模型与推理强度配置、拖拽、置顶、复制、重试及流式内容。适合在 DSH 内随时翻译对话或界面文本。注意翻译仍走你配置的模型管线,会产生相应 token 消耗。

dsh-translator is a DSH plugin that adds Youdao-style word-selection translation. Select text in messages, the sidebar, or inputs, click the floating “译” button, and get a translation card powered by the harness’s configured LLM—no extra API keys. It supports automatic direction, primary-language and model settings, reasoning effort, dragging, pinning, copy, retry, and streaming-safe display. Use it for quick in-app translation. Caveat: requests still use your configured model pipeline and consume tokens.

或使用命令行安装(适合开发者)Or use CLI install (for developers)

命令行安装CLI Install

dsh plugin --profile web add github:nicearrack/dsh-translator

nicearrack/dsh-translator 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-translator

Youdao-style word-selection translation for DeepSeek Harness (DSH).

Select any text — a conversation message, the sidebar, an input field — and a floating 「译」 button appears at the selection's top-right corner. Click it to get a translation card. Translations are produced by the harness's own LLM: no API keys, no third-party endpoints, your selected text never leaves the model pipeline you already configured.

English 中文 README

Usage

Select text → click the 「译」 button → the translation card appears. Drag the card by its header to move it, or pin it so it can't be dismissed by accident. Click the translation (or the source text, or an error message) to copy it. The card's footer shows the translation direction, the model, the reasoning effort, and the token consumption.

Features

  • Word-selection trigger anywhere in the app; floating button follows the selection, theme-aware (light/dark)
  • Automatic direction: text in your configured primary language → English; anything else → the primary language
  • Primary language configurable: 简体中文 / 繁體中文 / 日本語 / 한국어 / Русский (default 简体中文)
  • Config card in DSH settings (Settings → Plugins → 划词翻译): primary language, model (pick one, or leave it empty to follow the session default), reasoning effort (off/low/high/max), timeout, max tokens, temperature — each field shows "overridden / restore default", with staged edits and save/discard
  • Translation card: source, direction badge, result, retry on failure; the footer shows model · reasoning effort · tokens
  • Click to copy: translation, source text, or error message — with a "已复制 / Copied" hint
  • Draggable card: drag it by its header; it stays where you put it
  • Pinnable card: locks drag, Esc and click-outside until you close it — one card at a time, no nesting
  • Streaming-robust: works on live streaming output (no flicker), and the card stays put when the content scrolls

Screenshots

Select text → the floating 「译」 button appears at the selection's top-right corner:

Selecting text and the 译 button

Click it → the translation card opens (English → Chinese):

Translation card EN → ZH

Chinese → English direction is automatic:

Translation card ZH → EN

Configure it in DSH settings → Plugins → 划词翻译:

Plugin configuration card

Full workflow — select, translate, drag, pin, close:

Demo recording

Install

From npm:

dsh plugin --profile web add @nicearrack/dsh-translator@latest

From a local checkout:

dsh plugin --profile web add /path/to/dsh-translator

From git:

dsh plugin --profile web add github:nicearrack/dsh-translator

Git installs run the package's prepare build script. pnpm ≥ 10 requires one-time authorization: add allowBuilds: { "@nicearrack/dsh-translator": true } to the profile's pnpm-workspace.yaml if the first install is refused.

Update

# update to the newest release
dsh plugin --profile web update @nicearrack/dsh-translator

# or pin a specific version
dsh plugin --profile web update @nicearrack/dsh-translator@0.2.0

Fresh releases: npm registry metadata can lag after a publish (a few minutes, occasionally longer). If @latest still resolves to an older version, pin the exact one — @nicearrack/dsh-translator@0.2.0 — or check npm view @nicearrack/dsh-translator versions.

After updating, restart the DSH instance (dsh --profile web) so the new host bundle loads; the client bundle picks up on the next page refresh.

Uninstall

dsh plugin --profile web remove @nicearrack/dsh-translator

Restart the instance (dsh --profile web) for the removal to take effect.

License

MIT

上一个 Prev dsh-sound-alerts 下一个 Next luxueliu-usage-command