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
@@ -156,6 +156,56 @@ pub(super) fn run_translation_set(options: &CliOptions) -> anyhow::Result<()> {
)
}
pub(super) fn run_translation_get(options: &CliOptions) -> anyhow::Result<()> {
let path = options
.translation_file
.as_ref()
.ok_or_else(|| anyhow::anyhow!("i18n get 必须指定 --translation-file"))?;
let entry_id = options
.translation_id
.as_deref()
.ok_or_else(|| anyhow::anyhow!("i18n get 必须指定 --translation-id"))?;
let entry = get_translation_entry(path, entry_id)?;
let data = serde_json::json!({
"translation_file": path,
"entry": entry,
});
print_report(
options.output_format,
&CommandReport {
command: "translation-get",
status: "ok",
message: "翻译工作台条目已读取",
data,
},
)
}
pub(super) fn run_translation_unset(options: &CliOptions) -> anyhow::Result<()> {
let path = options
.translation_file
.as_ref()
.ok_or_else(|| anyhow::anyhow!("i18n unset 必须指定 --translation-file"))?;
let entry_id = options
.translation_id
.as_deref()
.ok_or_else(|| anyhow::anyhow!("i18n unset 必须指定 --translation-id"))?;
let entry = unset_translation(path, entry_id)?;
let data = serde_json::json!({
"translation_file": path,
"entry": entry,
});
print_report(
options.output_format,
&CommandReport {
command: "translation-unset",
status: "updated",
message: "翻译工作台条目已恢复为未审核",
data,
},
)
}
pub(super) fn run_translation_task_update(options: &CliOptions) -> anyhow::Result<()> {
let task_id = options
.query_task_id