fix(html): use locale setter in render path
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-03 16:16:47 +00:00
parent 5784b76990
commit 8402485489
3 changed files with 3 additions and 3 deletions

View file

@ -25,7 +25,7 @@ func renderToString(_ js.Value, args []js.Value) any {
ctx := html.NewContext()
if len(args) >= 2 && args[1].Type() == js.TypeString {
ctx.Locale = args[1].String()
ctx.SetLocale(args[1].String())
}
layout := html.NewLayout(variant)

View file

@ -43,7 +43,7 @@ func NewContext(locale ...string) *Context {
Data: make(map[string]any),
}
if len(locale) > 0 {
ctx.Locale = locale[0]
ctx.SetLocale(locale[0])
}
return ctx
}

View file

@ -129,7 +129,7 @@ func TestVariantSelector_Escapes_Good(t *testing.T) {
func TestVariantSelector_ControlChars_Escape_Good(t *testing.T) {
got := VariantSelector("a\tb\nc\u0007")
want := `[data-variant="a\\9 b\\A \\7 "]`
want := `[data-variant="a\9 b\A c\7 "]`
if got != want {
t.Fatalf("VariantSelector control escapes = %q, want %q", got, want)
}