1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

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
13 changed files with 144 additions and 72 deletions

View File

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

View File

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