fix(i18n): replace hardcoded Chinese strings with translation keys in DeepLinkImportDialog

- Add missing i18n keys for prompt, MCP, and skill import dialogs
- Replace hardcoded toast messages with t() function calls
- Add translation keys: importPrompt, importMcp, importSkill, etc.
- Ensure all user-facing text supports both zh and en locales
This commit is contained in:
Jason
2025-11-25 09:41:02 +08:00
parent 2ce8a8273c
commit 60fa9654e1
3 changed files with 51 additions and 14 deletions

View File

@@ -117,12 +117,17 @@ export function DeepLinkImportDialog() {
});
if (summary.failed.length > 0) {
toast.warning(`部分导入成功`, {
description: `成功: ${summary.importedCount}, 失败: ${summary.failed.length}`,
toast.warning(t("deeplink.mcpPartialSuccess"), {
description: t("deeplink.mcpPartialSuccessDescription", {
success: summary.importedCount,
failed: summary.failed.length,
}),
});
} else {
toast.success("MCP Servers 导入成功", {
description: `成功导入 ${summary.importedCount} 个服务器`,
toast.success(t("deeplink.mcpImportSuccess"), {
description: t("deeplink.mcpImportSuccessDescription", {
count: summary.importedCount,
}),
});
}
};
@@ -145,8 +150,10 @@ export function DeepLinkImportDialog() {
detail: { app: request.app },
}),
);
toast.success("提示词导入成功", {
description: `已导入提示词: ${request.name}`,
toast.success(t("deeplink.promptImportSuccess"), {
description: t("deeplink.promptImportSuccessDescription", {
name: request.name,
}),
});
} else if (result.type === "mcp") {
await refreshMcp(result);
@@ -160,8 +167,10 @@ export function DeepLinkImportDialog() {
queryKey: ["skills"],
type: "all",
});
toast.success("Skill 仓库添加成功", {
description: `已添加仓库: ${request.repo}`,
toast.success(t("deeplink.skillImportSuccess"), {
description: t("deeplink.skillImportSuccessDescription", {
repo: request.repo,
}),
});
}
} else if (isMcpImportResult(result)) {
@@ -282,11 +291,11 @@ export function DeepLinkImportDialog() {
if (!request) return t("deeplink.confirmImport");
switch (request.resource) {
case "prompt":
return "导入提示词";
return t("deeplink.importPrompt");
case "mcp":
return "导入 MCP Servers";
return t("deeplink.importMcp");
case "skill":
return "添加 Skill 仓库";
return t("deeplink.importSkill");
default:
return t("deeplink.confirmImport");
}
@@ -296,11 +305,11 @@ export function DeepLinkImportDialog() {
if (!request) return t("deeplink.confirmImportDescription");
switch (request.resource) {
case "prompt":
return "请确认是否导入此系统提示词";
return t("deeplink.importPromptDescription");
case "mcp":
return "请确认是否导入这些 MCP Servers";
return t("deeplink.importMcpDescription");
case "skill":
return "请确认是否添加此 Skill 仓库";
return t("deeplink.importSkillDescription");
default:
return t("deeplink.confirmImportDescription");
}

View File

@@ -749,6 +749,20 @@
"deeplink": {
"confirmImport": "Confirm Import Provider",
"confirmImportDescription": "The following configuration will be imported from deep link into CC Switch",
"importPrompt": "Import Prompt",
"importPromptDescription": "Please confirm whether to import this system prompt",
"importMcp": "Import MCP Servers",
"importMcpDescription": "Please confirm whether to import these MCP Servers",
"importSkill": "Add Skill Repository",
"importSkillDescription": "Please confirm whether to add this Skill repository",
"promptImportSuccess": "Prompt imported successfully",
"promptImportSuccessDescription": "Imported prompt: {{name}}",
"mcpImportSuccess": "MCP Servers imported successfully",
"mcpImportSuccessDescription": "Successfully imported {{count}} server(s)",
"mcpPartialSuccess": "Partial import success",
"mcpPartialSuccessDescription": "Success: {{success}}, Failed: {{failed}}",
"skillImportSuccess": "Skill repository added successfully",
"skillImportSuccessDescription": "Added repository: {{repo}}",
"app": "App Type",
"providerName": "Provider Name",
"homepage": "Homepage",

View File

@@ -749,6 +749,20 @@
"deeplink": {
"confirmImport": "确认导入供应商配置",
"confirmImportDescription": "以下配置将导入到 CC Switch",
"importPrompt": "导入提示词",
"importPromptDescription": "请确认是否导入此系统提示词",
"importMcp": "导入 MCP Servers",
"importMcpDescription": "请确认是否导入这些 MCP Servers",
"importSkill": "添加 Skill 仓库",
"importSkillDescription": "请确认是否添加此 Skill 仓库",
"promptImportSuccess": "提示词导入成功",
"promptImportSuccessDescription": "已导入提示词: {{name}}",
"mcpImportSuccess": "MCP Servers 导入成功",
"mcpImportSuccessDescription": "成功导入 {{count}} 个服务器",
"mcpPartialSuccess": "部分导入成功",
"mcpPartialSuccessDescription": "成功: {{success}}, 失败: {{failed}}",
"skillImportSuccess": "Skill 仓库添加成功",
"skillImportSuccessDescription": "已添加仓库: {{repo}}",
"app": "应用类型",
"providerName": "供应商名称",
"homepage": "官网地址",