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 @@
-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}}
{{.i18n.Tr "mail.link_not_working_do_paste" .DisplayName AppName | Str2html}}
+ 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 @@ -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}}
{{.i18n.Tr "mail.link_not_working_do_paste" .DisplayName AppName | Str2html}}
+ 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 @@ -Hi {{.DisplayName}}, this is your registration confirmation email for {{AppName}}!
-You can now login via username: {{.Username}}.
- -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}}
{{.i18n.Tr "mail.register_notify.text_3" $set_pwd_url | Str2html}}
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}}
{{.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.
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 @@@{{.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}}
{{.Patch}}
---
- View it on {{AppName}}.
+ {{.i18n.Tr "mail.view_it_on" AppName}}.
You have been added as a collaborator of repository: {{.RepoName}}
{{.i18n.Tr "mail.repo.collaborator.added.text"}} {{.RepoName}}
{{.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}}.