diff options
author | 6543 <6543@obermui.de> | 2021-06-23 14:33:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-23 14:33:21 +0200 |
commit | be81dc8b20b86c87031cd1d2d7c9a2fe82f52ba8 (patch) | |
tree | ef1705f5c1dd04e8e1810af127aa5bd1afaed478 /templates/mail | |
parent | d4ae87ea32aaef458da48404b8c7bc11d0165852 (diff) | |
download | gitea-be81dc8b20b86c87031cd1d2d7c9a2fe82f52ba8.tar.gz gitea-be81dc8b20b86c87031cd1d2d7c9a2fe82f52ba8.zip |
Localize Email Templates (#16200)
close #14822
Diffstat (limited to 'templates/mail')
-rw-r--r-- | templates/mail/auth/activate.tmpl | 11 | ||||
-rw-r--r-- | templates/mail/auth/activate_email.tmpl | 11 | ||||
-rw-r--r-- | templates/mail/auth/register_notify.tmpl | 12 | ||||
-rw-r--r-- | templates/mail/auth/reset_passwd.tmpl | 10 | ||||
-rw-r--r-- | templates/mail/issue/assigned.tmpl | 12 | ||||
-rw-r--r-- | templates/mail/issue/default.tmpl | 44 | ||||
-rw-r--r-- | templates/mail/notify/collaborator.tmpl | 4 | ||||
-rw-r--r-- | templates/mail/notify/repo_transfer.tmpl | 5 | ||||
-rw-r--r-- | templates/mail/release.tmpl | 19 |
9 files changed, 73 insertions, 55 deletions
diff --git a/templates/mail/auth/activate.tmpl b/templates/mail/auth/activate.tmpl index 37fdbd7c7c..1f02041578 100644 --- a/templates/mail/auth/activate.tmpl +++ b/templates/mail/auth/activate.tmpl @@ -2,14 +2,15 @@ <html> <head> <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> +{{ $activate_url := printf "%suser/activate?code=%s" AppUrl .Code}} <body> - <p>Hi <b>{{.DisplayName}}</b>, thanks for registering at {{AppName}}!</p> - <p>Please click the following link to activate your account within <b>{{.ActiveCodeLives}}</b>:</p> - <p><a href="{{AppUrl}}user/activate?code={{.Code}}">{{AppUrl}}user/activate?code={{.Code}}</a></p> - <p>Not working? Try copying and pasting it to your browser.</p> + <p>{{.i18n.Tr "mail.activate_account.test_1" .DisplayName AppName | Str2html}}</p><br> + <p>{{.i18n.Tr "mail.activate_account.test_2" .ActiveCodeLives | Str2html}}</p><p><a href="{{$activate_url}}">{{$activate_url}}</a></p><br> + <p>{{.i18n.Tr "mail.link_not_working_do_paste" .DisplayName AppName | Str2html}}</p> + <p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p> </body> </html> diff --git a/templates/mail/auth/activate_email.tmpl b/templates/mail/auth/activate_email.tmpl index ebcaa0ee79..27cff3ba4c 100644 --- a/templates/mail/auth/activate_email.tmpl +++ b/templates/mail/auth/activate_email.tmpl @@ -2,14 +2,15 @@ <html> <head> <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> +{{ $activate_url := printf "%suser/activate_email?code=%s&email=%s" AppUrl .Code .Email}} <body> - <p>Hi <b>{{.DisplayName}}</b>,</p> - <p>Please click the following link to verify your email address within <b>{{.ActiveCodeLives}}</b>:</p> - <p><a href="{{AppUrl}}user/activate_email?code={{.Code}}&email={{.Email}}">{{AppUrl}}user/activate_email?code={{.Code}}&email={{.Email}}</a></p> - <p>Not working? Try copying and pasting it to your browser.</p> + <p>{{.i18n.Tr "mail.hi_user_x" .DisplayName | Str2html}}</p><br> + <p>{{.i18n.Tr "mail.activate_email.text" .ActiveCodeLives | Str2html}}</p><p><a href="{{$activate_url}}">{{$activate_url}}</a></p><br> + <p>{{.i18n.Tr "mail.link_not_working_do_paste" .DisplayName AppName | Str2html}}</p> + <p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p> </body> </html> diff --git a/templates/mail/auth/register_notify.tmpl b/templates/mail/auth/register_notify.tmpl index ea1857030a..e1ab97b760 100644 --- a/templates/mail/auth/register_notify.tmpl +++ b/templates/mail/auth/register_notify.tmpl @@ -2,14 +2,16 @@ <html> <head> <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> +{{$set_pwd_url := printf "%[1]suser/forgot_password" AppUrl}} <body> - <p>Hi <b>{{.DisplayName}}</b>, this is your registration confirmation email for {{AppName}}!</p> - <p>You can now login via username: {{.Username}}.</p> - <p><a href="{{AppUrl}}user/login">{{AppUrl}}user/login</a></p> - <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.hi_user_x" .DisplayName | Str2html}}</p><br> + <p>{{.i18n.Tr "mail.register_notify.text_1" AppName}}</p><br> + <p>{{.i18n.Tr "mail.register_notify.text_2" .Username}}</p><p><a href="{{AppUrl}}user/login">{{AppUrl}}user/login</a></p><br> + <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> </body> </html> diff --git a/templates/mail/auth/reset_passwd.tmpl b/templates/mail/auth/reset_passwd.tmpl index e01d57cea2..2a85abc6c5 100644 --- a/templates/mail/auth/reset_passwd.tmpl +++ b/templates/mail/auth/reset_passwd.tmpl @@ -2,15 +2,15 @@ <html> <head> <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> +{{ $recover_url := printf "%suser/recover_account?code=%s" AppUrl .Code}} <body> - <p>Hi <b>{{.DisplayName}}</b>,</p> - <p>Please click the following link to recover your account within <b>{{.ResetPwdCodeLives}}</b>:</p> + <p>{{.i18n.Tr "mail.hi_user_x" .DisplayName | Str2html}}</p><br> + <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> </body> </html> diff --git a/templates/mail/issue/assigned.tmpl b/templates/mail/issue/assigned.tmpl index 5b0d2526f1..61e4a44f02 100644 --- a/templates/mail/issue/assigned.tmpl +++ b/templates/mail/issue/assigned.tmpl @@ -8,13 +8,21 @@ <title>{{.Subject}}</title> </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> - <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"> <p> --- <br> - <a href="{{.Link}}">View it on {{AppName}}</a>. + <a href="{{.Link}}">{{.i18n.Tr "mail.view_it_on" AppName}}</a>. </p> </div> </body> diff --git a/templates/mail/issue/default.tmpl b/templates/mail/issue/default.tmpl index 02832c7e4d..61fe02037c 100644 --- a/templates/mail/issue/default.tmpl +++ b/templates/mail/issue/default.tmpl @@ -16,55 +16,57 @@ </head> <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"}} <p> - <b>{{.Doer.Name}}</b> {{if .Comment.IsForcePush}} - {{ $oldCommitLink:= 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}} - force-pushed the <b>{{.Comment.Issue.PullRequest.HeadBranch}}</b> from - <a href="{{$oldCommitLink}}"><b>{{ShortSha .Comment.OldCommit}}</b></a> - to - <a href="{{$newCommitLink}}"><b>{{ShortSha .Comment.NewCommit}}</b></a>. + {{$oldCommitUrl := printf "%s%s/%s/commit/%s" AppUrl .Comment.Issue.PullRequest.BaseRepo.OwnerName .Comment.Issue.PullRequest.BaseRepo.Name .Comment.OldCommit}} + {{$oldShortSha := ShortSha .Comment.OldCommit}} + {{$oldCommitLink := printf "<a href='%[1]s'><b>%[2]s</b></a>" $oldCommitUrl $oldShortSha}} + + {{$newCommitUrl := printf "%s%s/%s/commit/%s" AppUrl .Comment.Issue.PullRequest.BaseRepo.OwnerName .Comment.Issue.PullRequest.BaseRepo.Name .Comment.NewCommit}} + {{$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}} {{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}} - {{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}} </p> {{end}} <p> {{if eq .ActionName "close"}} - Closed #{{.Issue.Index}}. + {{.i18n.Tr "mail.issue.action.close" .Doer.Name .Issue.Index | Str2html}} {{else if eq .ActionName "reopen"}} - Reopened #{{.Issue.Index}}. + {{.i18n.Tr "mail.issue.action.reopen" .Doer.Name .Issue.Index | Str2html}} {{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"}} - <b>@{{.Doer.Name}}</b> approved this pull request. + {{.i18n.Tr "mail.issue.action.approve" .Doer.Name | Str2html}} {{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"}} - <b>@{{.Doer.Name}}</b> commented on this pull request. + {{.i18n.Tr "mail.issue.action.review" .Doer.Name | Str2html}} {{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"}} - <b>@{{.Doer.Name}}</b> marked this pull request ready for review. + {{.i18n.Tr "mail.issue.action.ready_for_review" .Doer.Name | Str2html}} {{end}} {{- if eq .Body ""}} {{if eq .ActionName "new"}} - Created #{{.Issue.Index}}. + {{.i18n.Tr "mail.issue.action.new" .Doer.Name .Issue.Index | Str2html}} {{end}} {{else}} {{.Body | Str2html}} {{end -}} {{- range .ReviewComments}} <hr> - In {{.TreePath}}: + {{.i18n.Tr "mail.issue.in_tree_path" .TreePath}} <div class="review"> <pre>{{.Patch}}</pre> <div>{{.RenderedContent | Safe}}</div> @@ -87,7 +89,7 @@ <p> --- <br> - <a href="{{.Link}}">View it on {{AppName}}</a>. + <a href="{{.Link}}">{{.i18n.Tr "mail.view_it_on" AppName}}</a>. </p> </div> </body> diff --git a/templates/mail/notify/collaborator.tmpl b/templates/mail/notify/collaborator.tmpl index 19a2431023..baa46bafda 100644 --- a/templates/mail/notify/collaborator.tmpl +++ b/templates/mail/notify/collaborator.tmpl @@ -9,12 +9,12 @@ </head> <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"> <p> --- <br> - <a href="{{.Link}}">View it on {{AppName}}</a>. + <a href="{{.Link}}">{{.i18n.Tr "mail.view_it_on" AppName}}</a>. </p> </div> </body> diff --git a/templates/mail/notify/repo_transfer.tmpl b/templates/mail/notify/repo_transfer.tmpl index e0dca8869d..4dea947401 100644 --- a/templates/mail/notify/repo_transfer.tmpl +++ b/templates/mail/notify/repo_transfer.tmpl @@ -5,13 +5,14 @@ <title>{{.Subject}}</title> </head> +{{$url := printf "<a href='%[1]s'>%[2]s</a>" .Link .Repo}} <body> <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> --- <br> - <a href="{{.Link}}">View it on {{AppName}}</a>. + <a href="{{.Link}}">{{.i18n.Tr "mail.view_it_on" AppName}}</a>. </p> </body> </html> diff --git a/templates/mail/release.tmpl b/templates/mail/release.tmpl index 7829bce243..fabe4999e3 100644 --- a/templates/mail/release.tmpl +++ b/templates/mail/release.tmpl @@ -11,14 +11,15 @@ </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> <p> - <b>@{{.Release.Publisher.Name}}</b> released <a href="{{.Release.HTMLURL}}">{{.Release.TagName}}</a> - in <a href="{{AppUrl}}{{.Release.Repo.OwnerName}}/{{.Release.Repo.Name}}">{{.Release.Repo.FullName}}</a> + {{.i18n.Tr "mail.release.new.text" .Release.Publisher.Name $release_url $repo_url | Str2html}} </p> - <h4>Title: {{.Release.Title}}</h4> + <h4>{{.i18n.Tr "mail.release.title" .Release.Title}}</h4> <p> - Note: <br> + {{.i18n.Tr "mail.release.note"}}<br> {{- if eq .Release.RenderedNote ""}} {{else}} {{.Release.RenderedNote | Str2html}} @@ -28,13 +29,15 @@ <p> --- <br> - Downloads: + {{.i18n.Tr "mail.release.downloads"}} <ul> + {{$tagname := .Release.TagName | EscapePound}} + {{$archive_url := printf "%s%s/%s/archive" AppUrl .Release.Repo.OwnerName .Release.Repo.Name}} <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> - <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> {{if .Release.Attachments}} {{range .Release.Attachments}} @@ -51,7 +54,7 @@ <p> --- <br> - <a href="{{.Release.HTMLURL}}">View it on {{AppName}}</a>. + <a href="{{.Link}}">{{.i18n.Tr "mail.view_it_on" AppName}}</a>. </p> </div> </body> |