This is a problem for strings like foo <a href="...">bar</a>. It is possible to separate the translation into two separate calls to i18n, but this breaks languages that have different orderings of verb / subject.
Is there a way to disable HTML escaping when using go-i18n to translate strings?
Maybe ... I haven't thought that through. but wouldn't a {{ i18n "foo" | html }} also do the trick?
/cc @moorereason @digitalcraftsman @mitchchn
Just tested this and can confirm that {{ i18n "foo" | safeHTML }} does what you're asking for, @VoidingWarranties.
And that's how it should be in Go templates. If you want to be unsafe, be explicit. :)
Thank you @bep and @mitchchn! Works exactly as you said.
Most helpful comment
Just tested this and can confirm that
{{ i18n "foo" | safeHTML }}does what you're asking for, @VoidingWarranties.And that's how it should be in Go templates. If you want to be unsafe, be explicit. :)