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
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:
@@ -27,15 +27,15 @@ func hasHan(s string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// assertKorean fails if s lacks Hangul or still carries Han ideographs. Reverting
|
||||
// any localized message back to Chinese trips hasHan, so the test is not vacuous.
|
||||
func assertKorean(t *testing.T, label, s string) {
|
||||
// assertChinese fails if s lacks Han ideographs or still carries Hangul. Reverting
|
||||
// any localized message back to Korean trips hasHangul, so the test is not vacuous.
|
||||
func assertChinese(t *testing.T, label, s string) {
|
||||
t.Helper()
|
||||
if !hasHangul(s) {
|
||||
t.Errorf("%s: 한글이 없습니다: %q", label, s)
|
||||
if !hasHan(s) {
|
||||
t.Errorf("%s: 缺少汉字: %q", label, s)
|
||||
}
|
||||
if hasHan(s) {
|
||||
t.Errorf("%s: 한자가 남아 있습니다: %q", label, s)
|
||||
if hasHangul(s) {
|
||||
t.Errorf("%s: 仍残留韩文: %q", label, s)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ func TestInterceptMessagesLocalized(t *testing.T) {
|
||||
{"reasonManualAllow", reasonManualAllow},
|
||||
{"ErrAlreadyDecided", ErrAlreadyDecided.Error()},
|
||||
} {
|
||||
assertKorean(t, c.name, c.s)
|
||||
assertChinese(t, c.name, c.s)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ func TestInterceptMessagesLocalized(t *testing.T) {
|
||||
// passes through untranslated.
|
||||
func TestJudgeActionLabelLocalized(t *testing.T) {
|
||||
for _, action := range []string{"allow", "deny", "ask"} {
|
||||
assertKorean(t, "judgeActionLabel("+action+")", judgeActionLabel(action))
|
||||
assertChinese(t, "judgeActionLabel("+action+")", judgeActionLabel(action))
|
||||
}
|
||||
if got := judgeActionLabel("weird"); got != "weird" {
|
||||
t.Errorf("judgeActionLabel(weird) = %q, want passthrough", got)
|
||||
@@ -75,7 +75,7 @@ func TestJudgeActionLabelLocalized(t *testing.T) {
|
||||
func TestDefaultMessageLocalized(t *testing.T) {
|
||||
for _, action := range []string{"deny", "ask"} {
|
||||
msg := defaultMessage(action, "R1")
|
||||
assertKorean(t, "defaultMessage("+action+")", msg)
|
||||
assertChinese(t, "defaultMessage("+action+")", msg)
|
||||
if !strings.Contains(msg, "R1") {
|
||||
t.Errorf("defaultMessage(%s) dropped rule name: %q", action, msg)
|
||||
}
|
||||
@@ -90,11 +90,11 @@ func TestDefaultMessageLocalized(t *testing.T) {
|
||||
// the tool name via /도구\s+(\S+)\s+승인/.
|
||||
func TestToolApprovalSummaryLocalized(t *testing.T) {
|
||||
s := fmt.Sprintf(msgToolApprovalRequestFmt, "Bash", 42)
|
||||
assertKorean(t, "msgToolApprovalRequestFmt", s)
|
||||
assertChinese(t, "msgToolApprovalRequestFmt", s)
|
||||
if !strings.Contains(s, "(#42)") {
|
||||
t.Errorf("summary lost the (#N) marker (transcript.tsx pending_id regex): %q", s)
|
||||
}
|
||||
if !strings.Contains(s, "도구 Bash 승인") {
|
||||
t.Errorf("summary lost the '도구 X 승인' shape (transcript.tsx toolName regex): %q", s)
|
||||
if !strings.Contains(s, "工具 Bash 审批") {
|
||||
t.Errorf("summary lost the '工具 X 审批' shape (transcript.tsx toolName regex): %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user