前言¶
DSH 插件生态里,文本翻译不能只靠模型直接处理原始文件。游戏脚本里常见颜色、换行、变量占位符,字幕和长文档又往往条目很多。直接翻译容易破坏 \c[1]、{player}、SRT 时间轴等结构。
dsh-plugin-text-translation 给 DSH Agent 提供一组可调度工具:先检查文件,再提取可翻译文本并遮罩标签,最后把翻译结果无损回填到原格式。翻译编排仍由 DSH Agent 完成,插件负责提取与装配。
这是什么¶
dsh-plugin-text-translation 是 DeepSeek Harness(DSH)的文本与文档翻译插件,仓库 owner 为 1738348785,许可证为 MIT,package.json 版本为 1.0.0。
它面向游戏脚本与长文档本地化,提供标签防爆遮罩、多格式文本提取/切片、无损回填组装能力。实测环境为 DSH 0.1.0-rc.6,headless 与 web profile 均已验证。
它不是完整翻译系统:翻译本身由 DSH Agent 编排完成,可配合 DSH subagent / subagent_fork / workflow 并行翻译批次;插件负责提取与装配两个环节。
核心功能¶
标签防爆遮罩¶
插件自动识别并保护常见本地化标签与占位符,翻译后还原:
- RPG Maker:
\c[1]、\v[1]、\n - Unity/RichText:
<color>、<b> - 变量占位符:
{player}、{0}、%s - Ren’Py 标签
支持格式¶
游戏脚本:
- Mtool JSON
- Translator++ XLSX/CSV
- Ren’Py
.rpy - SRT/ASS/VTT 字幕
- Gettext
.po
长文档:
- Word
.docx - Markdown
- HTML
- TXT
DSH 集成¶
- 注册
inspect_text_file、extract_text、assemble_text三个工具。 - 导出
dsh.bundleManifest,并随dsh plugin安装加入 profile 的 bundle 层。 - Python 引擎随插件分发,安装即用且无外部路径依赖。
- 可选依赖未安装时,仅对应格式或独立 LLM 流水线功能报错,其余功能不受影响。
运行时 peerDependencies 包括:
{
"@deepseek-ai/cordis": "^4.0.1",
"@deepseek-ai/dsh-tools": "^0.1.0-rc.6",
"@deepseek-ai/schemastery": "^3.18.1"
}
安装与启用¶
从 GitHub 安装¶
先确认目标 profile 可用,再执行:
dsh plugin --profile demo add github:1738348785/dsh-plugin-text-translation
安装后,插件会加入当前 profile 的 bundle 层。
安装到 web profile¶
如果要在 web profile 中看到该插件,安装到 web:
dsh plugin --profile web add github:1738348785/dsh-plugin-text-translation
然后重启 web 并刷新页面。
本地源码安装¶
本地源码安装/开发调试可以使用当前目录:
dsh plugin --profile demo add ./dsh-plugin-text-translation
本地路径安装可能因 pnpm 符号链接/junction 与 Node ESM 真实路径解析导致 ERR_MODULE_NOT_FOUND。Windows 下需要把依赖树以 junction 暴露给插件目录。
不安装快速调试¶
也可以只加载插件的 patch 层做快速调试:
dsh --profile demo --patch ./dsh-plugin-text-translation/cordis.patch.yml
新 profile 初始化注意¶
首次把插件装进新 profile 时,可能遇到以下两个 DSH 环境问题。
- npm registry
latesttag 可能指错@deepseek-ai/dsh-base旧版0.0.1-rc.1。需要显式指定0.1.0-rc.6。 - pnpm 11 默认阻止依赖 build scripts。遇到
ERR_PNPM_IGNORED_BUILDS时,把pnpm-workspace.yaml中allowBuilds改为true。
典型用法¶
- 调用
inspect_text_file,检查文件格式、条目数、说话人与标签分布。 - 调用
extract_text,提取可翻译文本;可传output_json与batch_size保存分块 JSON。 - 由 DSH Agent 对批次执行翻译,可借助
subagent、subagent_fork或workflow并行处理。 - 调用
assemble_text,将translations_json无损写回original_file对应格式。
适用场景与注意¶
适合在 DSH 中处理游戏脚本、字幕、PDF、Word、Markdown 等本地化文件的开发者。
注意:
- 本插件只负责提取与装配,不替代翻译模型或翻译策略。
- 插件随当前
dsh进程权限运行;安装前应检查源码、依赖和 MIT 许可证。 - 可选依赖未安装时,仅对应格式或独立 LLM 流水线功能报错,其余功能不受影响。
- 新 profile 初始化时,建议按上文检查
@deepseek-ai/dsh-base版本与 pnpm build scripts 设置。
结尾¶
dsh-plugin-text-translation 的价值在于把本地化流程里最容易出错的“标签保护、切片、回填”从模型任务中拆出来,让 DSH Agent 可以稳定地处理游戏脚本和长文档。
GitHub 仓库:
https://github.com/1738348785/dsh-plugin-text-translation
插件目录页线索:
https://www.skillhub.cn/plugins/1738348785/dsh-plugin-text-translation
该目录页 URL 来自插件线索,未作为已核实事实展开。