[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/i18n/RFC.md fully. Find ONE feature... #26
2 changed files with 28 additions and 1 deletions
|
|
@ -117,8 +117,13 @@ func flattenWithGrammar(prefix string, data map[string]any, out map[string]Messa
|
|||
// Verb form object (has base/past/gerund keys)
|
||||
if grammar != nil && isVerbFormObject(v) {
|
||||
verbName := key
|
||||
if base, ok := v["base"].(string); ok && base != "" {
|
||||
verbName = base
|
||||
}
|
||||
if after, ok := strings.CutPrefix(fullKey, "gram.verb."); ok {
|
||||
verbName = after
|
||||
if base, ok := v["base"].(string); !ok || base == "" {
|
||||
verbName = after
|
||||
}
|
||||
}
|
||||
forms := VerbForms{}
|
||||
if past, ok := v["past"].(string); ok {
|
||||
|
|
|
|||
|
|
@ -132,6 +132,11 @@ func TestFlattenWithGrammar(t *testing.T) {
|
|||
"past": "tested",
|
||||
"gerund": "testing",
|
||||
},
|
||||
"publish_draft": map[string]any{
|
||||
"base": "publish",
|
||||
"past": "published",
|
||||
"gerund": "publishing",
|
||||
},
|
||||
},
|
||||
"noun": map[string]any{
|
||||
"widget": map[string]any{
|
||||
|
|
@ -175,6 +180,19 @@ func TestFlattenWithGrammar(t *testing.T) {
|
|||
t.Errorf("test.past = %q, want 'tested'", v.Past)
|
||||
}
|
||||
}
|
||||
if v, ok := grammar.Verbs["publish"]; !ok {
|
||||
t.Error("verb base override 'publish' not extracted")
|
||||
} else {
|
||||
if v.Past != "published" {
|
||||
t.Errorf("publish.past = %q, want 'published'", v.Past)
|
||||
}
|
||||
if v.Gerund != "publishing" {
|
||||
t.Errorf("publish.gerund = %q, want 'publishing'", v.Gerund)
|
||||
}
|
||||
}
|
||||
if _, ok := grammar.Verbs["publish_draft"]; ok {
|
||||
t.Error("verb should be stored under explicit base, not JSON key")
|
||||
}
|
||||
|
||||
// Noun extracted
|
||||
if n, ok := grammar.Nouns["widget"]; !ok {
|
||||
|
|
@ -459,6 +477,7 @@ func TestCustomFSLoader(t *testing.T) {
|
|||
Data: []byte(`{
|
||||
"gram": {
|
||||
"verb": {
|
||||
"draft": { "base": "draft", "past": "drafted", "gerund": "drafting" },
|
||||
"zap": { "base": "zap", "past": "zapped", "gerund": "zapping" }
|
||||
},
|
||||
"word": {
|
||||
|
|
@ -488,4 +507,7 @@ func TestCustomFSLoader(t *testing.T) {
|
|||
if v, ok := gd.Verbs["zap"]; !ok || v.Past != "zapped" {
|
||||
t.Errorf("verb 'zap' not loaded correctly")
|
||||
}
|
||||
if v, ok := gd.Verbs["draft"]; !ok || v.Past != "drafted" {
|
||||
t.Errorf("verb base override 'draft' not loaded correctly")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue