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

Merged
Virgil merged 1 commit from agent/read---spec-code-core-go-i18n-rfc-md-ful into dev 2026-04-01 06:51:57 +00:00
2 changed files with 38 additions and 0 deletions

View file

@ -2,6 +2,7 @@ package i18n
import (
"maps"
"strings"
"text/template"
"unicode"
@ -561,6 +562,9 @@ func ArticlePhrase(word string) string {
if article == "" || word == "" {
return ""
}
if strings.HasSuffix(article, "'") {
return article + word
}
return article + " " + word
}

View file

@ -366,6 +366,40 @@ func TestArticlePhrase(t *testing.T) {
}
}
func TestArticlePhraseFrenchLocale(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)
}
tests := []struct {
word string
want string
}{
{"branche", "la branche"},
{"enfant", "l'enfant"},
{"fichier", "le fichier"},
}
for _, tt := range tests {
t.Run(tt.word, func(t *testing.T) {
got := ArticlePhrase(tt.word)
if got != tt.want {
t.Errorf("ArticlePhrase(%q) = %q, want %q", tt.word, got, tt.want)
}
})
}
}
func TestLabel(t *testing.T) {
svc, err := New()
if err != nil {