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
+13 -13
View File
@@ -32,9 +32,9 @@ func hasHanzi(s string) bool {
// assertSurfacedExhaustion checks the error an exhausted chain hands back: it must
// still wrap the ErrExhausted sentinel (callers rely on errors.Is), read as a
// Korean message (no Han characters, no full-width colon), and lead with the
// Chinese message (Han characters present, no Hangul), and lead with the
// localized sentinel text. failProv's body is ASCII ("anthropic: status 402:
// nope"), so the whole surfaced string must be Han-free.
// nope"), so the whole surfaced string is expected to be Han-bearing but Hangul-free.
func assertSurfacedExhaustion(t *testing.T, label string, err error) {
t.Helper()
if err == nil {
@@ -44,11 +44,11 @@ func assertSurfacedExhaustion(t *testing.T, label string, err error) {
t.Fatalf("%s: surfaced error no longer wraps ErrExhausted: %v", label, err)
}
msg := err.Error()
if hasHanzi(msg) {
t.Errorf("%s: surfaced error still carries Chinese characters: %q", label, msg)
if !hasHanzi(msg) {
t.Errorf("%s: surfaced error is not localized to Chinese: %q", label, msg)
}
if strings.ContainsRune(msg, ':') {
t.Errorf("%s: surfaced error still uses a full-width colon: %q", label, msg)
if hasHangul(msg) {
t.Errorf("%s: surfaced error still carries Korean characters: %q", label, msg)
}
if !strings.HasPrefix(msg, ErrExhausted.Error()) {
t.Errorf("%s: surfaced error does not lead with the localized sentinel: %q", label, msg)
@@ -60,7 +60,7 @@ func assertSurfacedExhaustion(t *testing.T, label string, err error) {
// transcript. So its text must be Korean, while its identity (errors.Is) must be
// preserved for callers that branch on the sentinel.
func TestExhaustedErrorLocalized(t *testing.T) {
assertKoreanErrText(t, "ErrExhausted", ErrExhausted.Error())
assertChineseErrText(t, "ErrExhausted", ErrExhausted.Error())
// Drive both surfaced paths so a future edit to either wrap site is caught.
streamChain := New([]*Member{
@@ -78,13 +78,13 @@ func TestExhaustedErrorLocalized(t *testing.T) {
assertSurfacedExhaustion(t, "Complete", cerr)
}
// assertKoreanErrText fails unless s contains Hangul and no Han character.
func assertKoreanErrText(t *testing.T, label, s string) {
// assertChineseErrText fails unless s contains a Han character and no Hangul.
func assertChineseErrText(t *testing.T, label, s string) {
t.Helper()
if !hasHangul(s) {
t.Errorf("%s: 한글이 없습니다: %q", label, s)
if !hasHanzi(s) {
t.Errorf("%s: 缺少汉字: %q", label, s)
}
if hasHanzi(s) {
t.Errorf("%s: 중국어 한자가 남아 있습니다: %q", label, s)
if hasHangul(s) {
t.Errorf("%s: 仍残留韩文: %q", label, s)
}
}