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

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

View file

@ -658,12 +658,15 @@ func Quote(s string) string {
// ArticlePhrase prefixes a noun phrase with the correct article.
func ArticlePhrase(word string) string {
article := Article(word)
if article == "" || word == "" {
if word == "" {
return ""
}
lang := currentLangForGrammar()
word = renderWord(lang, word)
article := Article(word)
if article == "" {
return ""
}
if strings.HasSuffix(article, "'") {
return article + word
}

View file

@ -521,6 +521,36 @@ func TestArticlePhrase_RespectsWordMap(t *testing.T) {
}
}
func TestArticlePhrase_UsesRenderedWordForArticleSelection(t *testing.T) {
prev := Default()
svc, err := New()
if err != nil {
t.Fatalf("New() failed: %v", err)
}
SetDefault(svc)
t.Cleanup(func() {
SetDefault(prev)
})
data := GetGrammarData("en")
if data == nil {
t.Fatal("GetGrammarData(\"en\") returned nil")
}
original, existed := data.Words["ssh"]
data.Words["ssh"] = "SSH"
t.Cleanup(func() {
if existed {
data.Words["ssh"] = original
return
}
delete(data.Words, "ssh")
})
if got, want := ArticlePhrase("ssh"), "an SSH"; got != want {
t.Fatalf("ArticlePhrase(%q) = %q, want %q", "ssh", got, want)
}
}
func TestArticlePhraseFrenchLocale(t *testing.T) {
prev := Default()
svc, err := New()