From 6d5e3a4a1633d8772b592132e433c33b938e9145 Mon Sep 17 00:00:00 2001 From: krau <71133316+krau@users.noreply.github.com> Date: Sat, 17 Jan 2026 21:37:57 +0800 Subject: [PATCH] fix: missing progress stats i18n --- common/i18n/i18nk/keys.go | 1 + common/i18n/locale/zh-Hans.yaml | 10 ++++++++-- core/tasks/batchimport/progress.go | 6 +++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/common/i18n/i18nk/keys.go b/common/i18n/i18nk/keys.go index fc1a4ef..29af390 100644 --- a/common/i18n/i18nk/keys.go +++ b/common/i18n/i18nk/keys.go @@ -118,6 +118,7 @@ const ( BotMsgImportErrorStorageNotReadable Key = "bot.msg.import.error_storage_not_readable" BotMsgImportInfoFetchingFiles Key = "bot.msg.import.info_fetching_files" BotMsgImportInfoTaskAdded Key = "bot.msg.import.info_task_added" + BotMsgImportStartStats Key = "bot.msg.import.start_stats" BotMsgImportUsage Key = "bot.msg.import.usage" BotMsgMediaGroupErrorBuildStorageSelectKeyboardFailed Key = "bot.msg.media_group.error_build_storage_select_keyboard_failed" BotMsgMediaGroupInfoGroupFoundFilesSelectStorage Key = "bot.msg.media_group.info_group_found_files_select_storage" diff --git a/common/i18n/locale/zh-Hans.yaml b/common/i18n/locale/zh-Hans.yaml index bb9b38a..6963f83 100644 --- a/common/i18n/locale/zh-Hans.yaml +++ b/common/i18n/locale/zh-Hans.yaml @@ -298,7 +298,12 @@ bot: info_downloading: "正在通过 yt-dlp 下载..." error_download_failed: "yt-dlp 下载失败: {{.Error}}" import: - usage: "用法: /import [target_chat_id] [filter]\n\n示例:\n/import 本机1 /downloads\n/import MyAlist /media/photos -1001234567890\n/import MyLocal /backup \".*\.mp4$\"" + usage: | + 用法: /import [target_chat_id] [filter] + 示例: + /import 本机1 /downloads + /import MyAlist /media/photos -1001234567890 + /import MyLocal /backup ".*\.mp4$" error_storage_not_found: "存储端 '{{.StorageName}}' 不存在或您无权访问: {{.Error}}" error_storage_not_listable: "存储端 '{{.StorageName}}' 不支持列举文件功能" error_storage_not_readable: "存储端 '{{.StorageName}}' 不支持读取文件功能" @@ -311,6 +316,7 @@ bot: error_no_target_chat_id: "未指定目标频道 ID,且 Telegram 存储未配置默认 chat_id" error_add_task_failed: "添加任务失败: {{.Error}}" info_task_added: "已添加 {{.Count}} 个文件到导入队列\n总大小: {{.SizeMB}} MB\n任务 ID: {{.TaskID}}" + start_stats: "总文件数: {{.Count}}\n总大小: {{.SizeMB}} MB" cancel: usage: "用法: /cancel " error_cancel_failed: "取消任务失败: {{.Error}}" @@ -383,4 +389,4 @@ bot: info_adding_aria2_download: "正在添加 Aria2 下载任务..." error_adding_aria2_download: "添加 Aria2 下载任务失败: {{.Error}}" info_aria2_download_added: "Aria2 下载任务已添加, GID: {{.GID}}" - info_select_storage: "请选择存储位置, 选择后将添加到 Aria2 下载队列" \ No newline at end of file + info_select_storage: "请选择存储位置, 选择后将添加到 Aria2 下载队列" diff --git a/core/tasks/batchimport/progress.go b/core/tasks/batchimport/progress.go index 5d70a9e..fe89b02 100644 --- a/core/tasks/batchimport/progress.go +++ b/core/tasks/batchimport/progress.go @@ -43,9 +43,9 @@ func (p *Progress) OnStart(ctx context.Context, info TaskInfo) { log.FromContext(ctx).Debugf("Batch import task progress tracking started for message %d in chat %d", p.MessageID, p.ChatID) sizeMB := float64(info.TotalSize()) / (1024 * 1024) - statsText := i18n.T(i18nk.BotMsgProgressImportStartStats, map[string]any{ - "size": fmt.Sprintf("%.2f", sizeMB), - "count": info.Count(), + statsText := i18n.T(i18nk.BotMsgImportStartStats, map[string]any{ + "SizeMB": fmt.Sprintf("%.2f", sizeMB), + "Count": info.Count(), }) entityBuilder := entity.Builder{}