fix: register FuncMap for settings template
This commit is contained in:
parent
1e37c33603
commit
2e21aa8bea
1 changed files with 6 additions and 3 deletions
9
main.go
9
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))
|
||||
|
|
|
|||
Loading…
Reference in a new issue