From be81dc8b20b86c87031cd1d2d7c9a2fe82f52ba8 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Wed, 23 Jun 2021 14:33:21 +0200 Subject: Localize Email Templates (#16200) close #14822 --- templates/mail/auth/activate.tmpl | 11 ++++---- templates/mail/auth/activate_email.tmpl | 11 ++++---- templates/mail/auth/register_notify.tmpl | 12 +++++---- templates/mail/auth/reset_passwd.tmpl | 10 ++++---- templates/mail/issue/assigned.tmpl | 12 +++++++-- templates/mail/issue/default.tmpl | 44 +++++++++++++++++--------------- templates/mail/notify/collaborator.tmpl | 4 +-- templates/mail/notify/repo_transfer.tmpl | 5 ++-- templates/mail/release.tmpl | 19 ++++++++------ 9 files changed, 73 insertions(+), 55 deletions(-) (limited to 'templates/mail') 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 @@ - {{.DisplayName}}, please activate your account + {{.i18n.Tr "mail.activate_account.title" .DisplayName}} +{{ $activate_url := printf "%suser/activate?code=%s" AppUrl .Code}} -

Hi {{.DisplayName}}, thanks for registering at {{AppName}}!

-

Please click the following link to activate your account within {{.ActiveCodeLives}}:

-

{{AppUrl}}user/activate?code={{.Code}}

-

Not working? Try copying and pasting it to your browser.

+

{{.i18n.Tr "mail.activate_account.test_1" .DisplayName AppName | Str2html}}


+

{{.i18n.Tr "mail.activate_account.test_2" .ActiveCodeLives | Str2html}}

{{$activate_url}}


+

{{.i18n.Tr "mail.link_not_working_do_paste" .DisplayName AppName | Str2html}}

+

© {{AppName}}

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 @@ - {{.DisplayName}}, please verify your e-mail address + {{.i18n.Tr "mail.activate_email.title" .DisplayName}} +{{ $activate_url := printf "%suser/activate_email?code=%s&email=%s" AppUrl .Code .Email}} -

Hi {{.DisplayName}},

-

Please click the following link to verify your email address within {{.ActiveCodeLives}}:

-

{{AppUrl}}user/activate_email?code={{.Code}}&email={{.Email}}

-

Not working? Try copying and pasting it to your browser.

+

{{.i18n.Tr "mail.hi_user_x" .DisplayName | Str2html}}


+

{{.i18n.Tr "mail.activate_email.text" .ActiveCodeLives | Str2html}}

{{$activate_url}}


+

{{.i18n.Tr "mail.link_not_working_do_paste" .DisplayName AppName | Str2html}}

+

© {{AppName}}

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 @@ - {{.DisplayName}}, welcome to {{AppName}} + {{.i18n.Tr "mail.register_notify.title" .DisplayName AppName}} +{{$set_pwd_url := printf "%[1]suser/forgot_password" AppUrl}} -

Hi {{.DisplayName}}, this is your registration confirmation email for {{AppName}}!

-

You can now login via username: {{.Username}}.

-

{{AppUrl}}user/login

-

If this account has been created for you, please set your password first.

+

{{.i18n.Tr "mail.hi_user_x" .DisplayName | Str2html}}


+

{{.i18n.Tr "mail.register_notify.text_1" AppName}}


+

{{.i18n.Tr "mail.register_notify.text_2" .Username}}

{{AppUrl}}user/login


+

{{.i18n.Tr "mail.register_notify.text_3" $set_pwd_url | Str2html}}


+

© {{AppName}}

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 @@ - {{.DisplayName}}, you have requested to recover your account + {{.i18n.Tr "mail.reset_password.title" .DisplayName}} +{{ $recover_url := printf "%suser/recover_account?code=%s" AppUrl .Code}} -

Hi {{.DisplayName}},

-

Please click the following link to recover your account within {{.ResetPwdCodeLives}}:

+

{{.i18n.Tr "mail.hi_user_x" .DisplayName | Str2html}}


+

{{.i18n.Tr "mail.reset_password.text" .ResetPwdCodeLives | Str2html}}

{{$recover_url}}


+

{{.i18n.Tr "mail.link_not_working_do_paste" .DisplayName AppName | Str2html}}

-

{{AppUrl}}user/recover_account?code={{.Code}}

-

Not working? Try copying and pasting it to your browser.

© {{AppName}}

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 @@ {{.Subject}} +{{$repo_url := printf "%s" .Release.Repo.HTMLURL .Release.Repo.FullName}} +{{$link := printf "#%d" .Link .Issue.Index}} -

@{{.Doer.Name}} assigned you to the {{if .IsPull}}pull request{{else}}issue{{end}} #{{.Issue.Index}} in repository {{.Repo}}.

+

+ {{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}} +

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 @@ - {{if .IsMention}}

@{{.Doer.Name}} mentioned you:

{{end}} + {{if .IsMention}}

{{.i18n.Tr "mail.issue.x_mentioned_you" .Doer.Name | Str2html}}

{{end}} {{if eq .ActionName "push"}}

- {{.Doer.Name}} {{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 {{.Comment.Issue.PullRequest.HeadBranch}} from - {{ShortSha .Comment.OldCommit}} - to - {{ShortSha .Comment.NewCommit}}. + {{$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 "%[2]s" $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 "%[2]s" $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}}

{{end}}

{{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"}} - @{{.Doer.Name}} approved this pull request. + {{.i18n.Tr "mail.issue.action.approve" .Doer.Name | Str2html}} {{else if eq .ActionName "reject"}} - @{{.Doer.Name}} requested changes on this pull request. + {{.i18n.Tr "mail.issue.action.reject" .Doer.Name | Str2html}} {{else if eq .ActionName "review"}} - @{{.Doer.Name}} commented on this pull request. + {{.i18n.Tr "mail.issue.action.review" .Doer.Name | Str2html}} {{else if eq .ActionName "review_dismissed"}} - @{{.Doer.Name}} 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"}} - @{{.Doer.Name}} 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}}


- In {{.TreePath}}: + {{.i18n.Tr "mail.issue.in_tree_path" .TreePath}}
{{.Patch}}
{{.RenderedContent | Safe}}
@@ -87,7 +89,7 @@

---
- View it on {{AppName}}. + {{.i18n.Tr "mail.view_it_on" AppName}}.

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 @@ -

You have been added as a collaborator of repository: {{.RepoName}}

+

{{.i18n.Tr "mail.repo.collaborator.added.text"}} {{.RepoName}}

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 @@ {{.Subject}} +{{$url := printf "%[2]s" .Link .Repo}}

{{.Subject}}. - To accept or reject it visit {{.Repo}} or just ignore it. + {{.i18n.Tr "mail.repo.transfer.body" $url | Str2html}}

---
- View it on {{AppName}}. + {{.i18n.Tr "mail.view_it_on" AppName}}.

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 @@ +{{$release_url := printf "%s" .Release.HTMLURL .Release.TagName}} +{{$repo_url := printf "%s" .Release.Repo.HTMLURL .Release.Repo.FullName}}

- @{{.Release.Publisher.Name}} released {{.Release.TagName}} - in {{.Release.Repo.FullName}} + {{.i18n.Tr "mail.release.new.text" .Release.Publisher.Name $release_url $repo_url | Str2html}}

-

Title: {{.Release.Title}}

+

{{.i18n.Tr "mail.release.title" .Release.Title}}

- Note:
+ {{.i18n.Tr "mail.release.note"}}
{{- if eq .Release.RenderedNote ""}} {{else}} {{.Release.RenderedNote | Str2html}} @@ -28,13 +29,15 @@

---
- Downloads: + {{.i18n.Tr "mail.release.downloads"}}