From 6e6baf4284099891a100468b617cbcda58b646e6 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Thu, 5 Nov 2026 22:32:09 +0800 Subject: [PATCH] fix(vcs): translate the question in the add/remove to Git confirmation (#1575) The confirmation body joined the English question and the file list into one string, which never matched a catalog entry. The question is now translated on its own before the list is appended. --- src/features/vcs/confirmations.tsx | 10 ++++++++-- src/platform/locales/text/zh.json | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/features/vcs/confirmations.tsx b/src/features/vcs/confirmations.tsx index b9145ad81..66e080658 100644 --- a/src/features/vcs/confirmations.tsx +++ b/src/features/vcs/confirmations.tsx @@ -44,14 +44,20 @@ async function confirmFiles(op: FileOperation["kind"], files: string[]): Promise const root = useVcs.getState().root ?? ""; const add = op === "created"; const n = files.length; - const what = n === 1 ? "file" : `${n} files`; const list = files .slice(0, 10) .map((f) => relTo(root, f)) .join("\n"); + const question = add + ? n === 1 + ? tx("Do you want to add the following file to Git?") + : tx`Do you want to add the following ${n} files to Git?` + : n === 1 + ? tx("Do you want to remove the following file from Git?") + : tx`Do you want to remove the following ${n} files from Git?`; const r = await ask({ title: add ? "Add File to Git" : "Remove File from Git", - body: `${add ? `Do you want to add the following ${what} to Git?` : `Do you want to remove the following ${what} from Git?`}\n${list}${n > 10 ? "\n…" : ""}`, + body: `${question}\n${list}${n > 10 ? "\n…" : ""}`, checkbox: "Don't ask again", width: 480, buttons: [{ id: "ok", label: add ? "Add" : "Remove", primary: true }], diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json index cf7b1f137..944384062 100644 --- a/src/platform/locales/text/zh.json +++ b/src/platform/locales/text/zh.json @@ -6099,6 +6099,10 @@ "Dropped {ref}": "已删除 {ref}", "Remove 1 file from Git": "从 Git 中移除 1 个文件", "Remove {n} files from Git": "从 Git 中移除 {n} 个文件", + "Do you want to add the following file to Git?": "是否将以下文件添加到 Git?", + "Do you want to add the following {n} files to Git?": "是否将以下 {n} 个文件添加到 Git?", + "Do you want to remove the following file from Git?": "是否从 Git 中移除以下文件?", + "Do you want to remove the following {n} files from Git?": "是否从 Git 中移除以下 {n} 个文件?", "Accept yours for {path}": "对 {path} 接受你的版本", "Accept theirs for {path}": "对 {path} 接受他们的版本", "{path} resolved": "{path} 已解决",