feat(bat): 补全翻译工作台编辑命令
bat-rust / Build and test Rust (push) Canceled after 0s
bat-rust / Build and test Go API (push) Canceled after 0s

Refs #43
This commit is contained in:
2026-08-12 09:33:14 +08:00
parent 974a6e18c3
commit 550ee7fd9a
10 changed files with 336 additions and 20 deletions
+20 -1
View File
@@ -89,7 +89,26 @@ bat i18n set \
--translated-text '中文文本'
```
也可以使用 `--translated-file` 读取 UTF-8 文本。工作台会保存 source text、release ID、TextUnit 目标和人工译文;发布前会重新读取当前 TextUnit 索引,拒绝过期 release、source text 或 patch 目标。
也可以使用 `--translated-file` 读取 UTF-8 文本。需要复核单条内容时:
```bash
bat i18n get \
--translation-file /tmp/bat-workbench.json \
--translation-id <text-unit-id> \
--json
```
需要把某条译文恢复为未审核状态时:
```bash
bat i18n unset \
--translation-file /tmp/bat-workbench.json \
--translation-id <text-unit-id>
```
这些工作台操作也可以写成 `bat i18n workbench set|get|unset|validate ...`
工作台会保存 source text、release ID、TextUnit 目标和人工译文;发布前会重新读取当前
TextUnit 索引,拒绝过期 release、source text 或 patch 目标。
发布前可只做工作台审计:
+1 -1
View File
@@ -294,7 +294,7 @@ issue 43 例外说明:新增的 `parse repack` 只编排已有 TextAsset、Typ
- `translation-tasks.sqlite``schema_migrations` 管理 durable task state、attempt count、provider run ID 和 failure reason;重复同步会保留已有 worker 状态。
- `translation.tasks` RPC/CLI 优先查询 `translation-tasks.sqlite`,旧 release 没有状态库时回退到 `official-textunit-tasks.json`;返回队列 `status`、worker `task_status`、failure reason 和时间/尝试次数。
- `translation.task.update` 已提供 queued/running/failed/completed/skipped 状态回写契约,并已通过 `bat i18n task update`、Go typed helper 和 bat-api 鉴权控制面暴露;provider worker 可在消费 handoff 后按 task_id 更新并由同一查询接口反查。
- `i18n validate` 可在发布前校验工作台 release、source text、重复 patch 目标,并区分可直接发布的 TextAsset 与必须进入 `parse repack` 的条目;`parse clear-cache` 只删除可再生解析/队列 JSON,保留 `translation-tasks.sqlite` 的 worker 状态。
- `i18n get/set/unset` 可查看、修改或清空单条工作台译文,`i18n validate` 可在发布前校验工作台 release、source text、重复 patch 目标,并区分可直接发布的 TextAsset 与必须进入 `parse repack` 的条目;`parse clear-cache` 只删除可再生解析/队列 JSON,保留 `translation-tasks.sqlite` 的 worker 状态。
- 真实 Crowdin 网络 worker、翻译记忆和完整 localized repack 仍属于后续翻译系统工作,不在当前 Rust 离线状态仓储范围内。
验收: