[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/i18n/RFC.md fully. Find features de... #180
2 changed files with 14 additions and 2 deletions
10
handler.go
10
handler.go
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue