[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/i18n/RFC.md fully. Find features de... #180

Merged
Virgil merged 1 commit from agent/read---spec-code-core-go-i18n-rfc-md-ful into dev 2026-04-02 09:12:52 +00:00
2 changed files with 14 additions and 2 deletions

View file

@ -132,7 +132,10 @@ func (h NumericHandler) Match(key string) bool {
func (h NumericHandler) Handle(key string, args []any, next func() string) string {
if len(args) == 0 {
return next()
if next != nil {
return next()
}
return ""
}
format := core.TrimPrefix(key, "i18n.numeric.")
switch format {
@ -153,7 +156,10 @@ func (h NumericHandler) Handle(key string, args []any, next func() string) strin
}
}
}
return next()
if next != nil {
return next()
}
return ""
}
// DefaultHandlers returns the built-in i18n.* namespace handlers.

View file

@ -266,6 +266,12 @@ func TestNumericHandler(t *testing.T) {
if got != "fallback" {
t.Errorf("NumericHandler with no args should fallback, got %q", got)
}
// No args and no fallback should not panic.
got = h.Handle("i18n.numeric.number", nil, nil)
if got != "" {
t.Errorf("NumericHandler with no args and no fallback = %q, want empty string", got)
}
}
func TestCountHandler_UsesLocaleNumberFormat(t *testing.T) {