Skip to main content
S

dsh-hwp-translate

sanshui258/dsh-hwp-translate

Translates .hwp/.hwpx (Hangul) documents into Chinese while keeping tables, bullets and indentation. Registers two offline tools: hwp_extract returns the document segments as JSON, and hwp_apply writes {segment id: translation} back and returns the output path. Translation is done by the session model, so no API key is needed; the translator ships inside the package. Windows only; legacy .hwp needs Hangul installed, .hwpx does not.

Install

dsh plugin --profile web add github:sanshui258/dsh-hwp-translate

README

dsh-hwp-translate

DSH 插件:把 .hwp / .hwpx(한글)文档翻成中文,保留表格、项目符号与缩进。

不需要任何 API Key:翻译由当前会话的模型完成,插件只负责本地抽取与写回。

三个工具

工具作用联网
hwp_extract(path, offset?, limit?)抽取待翻段落(id + 原文)否
hwp_apply(path, translations, out_dir?)把 {id: 译文} 写回文档否
hwp_translate(path, target?, out_dir?)旧接口:让 exe 自己调 API(需自带 Key)是

典型用法(模型自动完成)

用户:把 D:\资料\행정절차.hwpx 翻成中文

1. hwp_extract → 4 段韩文
2. 模型自己翻译成中文
3. hwp_apply({"1": "专业体验活动照片", ...}) → 输出 D:\资料\행정절차_zh.hwpx

分页:hwp_extract 返回 next_offset,用它继续取下一页; 写回后返回值里的 missing 是没交回的 id。

前置

  • Windows;
  • 翻译旧版 .hwp 还需要本机 한글(HWP)(写回走 COM);.hwpx 不需要;
  • 不需要 API Key、不需要另装 Yeobaek——翻译器随包分发(bin/HWP_Translator.exe,16.8 MB)。

安装

在 DSH 的插件安装界面安装,或:

dsh plugin --profile web add github:Sanshui258/dsh-hwp-translate

离线命令行(不经 DSH 也能用)

HWP_Translator.exe --file 文档.hwpx --extract-json segments.json
HWP_Translator.exe --file 文档.hwpx --apply-json translations.json --output-dir out

已知限制

  • 仅 Windows;.hwpx 纯 Python,.hwp 需要本机 한글;
  • 长文档要分页抽取(每页默认 50 段);
  • 旧接口 hwp_translate 仍需用户自己的 API Key,仅为兼容保留;
  • 许可证:本插件 MIT;随包翻译器为个人非商业使用许可。

Related plugins