Localize user-facing UI, agent output, and backend messages to Simplified Chinese
ci / go (push) Waiting to run
ci / go-db (agent) (push) Waiting to run
ci / go-db (config) (push) Waiting to run
ci / go-db (db) (push) Waiting to run
ci / go-db (evidence) (push) Waiting to run
ci / go-db (llmrec) (push) Waiting to run
ci / go-db (server) (push) Waiting to run
detections / detections (push) Waiting to run
docs / links (push) Waiting to run
web / web (push) Waiting to run

This commit is contained in:
dela
2026-10-09 14:08:31 +08:00
parent 8af63417c8
commit 97668dab7e
148 changed files with 1671 additions and 1672 deletions
+19 -19
View File
@@ -6,25 +6,25 @@ import (
"unicode"
)
// assertKoreanError fails when msg is empty, still carries a CJK Han ideograph
// (= untranslated Chinese), or carries no Hangul at all. Hangul and ASCII field
// names/enums are allowed; only Han (unicode.Han) marks a leftover Chinese string.
func assertKoreanError(t *testing.T, label, msg string) {
// assertChineseError fails when msg is empty, carries no Han ideograph
// (= untranslated / non-Chinese), or still carries Hangul. Han and ASCII field
// names/enums are allowed; only Hangul (unicode.Hangul) marks a leftover Korean string.
func assertChineseError(t *testing.T, label, msg string) {
t.Helper()
if msg == "" {
t.Fatalf("%s: 빈 메시지", label)
}
hasHangul := false
hasHan := false
for _, r := range msg {
if unicode.Is(unicode.Han, r) {
t.Fatalf("%s: 중국어 한자가 남아 있습니다: %q", label, msg)
}
if unicode.Is(unicode.Hangul, r) {
hasHangul = true
t.Fatalf("%s: 한글이 남아 있습니다: %q", label, msg)
}
if unicode.Is(unicode.Han, r) {
hasHan = true
}
}
if !hasHangul {
t.Fatalf("%s: 한글이 없습니다: %q", label, msg)
if !hasHan {
t.Fatalf("%s: 한자가 없습니다: %q", label, msg)
}
}
@@ -37,12 +37,12 @@ func TestInterceptArchiveErrorsLocalized(t *testing.T) {
if _, err := interceptFilterParams(url.Values{"status": {"bogus"}}); err == nil {
t.Fatal("status 검증이 통과해서는 안 됩니다")
} else {
assertKoreanError(t, "filter.status", err.Error())
assertChineseError(t, "filter.status", err.Error())
}
if _, err := interceptFilterParams(url.Values{"decision_source": {"bogus"}}); err == nil {
t.Fatal("decision_source 검증이 통과해서는 안 됩니다")
} else {
assertKoreanError(t, "filter.decision_source", err.Error())
assertChineseError(t, "filter.decision_source", err.Error())
}
// intercept.go: validateInterceptRuleReq — each branch isolated by making the
@@ -63,14 +63,14 @@ func TestInterceptArchiveErrorsLocalized(t *testing.T) {
if err == nil {
t.Fatalf("%s: 검증이 통과해서는 안 됩니다", tc.label)
}
assertKoreanError(t, tc.label, err.Error())
assertChineseError(t, tc.label, err.Error())
}
// task_archives.go: normalizeArchiveIDs — batch id validation.
if _, err := normalizeArchiveIDs(nil); err == nil {
t.Fatal("빈 archive_ids 검증이 통과해서는 안 됩니다")
} else {
assertKoreanError(t, "archive_ids.empty", err.Error())
assertChineseError(t, "archive_ids.empty", err.Error())
}
tooMany := make([]int64, 101)
for i := range tooMany {
@@ -79,23 +79,23 @@ func TestInterceptArchiveErrorsLocalized(t *testing.T) {
if _, err := normalizeArchiveIDs(tooMany); err == nil {
t.Fatal("101개 archive_ids 검증이 통과해서는 안 됩니다")
} else {
assertKoreanError(t, "archive_ids.too_many", err.Error())
assertChineseError(t, "archive_ids.too_many", err.Error())
}
if _, err := normalizeArchiveIDs([]int64{0}); err == nil {
t.Fatal("0 archive id 검증이 통과해서는 안 됩니다")
} else {
assertKoreanError(t, "archive_ids.nonpositive", err.Error())
assertChineseError(t, "archive_ids.nonpositive", err.Error())
}
// task_archives.go: validateArchivePath — package path validation.
if err := validateArchivePath("/tmp/artex-data", ""); err == nil {
t.Fatal("빈 보관 경로 검증이 통과해서는 안 됩니다")
} else {
assertKoreanError(t, "archive_path.empty", err.Error())
assertChineseError(t, "archive_path.empty", err.Error())
}
if err := validateArchivePath("/tmp/artex-data", "/etc/passwd"); err == nil {
t.Fatal("관리 디렉터리 밖 경로 검증이 통과해서는 안 됩니다")
} else {
assertKoreanError(t, "archive_path.outside", err.Error())
assertChineseError(t, "archive_path.outside", err.Error())
}
}