aboutsummaryrefslogtreecommitdiffstats
path: root/modules/translation/i18n/localestore.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/translation/i18n/localestore.go')
-rw-r--r--modules/translation/i18n/localestore.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/translation/i18n/localestore.go b/modules/translation/i18n/localestore.go
index 69cc9fd91d..b422996984 100644
--- a/modules/translation/i18n/localestore.go
+++ b/modules/translation/i18n/localestore.go
@@ -133,12 +133,14 @@ func (l *locale) TrHTML(trKey string, trArgs ...any) template.HTML {
args := slices.Clone(trArgs)
for i, v := range args {
switch v := v.(type) {
+ case nil, bool, int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, float32, float64, template.HTML:
+ // for most basic types (including template.HTML which is safe), just do nothing and use it
case string:
- args[i] = template.HTML(template.HTMLEscapeString(v))
+ args[i] = template.HTMLEscapeString(v)
case fmt.Stringer:
args[i] = template.HTMLEscapeString(v.String())
- default: // int, float, include template.HTML
- // do nothing, just use it
+ default:
+ args[i] = template.HTMLEscapeString(fmt.Sprint(v))
}
}
return template.HTML(l.TrString(trKey, args...))