finish backend of custom emails

biggest bodge i've ever done but it works i guess.
This commit is contained in:
Harvey Tindall
2021-02-20 00:22:40 +00:00
parent eb406ef951
commit cc4e12c405
7 changed files with 278 additions and 49 deletions
+6 -2
View File
@@ -120,14 +120,18 @@ func (ls *setupLangs) getOptions() [][2]string {
type langSection map[string]string
type tmpl map[string]string
func (el langSection) template(field string, vals tmpl) string {
text := el.get(field)
func templateString(text string, vals tmpl) string {
for key, val := range vals {
text = strings.ReplaceAll(text, "{"+key+"}", val)
}
return text
}
func (el langSection) template(field string, vals tmpl) string {
text := el.get(field)
return templateString(text, vals)
}
func (el langSection) format(field string, vals ...string) string {
text := el.get(field)
for _, val := range vals {