[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/i18n/RFC.md fully. Find ONE feature... #36

Merged
Virgil merged 1 commit from agent/read---spec-code-core-go-i18n-rfc-md-ful into dev 2026-04-01 22:23:40 +00:00
2 changed files with 24 additions and 1 deletions

View file

@ -44,7 +44,7 @@ func (h CountHandler) Handle(key string, args []any, next func() string) string
noun := core.TrimPrefix(key, "i18n.count.")
if len(args) > 0 {
count := toInt(args[0])
return core.Sprintf("%d %s", count, Pluralize(noun, count))
return core.Sprintf("%s %s", FormatNumber(int64(count)), Pluralize(noun, count))
}
return noun
}

View file

@ -168,6 +168,29 @@ func TestNumericHandler(t *testing.T) {
}
}
func TestCountHandler_UsesLocaleNumberFormat(t *testing.T) {
prev := Default()
svc, err := New()
if err != nil {
t.Fatalf("New() failed: %v", err)
}
SetDefault(svc)
t.Cleanup(func() {
SetDefault(prev)
})
if err := SetLanguage("fr"); err != nil {
t.Fatalf("SetLanguage(fr) failed: %v", err)
}
h := CountHandler{}
got := h.Handle("i18n.count.file", []any{1234}, nil)
want := "1 234 files"
if got != want {
t.Errorf("CountHandler.Handle(locale format) = %q, want %q", got, want)
}
}
func TestRunHandlerChain(t *testing.T) {
handlers := DefaultHandlers()
fallback := func() string { return "missed" }