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

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

View file

@ -43,7 +43,7 @@ func FormatAgo(count int, unit string) string {
svc := Default()
unit = normalizeAgoUnit(unit)
if svc == nil {
return core.Sprintf("%d %ss ago", count, unit)
return core.Sprintf("%d %s ago", count, Pluralize(unit, count))
}
key := "time.ago." + unit
result := svc.T(key, map[string]any{"Count": count})

View file

@ -192,6 +192,20 @@ func TestFormatAgo_Good_SingularUnit(t *testing.T) {
assert.Equal(t, "1 fortnight ago", got)
}
func TestFormatAgo_Good_NoDefaultService(t *testing.T) {
prev := Default()
SetDefault(nil)
t.Cleanup(func() {
SetDefault(prev)
})
got := FormatAgo(1, "second")
assert.Equal(t, "1 second ago", got)
got = FormatAgo(5, "second")
assert.Equal(t, "5 seconds ago", got)
}
func TestFormatAgo_Good_FrenchRelativeTime(t *testing.T) {
prev := Default()
svc, err := New()