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:
@@ -7,25 +7,25 @@ import (
|
||||
"unicode"
|
||||
)
|
||||
|
||||
// assertKorean fails if msg is empty, carries a CJK Han ideograph (= leftover
|
||||
// untranslated Chinese), or has no Hangul at all. ASCII field names and the
|
||||
// "1–4000"-style ranges are fine; only Han marks an unlocalized string.
|
||||
func assertKorean(t *testing.T, label, msg string) {
|
||||
// assertChinese fails if msg is empty, carries Hangul (= leftover untranslated
|
||||
// Korean), or has no Han ideograph at all. ASCII field names and the
|
||||
// "1–4000"-style ranges are fine; only Hangul marks an unlocalized string.
|
||||
func assertChinese(t *testing.T, label, msg string) {
|
||||
t.Helper()
|
||||
if msg == "" {
|
||||
t.Fatalf("%s: 빈 메시지", label)
|
||||
}
|
||||
hangul := false
|
||||
han := false
|
||||
for _, r := range msg {
|
||||
if unicode.Is(unicode.Han, r) {
|
||||
t.Fatalf("%s: 중국어 한자가 남아 있습니다: %q", label, msg)
|
||||
}
|
||||
if unicode.Is(unicode.Hangul, r) {
|
||||
hangul = true
|
||||
t.Fatalf("%s: 한국어가 남아 있습니다: %q", label, msg)
|
||||
}
|
||||
if unicode.Is(unicode.Han, r) {
|
||||
han = true
|
||||
}
|
||||
}
|
||||
if !hangul {
|
||||
t.Fatalf("%s: 한글이 없습니다: %q", label, msg)
|
||||
if !han {
|
||||
t.Fatalf("%s: 汉字缺失: %q", label, msg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,16 +34,16 @@ func assertKorean(t *testing.T, label, msg string) {
|
||||
// These surface through /api/.../side-questions into the chat 곁질문 panel, so a
|
||||
// revert to Chinese here is a user-visible regression and must fail the build.
|
||||
func TestSideQuestionOutputsLocalized(t *testing.T) {
|
||||
assertKorean(t, "ErrContextBudget", ErrContextBudget.Error())
|
||||
assertKorean(t, "errSideModelInterrupted", errSideModelInterrupted.Error())
|
||||
assertKorean(t, "errSideNoAnswer", errSideNoAnswer.Error())
|
||||
assertKorean(t, "msgSideToolUnavailable", msgSideToolUnavailable)
|
||||
assertKorean(t, "errSideSummaryCallCap", errSideSummaryCallCap.Error())
|
||||
assertKorean(t, "sideSummaryFailedPrefix", sideSummaryFailedPrefix)
|
||||
assertKorean(t, "errSideSummaryIncomplete", errSideSummaryIncomplete.Error())
|
||||
assertKorean(t, "errSideSummaryOverBudget", errSideSummaryOverBudget.Error())
|
||||
assertKorean(t, "errSideHistoryCursor", errSideHistoryCursor.Error())
|
||||
assertKorean(t, "errSideCompactionStalled", errSideCompactionStalled.Error())
|
||||
assertChinese(t, "ErrContextBudget", ErrContextBudget.Error())
|
||||
assertChinese(t, "errSideModelInterrupted", errSideModelInterrupted.Error())
|
||||
assertChinese(t, "errSideNoAnswer", errSideNoAnswer.Error())
|
||||
assertChinese(t, "msgSideToolUnavailable", msgSideToolUnavailable)
|
||||
assertChinese(t, "errSideSummaryCallCap", errSideSummaryCallCap.Error())
|
||||
assertChinese(t, "sideSummaryFailedPrefix", sideSummaryFailedPrefix)
|
||||
assertChinese(t, "errSideSummaryIncomplete", errSideSummaryIncomplete.Error())
|
||||
assertChinese(t, "errSideSummaryOverBudget", errSideSummaryOverBudget.Error())
|
||||
assertChinese(t, "errSideHistoryCursor", errSideHistoryCursor.Error())
|
||||
assertChinese(t, "errSideCompactionStalled", errSideCompactionStalled.Error())
|
||||
}
|
||||
|
||||
// TestSideQuestionBudgetSentinelPreserved: localizing the message must not break
|
||||
|
||||
Reference in New Issue
Block a user