From 84024854896da9e137395e9a6804d9c48b21ff20 Mon Sep 17 00:00:00 2001 From: Virgil Date: Fri, 3 Apr 2026 16:16:47 +0000 Subject: [PATCH] fix(html): use locale setter in render path Co-Authored-By: Virgil --- cmd/wasm/main.go | 2 +- context.go | 2 +- responsive_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/wasm/main.go b/cmd/wasm/main.go index aa6997a..dc74244 100644 --- a/cmd/wasm/main.go +++ b/cmd/wasm/main.go @@ -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) diff --git a/context.go b/context.go index 5c1f61e..f5d40e5 100644 --- a/context.go +++ b/context.go @@ -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 } diff --git a/responsive_test.go b/responsive_test.go index 08941ec..a930892 100644 --- a/responsive_test.go +++ b/responsive_test.go @@ -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) }