PLT-7522 Cleaned up translation of templates (#7351)

* PLT-7522 Cleaned up translation of templates

* Added unit tests

* Changed TranslateAsHtml to not be variadic
Этот коммит содержится в:
Harrison Healey
2017-09-05 17:39:45 -04:00
коммит произвёл Joram Wilander
родитель 016b5daa1c
Коммит 6ca443a255
4 изменённых файлов: 99 добавлений и 26 удалений

Просмотреть файл

@@ -427,11 +427,11 @@ func getNotificationEmailBody(recipient *model.User, post *model.Post, channel *
t := getFormattedPostTime(post, translateFunc)
var bodyText string
var info string
var info template.HTML
if channel.Type == model.CHANNEL_DIRECT {
if emailNotificationContentsType == model.EMAIL_NOTIFICATION_CONTENTS_FULL {
bodyText = translateFunc("app.notification.body.intro.direct.full")
info = translateFunc("app.notification.body.text.direct.full",
info = utils.TranslateAsHtml(translateFunc, "app.notification.body.text.direct.full",
map[string]interface{}{
"SenderName": senderName,
"Hour": t.Hour,
@@ -444,7 +444,7 @@ func getNotificationEmailBody(recipient *model.User, post *model.Post, channel *
bodyText = translateFunc("app.notification.body.intro.direct.generic", map[string]interface{}{
"SenderName": senderName,
})
info = translateFunc("app.notification.body.text.direct.generic",
info = utils.TranslateAsHtml(translateFunc, "app.notification.body.text.direct.generic",
map[string]interface{}{
"Hour": t.Hour,
"Minute": t.Minute,
@@ -456,7 +456,7 @@ func getNotificationEmailBody(recipient *model.User, post *model.Post, channel *
} else {
if emailNotificationContentsType == model.EMAIL_NOTIFICATION_CONTENTS_FULL {
bodyText = translateFunc("app.notification.body.intro.notification.full")
info = translateFunc("app.notification.body.text.notification.full",
info = utils.TranslateAsHtml(translateFunc, "app.notification.body.text.notification.full",
map[string]interface{}{
"ChannelName": channelName,
"SenderName": senderName,
@@ -470,7 +470,7 @@ func getNotificationEmailBody(recipient *model.User, post *model.Post, channel *
bodyText = translateFunc("app.notification.body.intro.notification.generic", map[string]interface{}{
"SenderName": senderName,
})
info = translateFunc("app.notification.body.text.notification.generic",
info = utils.TranslateAsHtml(translateFunc, "app.notification.body.text.notification.generic",
map[string]interface{}{
"Hour": t.Hour,
"Minute": t.Minute,
@@ -482,7 +482,7 @@ func getNotificationEmailBody(recipient *model.User, post *model.Post, channel *
}
bodyPage.Props["BodyText"] = bodyText
bodyPage.Html["Info"] = template.HTML(info)
bodyPage.Html["Info"] = info
bodyPage.Props["Button"] = translateFunc("api.templates.post_body.button")
return bodyPage.Render()