Localize Email Templates (#16200)

close #14822
This commit is contained in:
6543 2021-06-23 14:33:21 +02:00 committed by GitHub
parent d4ae87ea32
commit be81dc8b20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 144 additions and 72 deletions

View File

@ -317,19 +317,64 @@ password_pwned = The password you chose is on a <a target="_blank" rel="noopener
password_pwned_err = Could not complete request to HaveIBeenPwned password_pwned_err = Could not complete request to HaveIBeenPwned
[mail] [mail]
view_it_on = View it on %s
link_not_working_do_paste = Not working? Try copying and pasting it to your browser.
hi_user_x = Hi <b>%s</b>,
activate_account = Please activate your account activate_account = Please activate your account
activate_account.title = %s, please activate your account
activate_account.test_1 = Hi <b>%[1]s</b>, thanks for registering at %[2]s!
activate_account.test_2 = Please click the following link to activate your account within <b>%s</b>:
activate_email = Verify your email address activate_email = Verify your email address
reset_password = Recover your account activate_email.title = %s, please verify your e-mail address
register_success = Registration successful activate_email.text = Please click the following link to verify your email address within <b>%s</b>:
register_notify = Welcome to Gitea register_notify = Welcome to Gitea
register_notify.title = %[1]s, welcome to %[2]s
register_notify.text_1 = this is your registration confirmation email for %s!
register_notify.text_2 = You can now login via username: %s.
register_notify.text_3 = If this account has been created for you, please <a href="%s">set your password</a> first.
reset_password = Recover your account
reset_password.title = %s, you have requested to recover your account
reset_password.text = Please click the following link to recover your account within <b>%s</b>:
register_success = Registration successful
issue_assigned.pull = @%[1]s assigned you to the pull request %[2]s in repository %[3]s.
issue_assigned.issue = @%[1]s assigned you to the issue %[2]s in repository %[3]s.
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.push_1 = <b>@%[1]s</b> pushed 1 commit to %[2]s
issue.action.push_n = <b>@%[1]s</b> pushed %[3]d commits to %s: %[2]s
issue.action.close = <b>@%[1]s</b> closed #%[2]d.
issue.action.reopen = <b>@%[1]s</b> reopened #%[2]d.
issue.action.merge = <b>@%[1]s</b> merged #%[2]d into #%[3]s.
issue.action.approve = <b>@%[1]s</b> approved this pull request.
issue.action.reject = <b>@%[1]s</b> requested changes on this pull request.
issue.action.review = <b>@%[1]s</b> commented on this pull request.
issue.action.review_dismissed = <b>@%[1]s</b> dismissed last review from %[2]s for this pull request.
issue.action.ready_for_review = <b>@%[1]s</b> marked this pull request ready for review.
issue.action.new = Created #%[2]d.
issue.in_tree_path = In %s:
release.new.subject = %s in %s released release.new.subject = %s in %s released
release.new.text = <b>@%[1]s</b> released %[2]s in %[3]s
release.title = Title: %s
release.note = Note:
release.downloads = Downloads:
release.download.zip = Source Code (ZIP)
release.download.targz = Source Code (TAR.GZ)
repo.transfer.subject_to = %s would like to transfer "%s" to %s repo.transfer.subject_to = %s would like to transfer "%s" to %s
repo.transfer.subject_to_you = %s would like to transfer "%s" to you repo.transfer.subject_to_you = %s would like to transfer "%s" to you
repo.transfer.to_you = you repo.transfer.to_you = you
repo.transfer.body = To accept or reject it visit %s or just ignore it.
repo.collaborator.added.subject = %s added you to %s repo.collaborator.added.subject = %s added you to %s
repo.collaborator.added.text = You have been added as a collaborator of repository:
[modal] [modal]
yes = Yes yes = Yes

View File

@ -22,6 +22,7 @@ import (
"code.gitea.io/gitea/modules/markup" "code.gitea.io/gitea/modules/markup"
"code.gitea.io/gitea/modules/markup/markdown" "code.gitea.io/gitea/modules/markup/markdown"
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/templates"
"code.gitea.io/gitea/modules/timeutil" "code.gitea.io/gitea/modules/timeutil"
"code.gitea.io/gitea/modules/translation" "code.gitea.io/gitea/modules/translation"
@ -67,13 +68,14 @@ func sendUserMail(language string, u *models.User, tpl base.TplName, code, subje
"ActiveCodeLives": timeutil.MinutesToFriendly(setting.Service.ActiveCodeLives, language), "ActiveCodeLives": timeutil.MinutesToFriendly(setting.Service.ActiveCodeLives, language),
"ResetPwdCodeLives": timeutil.MinutesToFriendly(setting.Service.ResetPwdCodeLives, language), "ResetPwdCodeLives": timeutil.MinutesToFriendly(setting.Service.ResetPwdCodeLives, language),
"Code": code, "Code": code,
"i18n": locale,
"Language": locale.Language(), "Language": locale.Language(),
// helper
"i18n": locale,
"Str2html": templates.Str2html,
} }
var content bytes.Buffer var content bytes.Buffer
// TODO: i18n templates?
if err := bodyTemplates.ExecuteTemplate(&content, string(tpl), data); err != nil { if err := bodyTemplates.ExecuteTemplate(&content, string(tpl), data); err != nil {
log.Error("Template: %v", err) log.Error("Template: %v", err)
return return
@ -104,13 +106,14 @@ func SendActivateEmailMail(u *models.User, email *models.EmailAddress) {
"ActiveCodeLives": timeutil.MinutesToFriendly(setting.Service.ActiveCodeLives, locale.Language()), "ActiveCodeLives": timeutil.MinutesToFriendly(setting.Service.ActiveCodeLives, locale.Language()),
"Code": u.GenerateEmailActivateCode(email.Email), "Code": u.GenerateEmailActivateCode(email.Email),
"Email": email.Email, "Email": email.Email,
"i18n": locale,
"Language": locale.Language(), "Language": locale.Language(),
// helper
"i18n": locale,
"Str2html": templates.Str2html,
} }
var content bytes.Buffer var content bytes.Buffer
// TODO: i18n templates?
if err := bodyTemplates.ExecuteTemplate(&content, string(mailAuthActivateEmail), data); err != nil { if err := bodyTemplates.ExecuteTemplate(&content, string(mailAuthActivateEmail), data); err != nil {
log.Error("Template: %v", err) log.Error("Template: %v", err)
return return
@ -129,13 +132,14 @@ func SendRegisterNotifyMail(u *models.User) {
data := map[string]interface{}{ data := map[string]interface{}{
"DisplayName": u.DisplayName(), "DisplayName": u.DisplayName(),
"Username": u.Name, "Username": u.Name,
"i18n": locale,
"Language": locale.Language(), "Language": locale.Language(),
// helper
"i18n": locale,
"Str2html": templates.Str2html,
} }
var content bytes.Buffer var content bytes.Buffer
// TODO: i18n templates?
if err := bodyTemplates.ExecuteTemplate(&content, string(mailAuthRegisterNotify), data); err != nil { if err := bodyTemplates.ExecuteTemplate(&content, string(mailAuthRegisterNotify), data); err != nil {
log.Error("Template: %v", err) log.Error("Template: %v", err)
return return
@ -157,13 +161,14 @@ func SendCollaboratorMail(u, doer *models.User, repo *models.Repository) {
"Subject": subject, "Subject": subject,
"RepoName": repoName, "RepoName": repoName,
"Link": repo.HTMLURL(), "Link": repo.HTMLURL(),
"i18n": locale,
"Language": locale.Language(), "Language": locale.Language(),
// helper
"i18n": locale,
"Str2html": templates.Str2html,
} }
var content bytes.Buffer var content bytes.Buffer
// TODO: i18n templates?
if err := bodyTemplates.ExecuteTemplate(&content, string(mailNotifyCollaborator), data); err != nil { if err := bodyTemplates.ExecuteTemplate(&content, string(mailNotifyCollaborator), data); err != nil {
log.Error("Template: %v", err) log.Error("Template: %v", err)
return return
@ -239,12 +244,13 @@ func composeIssueCommentMessages(ctx *mailCommentContext, lang string, recipient
"ActionType": actType, "ActionType": actType,
"ActionName": actName, "ActionName": actName,
"ReviewComments": reviewComments, "ReviewComments": reviewComments,
"i18n": locale,
"Language": locale.Language(), "Language": locale.Language(),
// helper
"i18n": locale,
"Str2html": templates.Str2html,
} }
var mailSubject bytes.Buffer var mailSubject bytes.Buffer
// TODO: i18n templates?
if err := subjectTemplates.ExecuteTemplate(&mailSubject, string(tplName), mailMeta); err == nil { if err := subjectTemplates.ExecuteTemplate(&mailSubject, string(tplName), mailMeta); err == nil {
subject = sanitizeSubject(mailSubject.String()) subject = sanitizeSubject(mailSubject.String())
if subject == "" { if subject == "" {
@ -260,7 +266,6 @@ func composeIssueCommentMessages(ctx *mailCommentContext, lang string, recipient
var mailBody bytes.Buffer var mailBody bytes.Buffer
// TODO: i18n templates?
if err := bodyTemplates.ExecuteTemplate(&mailBody, string(tplName), mailMeta); err != nil { if err := bodyTemplates.ExecuteTemplate(&mailBody, string(tplName), mailMeta); err != nil {
log.Error("ExecuteTemplate [%s]: %v", string(tplName)+"/body", err) log.Error("ExecuteTemplate [%s]: %v", string(tplName)+"/body", err)
} }

View File

@ -13,6 +13,7 @@ import (
"code.gitea.io/gitea/modules/markup" "code.gitea.io/gitea/modules/markup"
"code.gitea.io/gitea/modules/markup/markdown" "code.gitea.io/gitea/modules/markup/markdown"
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/templates"
"code.gitea.io/gitea/modules/translation" "code.gitea.io/gitea/modules/translation"
) )
@ -63,13 +64,14 @@ func mailNewRelease(lang string, tos []string, rel *models.Release) {
mailMeta := map[string]interface{}{ mailMeta := map[string]interface{}{
"Release": rel, "Release": rel,
"Subject": subject, "Subject": subject,
"i18n": locale,
"Language": locale.Language(), "Language": locale.Language(),
// helper
"i18n": locale,
"Str2html": templates.Str2html,
} }
var mailBody bytes.Buffer var mailBody bytes.Buffer
// TODO: i18n templates?
if err := bodyTemplates.ExecuteTemplate(&mailBody, string(tplNewReleaseMail), mailMeta); err != nil { if err := bodyTemplates.ExecuteTemplate(&mailBody, string(tplNewReleaseMail), mailMeta); err != nil {
log.Error("ExecuteTemplate [%s]: %v", string(tplNewReleaseMail)+"/body", err) log.Error("ExecuteTemplate [%s]: %v", string(tplNewReleaseMail)+"/body", err)
return return

View File

@ -9,6 +9,7 @@ import (
"fmt" "fmt"
"code.gitea.io/gitea/models" "code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/templates"
"code.gitea.io/gitea/modules/translation" "code.gitea.io/gitea/modules/translation"
) )
@ -57,12 +58,13 @@ func sendRepoTransferNotifyMailPerLang(lang string, newOwner, doer *models.User,
"Repo": repo.FullName(), "Repo": repo.FullName(),
"Link": repo.HTMLURL(), "Link": repo.HTMLURL(),
"Subject": subject, "Subject": subject,
"i18n": locale,
"Language": locale.Language(), "Language": locale.Language(),
"Destination": destination, "Destination": destination,
// helper
"i18n": locale,
"Str2html": templates.Str2html,
} }
// TODO: i18n templates?
if err := bodyTemplates.ExecuteTemplate(&content, string(mailRepoTransferNotify), data); err != nil { if err := bodyTemplates.ExecuteTemplate(&content, string(mailRepoTransferNotify), data); err != nil {
return err return err
} }

View File

@ -2,14 +2,15 @@
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{{.DisplayName}}, please activate your account</title> <title>{{.i18n.Tr "mail.activate_account.title" .DisplayName}}</title>
</head> </head>
{{ $activate_url := printf "%suser/activate?code=%s" AppUrl .Code}}
<body> <body>
<p>Hi <b>{{.DisplayName}}</b>, thanks for registering at {{AppName}}!</p> <p>{{.i18n.Tr "mail.activate_account.test_1" .DisplayName AppName | Str2html}}</p><br>
<p>Please click the following link to activate your account within <b>{{.ActiveCodeLives}}</b>:</p> <p>{{.i18n.Tr "mail.activate_account.test_2" .ActiveCodeLives | Str2html}}</p><p><a href="{{$activate_url}}">{{$activate_url}}</a></p><br>
<p><a href="{{AppUrl}}user/activate?code={{.Code}}">{{AppUrl}}user/activate?code={{.Code}}</a></p> <p>{{.i18n.Tr "mail.link_not_working_do_paste" .DisplayName AppName | Str2html}}</p>
<p>Not working? Try copying and pasting it to your browser.</p>
<p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p> <p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p>
</body> </body>
</html> </html>

View File

@ -2,14 +2,15 @@
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{{.DisplayName}}, please verify your e-mail address</title> <title>{{.i18n.Tr "mail.activate_email.title" .DisplayName}}</title>
</head> </head>
{{ $activate_url := printf "%suser/activate_email?code=%s&email=%s" AppUrl .Code .Email}}
<body> <body>
<p>Hi <b>{{.DisplayName}}</b>,</p> <p>{{.i18n.Tr "mail.hi_user_x" .DisplayName | Str2html}}</p><br>
<p>Please click the following link to verify your email address within <b>{{.ActiveCodeLives}}</b>:</p> <p>{{.i18n.Tr "mail.activate_email.text" .ActiveCodeLives | Str2html}}</p><p><a href="{{$activate_url}}">{{$activate_url}}</a></p><br>
<p><a href="{{AppUrl}}user/activate_email?code={{.Code}}&email={{.Email}}">{{AppUrl}}user/activate_email?code={{.Code}}&email={{.Email}}</a></p> <p>{{.i18n.Tr "mail.link_not_working_do_paste" .DisplayName AppName | Str2html}}</p>
<p>Not working? Try copying and pasting it to your browser.</p>
<p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p> <p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p>
</body> </body>
</html> </html>

View File

@ -2,14 +2,16 @@
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{{.DisplayName}}, welcome to {{AppName}}</title> <title>{{.i18n.Tr "mail.register_notify.title" .DisplayName AppName}}</title>
</head> </head>
{{$set_pwd_url := printf "%[1]suser/forgot_password" AppUrl}}
<body> <body>
<p>Hi <b>{{.DisplayName}}</b>, this is your registration confirmation email for {{AppName}}!</p> <p>{{.i18n.Tr "mail.hi_user_x" .DisplayName | Str2html}}</p><br>
<p>You can now login via username: {{.Username}}.</p> <p>{{.i18n.Tr "mail.register_notify.text_1" AppName}}</p><br>
<p><a href="{{AppUrl}}user/login">{{AppUrl}}user/login</a></p> <p>{{.i18n.Tr "mail.register_notify.text_2" .Username}}</p><p><a href="{{AppUrl}}user/login">{{AppUrl}}user/login</a></p><br>
<p>If this account has been created for you, please <a href="{{AppUrl}}user/forgot_password">set your password</a> first.</p> <p>{{.i18n.Tr "mail.register_notify.text_3" $set_pwd_url | Str2html}}</p><br>
<p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p> <p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p>
</body> </body>
</html> </html>

View File

@ -2,15 +2,15 @@
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{{.DisplayName}}, you have requested to recover your account</title> <title>{{.i18n.Tr "mail.reset_password.title" .DisplayName}}</title>
</head> </head>
{{ $recover_url := printf "%suser/recover_account?code=%s" AppUrl .Code}}
<body> <body>
<p>Hi <b>{{.DisplayName}}</b>,</p> <p>{{.i18n.Tr "mail.hi_user_x" .DisplayName | Str2html}}</p><br>
<p>Please click the following link to recover your account within <b>{{.ResetPwdCodeLives}}</b>:</p> <p>{{.i18n.Tr "mail.reset_password.text" .ResetPwdCodeLives | Str2html}}</p><p><a href="{{$recover_url}}">{{$recover_url}}</a></p><br>
<p>{{.i18n.Tr "mail.link_not_working_do_paste" .DisplayName AppName | Str2html}}</p>
<p><a href="{{AppUrl}}user/recover_account?code={{.Code}}">{{AppUrl}}user/recover_account?code={{.Code}}</a></p>
<p>Not working? Try copying and pasting it to your browser.</p>
<p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p> <p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p>
</body> </body>
</html> </html>

View File

@ -8,13 +8,21 @@
<title>{{.Subject}}</title> <title>{{.Subject}}</title>
</head> </head>
{{$repo_url := printf "<a href='%s'>%s</a>" .Release.Repo.HTMLURL .Release.Repo.FullName}}
{{$link := printf "<a href='%s'>#%d</a>" .Link .Issue.Index}}
<body> <body>
<p>@{{.Doer.Name}} assigned you to the {{if .IsPull}}pull request{{else}}issue{{end}} <a href="{{.Link}}">#{{.Issue.Index}}</a> in repository {{.Repo}}.</p> <p>
{{if .IsPull}}
{{.i18n.Tr "mail.issue_assigned.pull" .Doer.Name $link $repo_url | Str2html}}
{{else}}
{{.i18n.Tr "mail.issue_assigned.issue" .Doer.Name $link $repo_url | Str2html}}
{{end}}
</p>
<div class="footer"> <div class="footer">
<p> <p>
--- ---
<br> <br>
<a href="{{.Link}}">View it on {{AppName}}</a>. <a href="{{.Link}}">{{.i18n.Tr "mail.view_it_on" AppName}}</a>.
</p> </p>
</div> </div>
</body> </body>

View File

@ -16,55 +16,57 @@
</head> </head>
<body> <body>
{{if .IsMention}}<p><b>@{{.Doer.Name}}</b> mentioned you:</p>{{end}} {{if .IsMention}}<p>{{.i18n.Tr "mail.issue.x_mentioned_you" .Doer.Name | Str2html}}</p>{{end}}
{{if eq .ActionName "push"}} {{if eq .ActionName "push"}}
<p> <p>
<b>{{.Doer.Name}}</b>
{{if .Comment.IsForcePush}} {{if .Comment.IsForcePush}}
{{ $oldCommitLink:= printf "%s%s/%s/commit/%s" AppUrl .Comment.Issue.PullRequest.BaseRepo.OwnerName .Comment.Issue.PullRequest.BaseRepo.Name .Comment.OldCommit}} {{$oldCommitUrl := printf "%s%s/%s/commit/%s" AppUrl .Comment.Issue.PullRequest.BaseRepo.OwnerName .Comment.Issue.PullRequest.BaseRepo.Name .Comment.OldCommit}}
{{ $newCommitLink:= printf "%s%s/%s/commit/%s" AppUrl .Comment.Issue.PullRequest.BaseRepo.OwnerName .Comment.Issue.PullRequest.BaseRepo.Name .Comment.NewCommit}} {{$oldShortSha := ShortSha .Comment.OldCommit}}
force-pushed the <b>{{.Comment.Issue.PullRequest.HeadBranch}}</b> from {{$oldCommitLink := printf "<a href='%[1]s'><b>%[2]s</b></a>" $oldCommitUrl $oldShortSha}}
<a href="{{$oldCommitLink}}"><b>{{ShortSha .Comment.OldCommit}}</b></a>
to {{$newCommitUrl := printf "%s%s/%s/commit/%s" AppUrl .Comment.Issue.PullRequest.BaseRepo.OwnerName .Comment.Issue.PullRequest.BaseRepo.Name .Comment.NewCommit}}
<a href="{{$newCommitLink}}"><b>{{ShortSha .Comment.NewCommit}}</b></a>. {{$newShortSha := ShortSha .Comment.NewCommit}}
{{$newCommitLink := printf "<a href='%[1]s'><b>%[2]s</b></a>" $newCommitUrl $newShortSha}}
{{.i18n.Tr "mail.issue.action.force_push" .Doer.Name .Comment.Issue.PullRequest.HeadBranch $oldCommitLink $newCommitLink | Str2html}}
{{else}} {{else}}
{{if eq .Comment.Commits.Len 1}} {{if eq .Comment.Commits.Len 1}}
{{printf "pushed 1 commit to %s:" .Comment.Issue.PullRequest.HeadBranch}} {{.i18n.Tr "mail.issue.action.push_1" .Doer.Name .Comment.Issue.PullRequest.HeadBranch | Str2html}}
{{else}} {{else}}
{{printf "pushed %d commits to %s:" .Comment.Commits.Len .Comment.Issue.PullRequest.HeadBranch}} {{.i18n.Tr "mail.issue.action.push_1" .Doer.Name .Comment.Issue.PullRequest.HeadBranch .Comment.Commits.Len | Str2html}}
{{end}} {{end}}
{{end}} {{end}}
</p> </p>
{{end}} {{end}}
<p> <p>
{{if eq .ActionName "close"}} {{if eq .ActionName "close"}}
Closed #{{.Issue.Index}}. {{.i18n.Tr "mail.issue.action.close" .Doer.Name .Issue.Index | Str2html}}
{{else if eq .ActionName "reopen"}} {{else if eq .ActionName "reopen"}}
Reopened #{{.Issue.Index}}. {{.i18n.Tr "mail.issue.action.reopen" .Doer.Name .Issue.Index | Str2html}}
{{else if eq .ActionName "merge"}} {{else if eq .ActionName "merge"}}
Merged #{{.Issue.Index}} into {{.Issue.PullRequest.BaseBranch}}. {{.i18n.Tr "mail.issue.action.merge" .Doer.Name .Issue.Index .Issue.PullRequest.BaseBranch | Str2html}}
{{else if eq .ActionName "approve"}} {{else if eq .ActionName "approve"}}
<b>@{{.Doer.Name}}</b> approved this pull request. {{.i18n.Tr "mail.issue.action.approve" .Doer.Name | Str2html}}
{{else if eq .ActionName "reject"}} {{else if eq .ActionName "reject"}}
<b>@{{.Doer.Name}}</b> requested changes on this pull request. {{.i18n.Tr "mail.issue.action.reject" .Doer.Name | Str2html}}
{{else if eq .ActionName "review"}} {{else if eq .ActionName "review"}}
<b>@{{.Doer.Name}}</b> commented on this pull request. {{.i18n.Tr "mail.issue.action.review" .Doer.Name | Str2html}}
{{else if eq .ActionName "review_dismissed"}} {{else if eq .ActionName "review_dismissed"}}
<b>@{{.Doer.Name}}</b> dismissed last review from {{.Comment.Review.Reviewer.Name}} for this pull request. {{.i18n.Tr "mail.issue.action.review_dismissed" .Doer.Name .Comment.Review.Reviewer.Name | Str2html}}
{{else if eq .ActionName "ready_for_review"}} {{else if eq .ActionName "ready_for_review"}}
<b>@{{.Doer.Name}}</b> marked this pull request ready for review. {{.i18n.Tr "mail.issue.action.ready_for_review" .Doer.Name | Str2html}}
{{end}} {{end}}
{{- if eq .Body ""}} {{- if eq .Body ""}}
{{if eq .ActionName "new"}} {{if eq .ActionName "new"}}
Created #{{.Issue.Index}}. {{.i18n.Tr "mail.issue.action.new" .Doer.Name .Issue.Index | Str2html}}
{{end}} {{end}}
{{else}} {{else}}
{{.Body | Str2html}} {{.Body | Str2html}}
{{end -}} {{end -}}
{{- range .ReviewComments}} {{- range .ReviewComments}}
<hr> <hr>
In {{.TreePath}}: {{.i18n.Tr "mail.issue.in_tree_path" .TreePath}}
<div class="review"> <div class="review">
<pre>{{.Patch}}</pre> <pre>{{.Patch}}</pre>
<div>{{.RenderedContent | Safe}}</div> <div>{{.RenderedContent | Safe}}</div>
@ -87,7 +89,7 @@
<p> <p>
--- ---
<br> <br>
<a href="{{.Link}}">View it on {{AppName}}</a>. <a href="{{.Link}}">{{.i18n.Tr "mail.view_it_on" AppName}}</a>.
</p> </p>
</div> </div>
</body> </body>

View File

@ -9,12 +9,12 @@
</head> </head>
<body> <body>
<p>You have been added as a collaborator of repository: <code>{{.RepoName}}</code></p> <p>{{.i18n.Tr "mail.repo.collaborator.added.text"}} <code>{{.RepoName}}</code></p>
<div class="footer"> <div class="footer">
<p> <p>
--- ---
<br> <br>
<a href="{{.Link}}">View it on {{AppName}}</a>. <a href="{{.Link}}">{{.i18n.Tr "mail.view_it_on" AppName}}</a>.
</p> </p>
</div> </div>
</body> </body>

View File

@ -5,13 +5,14 @@
<title>{{.Subject}}</title> <title>{{.Subject}}</title>
</head> </head>
{{$url := printf "<a href='%[1]s'>%[2]s</a>" .Link .Repo}}
<body> <body>
<p>{{.Subject}}. <p>{{.Subject}}.
To accept or reject it visit <a href="{{.Link}}">{{.Repo}}</a> or just ignore it. {{.i18n.Tr "mail.repo.transfer.body" $url | Str2html}}
<p> <p>
--- ---
<br> <br>
<a href="{{.Link}}">View it on {{AppName}}</a>. <a href="{{.Link}}">{{.i18n.Tr "mail.view_it_on" AppName}}</a>.
</p> </p>
</body> </body>
</html> </html>

View File

@ -11,14 +11,15 @@
</head> </head>
{{$release_url := printf "<a href='%s'>%s</a>" .Release.HTMLURL .Release.TagName}}
{{$repo_url := printf "<a href='%s'>%s</a>" .Release.Repo.HTMLURL .Release.Repo.FullName}}
<body> <body>
<p> <p>
<b>@{{.Release.Publisher.Name}}</b> released <a href="{{.Release.HTMLURL}}">{{.Release.TagName}}</a> {{.i18n.Tr "mail.release.new.text" .Release.Publisher.Name $release_url $repo_url | Str2html}}
in <a href="{{AppUrl}}{{.Release.Repo.OwnerName}}/{{.Release.Repo.Name}}">{{.Release.Repo.FullName}}</a>
</p> </p>
<h4>Title: {{.Release.Title}}</h4> <h4>{{.i18n.Tr "mail.release.title" .Release.Title}}</h4>
<p> <p>
Note: <br> {{.i18n.Tr "mail.release.note"}}<br>
{{- if eq .Release.RenderedNote ""}} {{- if eq .Release.RenderedNote ""}}
{{else}} {{else}}
{{.Release.RenderedNote | Str2html}} {{.Release.RenderedNote | Str2html}}
@ -28,13 +29,15 @@
<p> <p>
--- ---
<br> <br>
Downloads: {{.i18n.Tr "mail.release.downloads"}}
<ul> <ul>
{{$tagname := .Release.TagName | EscapePound}}
{{$archive_url := printf "%s%s/%s/archive" AppUrl .Release.Repo.OwnerName .Release.Repo.Name}}
<li> <li>
<a href="{{AppUrl}}{{.Release.Repo.OwnerName}}/{{.Release.Repo.Name}}/archive/{{.Release.TagName | EscapePound}}.zip" rel="nofollow"><strong> Source Code (ZIP)</strong></a> <a href="{{$archive_url}}/{{$tagname}}.zip" rel="nofollow"><strong>{{.i18n.Tr "mail.release.download.zip"}}</strong></a>
</li> </li>
<li> <li>
<a href="{{AppUrl}}{{.Release.Repo.OwnerName}}/{{.Release.Repo.Name}}/archive/{{.Release.TagName | EscapePound}}.tar.gz"><strong> Source Code (TAR.GZ)</strong></a> <a href="{{$archive_url}}/{{$tagname}}.tar.gz" rel="nofollow"><strong>{{.i18n.Tr "mail.release.download.targz"}}</strong></a>
</li> </li>
{{if .Release.Attachments}} {{if .Release.Attachments}}
{{range .Release.Attachments}} {{range .Release.Attachments}}
@ -51,7 +54,7 @@
<p> <p>
--- ---
<br> <br>
<a href="{{.Release.HTMLURL}}">View it on {{AppName}}</a>. <a href="{{.Link}}">{{.i18n.Tr "mail.view_it_on" AppName}}</a>.
</p> </p>
</div> </div>
</body> </body>