Fixed 'Error parsing template: template: privacy.html:27: function "translate"'
Some checks failed
Run Integration Tests / test (push) Failing after 39s

This commit is contained in:
partisan 2025-05-30 17:04:57 +02:00
parent 8e0682cb43
commit 66414952e8
3 changed files with 11 additions and 17 deletions

View file

@ -173,3 +173,12 @@ func FormatLinkHTML(rawURL string) LinkParts {
return lp
}
// Converts any struct to a map[string]interface{} using JSON round-trip.
// Useful for rendering templates with generic map input.
func toMap(data interface{}) map[string]interface{} {
jsonBytes, _ := json.Marshal(data)
var result map[string]interface{}
_ = json.Unmarshal(jsonBytes, &result)
return result
}