[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/i18n/RFC.md fully. Find ONE feature... #62
2 changed files with 31 additions and 1 deletions
|
|
@ -156,7 +156,9 @@ func isPluralisableWordDisplay(s string) bool {
|
|||
case unicode.IsLetter(r):
|
||||
hasLetter = true
|
||||
case unicode.IsSpace(r):
|
||||
continue
|
||||
// Multi-word vocabulary entries should stay exact. The count handler
|
||||
// prefixes the quantity, but does not invent a plural form for phrases.
|
||||
return false
|
||||
default:
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -224,6 +224,34 @@ func TestCountHandler_PreservesExactWordDisplay(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestCountHandler_PreservesPhraseDisplay(t *testing.T) {
|
||||
svc, err := New()
|
||||
if err != nil {
|
||||
t.Fatalf("New() failed: %v", err)
|
||||
}
|
||||
SetDefault(svc)
|
||||
|
||||
data := GetGrammarData("en")
|
||||
if data == nil {
|
||||
t.Fatal("GetGrammarData(\"en\") returned nil")
|
||||
}
|
||||
original, existed := data.Words["up_to_date"]
|
||||
data.Words["up_to_date"] = "up to date"
|
||||
t.Cleanup(func() {
|
||||
if existed {
|
||||
data.Words["up_to_date"] = original
|
||||
return
|
||||
}
|
||||
delete(data.Words, "up_to_date")
|
||||
})
|
||||
|
||||
h := CountHandler{}
|
||||
got := h.Handle("i18n.count.up_to_date", []any{2}, nil)
|
||||
if got != "2 up to date" {
|
||||
t.Fatalf("CountHandler.Handle(up_to_date, 2) = %q, want %q", got, "2 up to date")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunHandlerChain(t *testing.T) {
|
||||
handlers := DefaultHandlers()
|
||||
fallback := func() string { return "missed" }
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue