Use TrN helper for email templates (#16425)
* Add TrN helper * use TrN * a nit
This commit is contained in:
parent
8464fa15d0
commit
8798e3a098
5 changed files with 9 additions and 6 deletions
|
@ -350,7 +350,7 @@ issue_assigned.issue = @%[1]s assigned you to the issue %[2]s in repository %[3]
|
||||||
|
|
||||||
issue.x_mentioned_you = <b>@%s</b> mentioned you:
|
issue.x_mentioned_you = <b>@%s</b> mentioned you:
|
||||||
issue.action.force_push = <b>%[1]s</b> force-pushed the <b>%[2]s</b> from %[3]s to %[4]s.
|
issue.action.force_push = <b>%[1]s</b> force-pushed the <b>%[2]s</b> from %[3]s to %[4]s.
|
||||||
issue.action.push_1 = <b>@%[1]s</b> pushed 1 commit to %[2]s
|
issue.action.push_1 = <b>@%[1]s</b> pushed %[3]d commit to %[2]s
|
||||||
issue.action.push_n = <b>@%[1]s</b> pushed %[3]d commits to %[2]s
|
issue.action.push_n = <b>@%[1]s</b> pushed %[3]d commits to %[2]s
|
||||||
issue.action.close = <b>@%[1]s</b> closed #%[2]d.
|
issue.action.close = <b>@%[1]s</b> closed #%[2]d.
|
||||||
issue.action.reopen = <b>@%[1]s</b> reopened #%[2]d.
|
issue.action.reopen = <b>@%[1]s</b> reopened #%[2]d.
|
||||||
|
|
|
@ -72,6 +72,7 @@ func sendUserMail(language string, u *models.User, tpl base.TplName, code, subje
|
||||||
// helper
|
// helper
|
||||||
"i18n": locale,
|
"i18n": locale,
|
||||||
"Str2html": templates.Str2html,
|
"Str2html": templates.Str2html,
|
||||||
|
"TrN": templates.TrN,
|
||||||
}
|
}
|
||||||
|
|
||||||
var content bytes.Buffer
|
var content bytes.Buffer
|
||||||
|
@ -110,6 +111,7 @@ func SendActivateEmailMail(u *models.User, email *models.EmailAddress) {
|
||||||
// helper
|
// helper
|
||||||
"i18n": locale,
|
"i18n": locale,
|
||||||
"Str2html": templates.Str2html,
|
"Str2html": templates.Str2html,
|
||||||
|
"TrN": templates.TrN,
|
||||||
}
|
}
|
||||||
|
|
||||||
var content bytes.Buffer
|
var content bytes.Buffer
|
||||||
|
@ -136,6 +138,7 @@ func SendRegisterNotifyMail(u *models.User) {
|
||||||
// helper
|
// helper
|
||||||
"i18n": locale,
|
"i18n": locale,
|
||||||
"Str2html": templates.Str2html,
|
"Str2html": templates.Str2html,
|
||||||
|
"TrN": templates.TrN,
|
||||||
}
|
}
|
||||||
|
|
||||||
var content bytes.Buffer
|
var content bytes.Buffer
|
||||||
|
@ -165,6 +168,7 @@ func SendCollaboratorMail(u, doer *models.User, repo *models.Repository) {
|
||||||
// helper
|
// helper
|
||||||
"i18n": locale,
|
"i18n": locale,
|
||||||
"Str2html": templates.Str2html,
|
"Str2html": templates.Str2html,
|
||||||
|
"TrN": templates.TrN,
|
||||||
}
|
}
|
||||||
|
|
||||||
var content bytes.Buffer
|
var content bytes.Buffer
|
||||||
|
@ -248,6 +252,7 @@ func composeIssueCommentMessages(ctx *mailCommentContext, lang string, recipient
|
||||||
// helper
|
// helper
|
||||||
"i18n": locale,
|
"i18n": locale,
|
||||||
"Str2html": templates.Str2html,
|
"Str2html": templates.Str2html,
|
||||||
|
"TrN": templates.TrN,
|
||||||
}
|
}
|
||||||
|
|
||||||
var mailSubject bytes.Buffer
|
var mailSubject bytes.Buffer
|
||||||
|
|
|
@ -68,6 +68,7 @@ func mailNewRelease(lang string, tos []string, rel *models.Release) {
|
||||||
// helper
|
// helper
|
||||||
"i18n": locale,
|
"i18n": locale,
|
||||||
"Str2html": templates.Str2html,
|
"Str2html": templates.Str2html,
|
||||||
|
"TrN": templates.TrN,
|
||||||
}
|
}
|
||||||
|
|
||||||
var mailBody bytes.Buffer
|
var mailBody bytes.Buffer
|
||||||
|
|
|
@ -63,6 +63,7 @@ func sendRepoTransferNotifyMailPerLang(lang string, newOwner, doer *models.User,
|
||||||
// helper
|
// helper
|
||||||
"i18n": locale,
|
"i18n": locale,
|
||||||
"Str2html": templates.Str2html,
|
"Str2html": templates.Str2html,
|
||||||
|
"TrN": templates.TrN,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := bodyTemplates.ExecuteTemplate(&content, string(mailRepoTransferNotify), data); err != nil {
|
if err := bodyTemplates.ExecuteTemplate(&content, string(mailRepoTransferNotify), data); err != nil {
|
||||||
|
|
|
@ -30,11 +30,7 @@
|
||||||
|
|
||||||
{{.i18n.Tr "mail.issue.action.force_push" .Doer.Name .Comment.Issue.PullRequest.HeadBranch $oldCommitLink $newCommitLink | Str2html}}
|
{{.i18n.Tr "mail.issue.action.force_push" .Doer.Name .Comment.Issue.PullRequest.HeadBranch $oldCommitLink $newCommitLink | Str2html}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{if eq .Comment.Commits.Len 1}}
|
{{.i18n.Tr (TrN .i18n.Lang .Comment.Commits.Len "mail.issue.action.push_1" "mail.issue.action.push_n") .Doer.Name .Comment.Issue.PullRequest.HeadBranch .Comment.Commits.Len | Str2html}}
|
||||||
{{.i18n.Tr "mail.issue.action.push_1" .Doer.Name .Comment.Issue.PullRequest.HeadBranch | Str2html}}
|
|
||||||
{{else}}
|
|
||||||
{{.i18n.Tr "mail.issue.action.push_n" .Doer.Name .Comment.Issue.PullRequest.HeadBranch .Comment.Commits.Len | Str2html}}
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
{{end}}
|
||||||
</p>
|
</p>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
Reference in a new issue