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

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

View file

@ -455,6 +455,9 @@ func articleForCurrentLanguage(lowerWord, originalWord string) (string, bool) {
if article, ok := articleForPluralForm(data, lowerWord, lang); ok {
return article, true
}
if article, ok := articleForFrenchPluralGuess(data, lowerWord, originalWord, lang); ok {
return article, true
}
if article, ok := articleByGender(data, lowerWord, originalWord, lang); ok {
return article, true
}
@ -489,6 +492,19 @@ func articleForPluralForm(data *GrammarData, lowerWord, lang string) (string, bo
return "les", true
}
func articleForFrenchPluralGuess(data *GrammarData, lowerWord, originalWord, lang string) (string, bool) {
if !isFrenchLanguage(lang) {
return "", false
}
if isKnownPluralNoun(data, lowerWord) {
return "", false
}
if !looksLikeFrenchPlural(originalWord) {
return "", false
}
return "des", true
}
func isKnownPluralNoun(data *GrammarData, lowerWord string) bool {
if data == nil || len(data.Nouns) == 0 {
return false
@ -564,6 +580,18 @@ func usesVowelSoundArticle(word string) bool {
return false
}
func looksLikeFrenchPlural(word string) bool {
trimmed := core.Trim(word)
if trimmed == "" || strings.ContainsAny(trimmed, " \t") || isInitialism(trimmed) {
return false
}
lower := core.Lower(trimmed)
if core.HasSuffix(lower, "aux") || core.HasSuffix(lower, "eaux") {
return true
}
return core.HasSuffix(lower, "s") || core.HasSuffix(lower, "x")
}
func startsWithVowelSound(word string) bool {
lower := core.Lower(core.Trim(word))
if lower == "" {

View file

@ -336,6 +336,7 @@ func TestArticleFrenchLocale(t *testing.T) {
}{
{"branche", "la"},
{"branches", "les"},
{"amis", "des"},
{"enfant", "l'"},
{"fichier", "le"},
{"inconnu", "un"},
@ -574,6 +575,7 @@ func TestArticlePhraseFrenchLocale(t *testing.T) {
}{
{"branche", "la branche"},
{"branches", "les branches"},
{"amis", "des amis"},
{"enfant", "l'enfant"},
{"fichier", "le fichier"},
}