From 17ec98f19808fde2076bac1bf9da361269a226e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E6=99=A8=20=28Leo=20Cheng=29?= Date: Wed, 8 Jul 2026 12:11:33 +0800 Subject: [PATCH] fix(i18n): add missing cmd.ignore.short group description key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 林晨 (Leo Cheng) --- doc/changes/ignore-i18n-key.md | 6 ++++++ internal/i18n/locales/en-US.json | 1 + internal/i18n/locales/zh-CN.json | 1 + shortcuts/register_test.go | 4 ++++ 4 files changed, 12 insertions(+) create mode 100644 doc/changes/ignore-i18n-key.md diff --git a/doc/changes/ignore-i18n-key.md b/doc/changes/ignore-i18n-key.md new file mode 100644 index 0000000..5feaa19 --- /dev/null +++ b/doc/changes/ignore-i18n-key.md @@ -0,0 +1,6 @@ +# Ignore group i18n key + +`register.go` 用 `tr.T("cmd.ignore.short")` 设置 `ignore` 组描述,但该键在两个语言包中都缺失,导致 `--help` 里直接显示字面量 `cmd.ignore.short`: + +- 补齐 `en-US.json` / `zh-CN.json` 的 `cmd.ignore.short` +- `TestRegisterAllGroupDescriptions` 增加断言:组描述不得是未解析的 i18n 键 diff --git a/internal/i18n/locales/en-US.json b/internal/i18n/locales/en-US.json index 0739395..d6a3220 100644 --- a/internal/i18n/locales/en-US.json +++ b/internal/i18n/locales/en-US.json @@ -34,6 +34,7 @@ "cmd.dataset.view.short": "View a repository's dataset", "cmd.doctor.long": "Run local diagnostics for gitlink-cli configuration, authentication, repository context and API connectivity.", "cmd.doctor.short": "Diagnose gitlink-cli environment problems", + "cmd.ignore.short": "Gitignore template operations", "cmd.issue.batch_close.long": "Close filtered issues in bulk.\n\nThis command defaults to dry-run mode and only prints matching issues.\nPass --yes to execute remote close operations. Use restrictive filters and a small limit.\n\nExamples:\n gitlink-cli issue +batch-close --owner Gitlink --repo gitlink-cli --older-than-days 60 --limit 20\n gitlink-cli issue +batch-close --owner Gitlink --repo gitlink-cli --older-than-days 60 --limit 20 --yes", "cmd.issue.batch_close.short": "Close filtered issues in bulk. Defaults to dry-run; pass --yes to execute.", "cmd.issue.batch_label.long": "Add a label to filtered issues in bulk.\n\nThis command defaults to dry-run mode and only prints matching issues.\nPass --yes to execute remote label operations. The current implementation does not fake label writes when the API endpoint is unavailable.\n\nExamples:\n gitlink-cli issue +batch-label --owner Gitlink --repo gitlink-cli --add-label stale --older-than-days 30 --limit 50\n gitlink-cli issue +batch-label --owner Gitlink --repo gitlink-cli --add-label stale --older-than-days 30 --limit 50 --yes", diff --git a/internal/i18n/locales/zh-CN.json b/internal/i18n/locales/zh-CN.json index 2e6fc4d..b57ebd0 100644 --- a/internal/i18n/locales/zh-CN.json +++ b/internal/i18n/locales/zh-CN.json @@ -34,6 +34,7 @@ "cmd.dataset.view.short": "查看仓库数据集", "cmd.doctor.long": "诊断 gitlink-cli 的配置、认证、仓库上下文和 API 连通性问题。", "cmd.doctor.short": "诊断 gitlink-cli 环境问题", + "cmd.ignore.short": "Gitignore 模板操作", "cmd.issue.batch_close.long": "批量关闭筛选后的议题。\n\n该命令默认处于 dry-run 模式,只打印匹配的议题。\n传入 --yes 后执行远端关闭操作。请使用严格筛选条件和较小 limit。\n\n示例:\n gitlink-cli issue +batch-close --owner Gitlink --repo gitlink-cli --older-than-days 60 --limit 20\n gitlink-cli issue +batch-close --owner Gitlink --repo gitlink-cli --older-than-days 60 --limit 20 --yes", "cmd.issue.batch_close.short": "批量关闭筛选后的议题。默认 dry-run;传入 --yes 后执行。", "cmd.issue.batch_label.long": "给筛选后的议题批量添加标签。\n\n该命令默认处于 dry-run 模式,只打印匹配的议题。\n传入 --yes 后执行远端标签操作。当前实现不会在 API 端点不可用时伪造写入结果。\n\n示例:\n gitlink-cli issue +batch-label --owner Gitlink --repo gitlink-cli --add-label stale --older-than-days 30 --limit 50\n gitlink-cli issue +batch-label --owner Gitlink --repo gitlink-cli --add-label stale --older-than-days 30 --limit 50 --yes", diff --git a/shortcuts/register_test.go b/shortcuts/register_test.go index 00f4c57..9555bd4 100644 --- a/shortcuts/register_test.go +++ b/shortcuts/register_test.go @@ -1,6 +1,7 @@ package shortcuts import ( + "strings" "testing" "github.com/spf13/cobra" @@ -60,6 +61,9 @@ func TestRegisterAllGroupDescriptions(t *testing.T) { if cmd.Short == "" { t.Fatal("Short description is empty") } + if strings.HasPrefix(cmd.Short, "cmd.") && strings.HasSuffix(cmd.Short, ".short") { + t.Fatalf("Short description is an unresolved i18n key: %q", cmd.Short) + } }) } }