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) }