From 2e21aa8beac86b86f01655777150d747784a3c7a Mon Sep 17 00:00:00 2001 From: cclohmar Date: Fri, 10 Jul 2026 12:27:19 +0100 Subject: [PATCH] fix: register FuncMap for settings template --- main.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index cd4f0da..201703c 100644 --- a/main.go +++ b/main.go @@ -416,7 +416,7 @@ func settingsHandler(w http.ResponseWriter, r *http.Request) { lang = "en" } - tmpl := template.Must(template.New("settings").Parse(settingsHTML)) + tmpl := template.Must(template.New("settings").Funcs(funcMap).Parse(settingsHTML)) w.Header().Set("Content-Type", "text/html; charset=utf-8") tmpl.Execute(w, map[string]interface{}{ "User": user, @@ -579,7 +579,10 @@ func publicSettingsHandler(w http.ResponseWriter, r *http.Request) { // --- Translation system --- var translations = make(map[string]map[string]string) -var launcherTmpl *template.Template +var ( + launcherTmpl *template.Template + funcMap template.FuncMap +) var adminTmpl *template.Template func loadTranslations(lngDir string) { @@ -1311,7 +1314,7 @@ func main() { loadTranslations(lngDir) // Create template FuncMap for translations - funcMap := template.FuncMap{"t": t} + funcMap = template.FuncMap{"t": t} // Parse templates with FuncMap launcherTmpl = template.Must(template.New("launcher").Funcs(funcMap).Parse(launcherHTML))