[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/i18n/RFC.md fully. Find ONE feature... #31
2 changed files with 17 additions and 1 deletions
2
i18n.go
2
i18n.go
|
|
@ -120,7 +120,7 @@ func applyTemplate(text string, data any) string {
|
|||
}
|
||||
return buf.String()
|
||||
}
|
||||
tmpl, err := template.New("").Parse(text)
|
||||
tmpl, err := template.New("").Funcs(TemplateFuncs()).Parse(text)
|
||||
if err != nil {
|
||||
return text
|
||||
}
|
||||
|
|
|
|||
|
|
@ -267,6 +267,22 @@ func TestServiceTranslationContextExtrasInTemplates(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestServiceTemplatesSupportGrammarFuncs(t *testing.T) {
|
||||
svc, err := New()
|
||||
if err != nil {
|
||||
t.Fatalf("New() failed: %v", err)
|
||||
}
|
||||
|
||||
svc.AddMessages("en", map[string]string{
|
||||
"build.status": "{{past .Verb}} complete",
|
||||
})
|
||||
|
||||
got := svc.T("build.status", map[string]any{"Verb": "build"})
|
||||
if got != "built complete" {
|
||||
t.Errorf("T(build.status) = %q, want %q", got, "built complete")
|
||||
}
|
||||
}
|
||||
|
||||
func TestServiceDirection(t *testing.T) {
|
||||
svc, err := New()
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue