zitadel/internal/notification/templates/templateData.go
Silvan 3118a99c1e
fix: pubsub (#1122)
* start sub

* start implement subsciptions

* start subscription

* implementation for member done

* admin done

* fix: tests

* extend handlers

* prepary notification

* no errors in adminapi

* changed current sequence in all packages

* ignore mocks

* works

* subscriptions as singleton

* tests

* refactor: rename function scope var

* fix: process ALL previous sequences

* fix: spooler and pubsub

* handler check

* fix: process events until all done

* fix break on query err

* fix: handler

* fix: process sequence or return error

* check aggregate id

* fix: log only in error case

* fix tests

* fix: handlers

* fix: spooler

* fix: spooler

* fix: tests

* fix: continue

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
2020-12-21 18:42:34 +01:00

32 lines
885 B
Go

package templates
import (
"html"
"github.com/caos/zitadel/internal/i18n"
)
type TemplateData struct {
Title string
PreHeader string
Subject string
Greeting string
Text string
Href string
ButtonText string
PrimaryColor string
SecondaryColor string
}
func (data *TemplateData) Translate(i18n *i18n.Translator, args map[string]interface{}, langs ...string) {
data.Title = i18n.Localize(data.Title, nil, langs...)
data.PreHeader = i18n.Localize(data.PreHeader, nil, langs...)
data.Subject = i18n.Localize(data.Subject, nil, langs...)
data.Greeting = i18n.Localize(data.Greeting, args, langs...)
data.Text = html.UnescapeString(i18n.Localize(data.Text, args, langs...))
if data.Href != "" {
data.Href = i18n.Localize(data.Href, nil, langs...)
}
data.ButtonText = i18n.Localize(data.ButtonText, nil, langs...)
}