Skip to content

feat: 添加翻译词典#354

Open
nightt5879 wants to merge 4 commits into
buxuku:mainfrom
nightt5879:nightt5879/issue-287-translation-dictionary
Open

feat: 添加翻译词典#354
nightt5879 wants to merge 4 commits into
buxuku:mainfrom
nightt5879:nightt5879/issue-287-translation-dictionary

Conversation

@nightt5879

@nightt5879 nightt5879 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

摘要

  • 在翻译任务高级选项中新增“翻译词典”,支持按行配置 正则 -> 期望译文
  • 词典不再注入 AI prompt,而是在翻译结果写回前做确定性的 JavaScript 正则全局替换;支持普通正则和 /pattern/flags 写法。
  • 所有翻译服务的译文批次都会使用同一套正则后处理;校对页重翻译也复用该词典。
  • 新增词典解析、正则替换、无效正则忽略、字面量替换和批量后处理测试。

验证

  • npm run test:translation-dictionary
  • npm run test:translate-parser
  • git diff --check
  • npx tsc --noEmit:仍被仓库既有 docs 依赖、路径别名、jest globals、参数配置类型等问题阻塞。
  • npm run test:engines:本地 node_modules/electron 安装损坏,Electron 启动前失败。

Closes #287

@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

@nightt5879 is attempting to deploy a commit to the buxuku's projects Team on Vercel.

A member of the Team first needs to authorize it.

@nightt5879

Copy link
Copy Markdown
Contributor Author

@buxuku 我已经把这个 PR 同步到最新 upstream/main,解决了之前的 merge conflict,并保留了主线最新的字幕断句实现;词典功能仍然按原 PR 的思路保留为“翻译结果写回前的确定性正则后处理”。

本地已验证:

  • npm run test:translation-dictionary
  • npm run test:translate-parser
  • npm run check:i18n
  • git diff --cached --check(合并提交前执行)

当前 PR 上的 Vercel 仍然失败,看起来是团队授权问题,不是代码检查失败。

想请你帮忙确认一下这个功能方向:

  1. 这个翻译词典/术语表功能是否希望由我们继续推进?
  2. 如果要做,你更倾向于现在这种“翻译后正则替换”的确定性方案,还是希望改成 prompt 注入、前后处理组合,或者做成全局资源中心里的可复用词典?
  3. 如果当前 PR 变更范围太大,我也可以按你希望的方案拆小重做。

麻烦有空时给一下方向反馈,我们再按你的意见继续调整。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] A dictionary feature - translate specified words with expected results

1 participant