mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Refactor i18n
to locale
(#20153)
* Refactor `i18n` to `locale` - Currently we're using the `i18n` variable naming for the `locale` struct. This contains locale's specific information and cannot be used for general i18n purpose, therefore refactoring it to `locale` makes more sense. - Ref: https://github.com/go-gitea/gitea/pull/20096#discussion_r906699200 * Update routers/install/install.go
This commit is contained in:
@@ -3,14 +3,14 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="format-detection" content="telephone=no,date=no,address=no,email=no,url=no"/>
|
||||
<title>{{.i18n.Tr "mail.activate_account.title" (.DisplayName|DotEscape)}}</title>
|
||||
<title>{{.locale.Tr "mail.activate_account.title" (.DisplayName|DotEscape)}}</title>
|
||||
</head>
|
||||
|
||||
{{ $activate_url := printf "%suser/activate?code=%s" AppUrl (QueryEscape .Code)}}
|
||||
<body>
|
||||
<p>{{.i18n.Tr "mail.activate_account.text_1" (.DisplayName|DotEscape) AppName | Str2html}}</p><br>
|
||||
<p>{{.i18n.Tr "mail.activate_account.text_2" .ActiveCodeLives | Str2html}}</p><p><a href="{{$activate_url}}">{{$activate_url}}</a></p><br>
|
||||
<p>{{.i18n.Tr "mail.link_not_working_do_paste"}}</p>
|
||||
<p>{{.locale.Tr "mail.activate_account.text_1" (.DisplayName|DotEscape) AppName | Str2html}}</p><br>
|
||||
<p>{{.locale.Tr "mail.activate_account.text_2" .ActiveCodeLives | Str2html}}</p><p><a href="{{$activate_url}}">{{$activate_url}}</a></p><br>
|
||||
<p>{{.locale.Tr "mail.link_not_working_do_paste"}}</p>
|
||||
|
||||
<p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p>
|
||||
</body>
|
||||
|
@@ -2,15 +2,15 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="format-detection" content="telephone=no,date=no,address=no,email=no,url=no"/>
|
||||
<title>{{.i18n.Tr "mail.activate_email.title" (.DisplayName|DotEscape)}}</title>
|
||||
<meta Name="format-detection" content="telephone=no,date=no,address=no,email=no,url=no"/>
|
||||
<title>{{.locale.Tr "mail.activate_email.title" (.DisplayName|DotEscape)}}</title>
|
||||
</head>
|
||||
|
||||
{{ $activate_url := printf "%suser/activate_email?code=%s&email=%s" AppUrl (QueryEscape .Code) (QueryEscape .Email)}}
|
||||
<body>
|
||||
<p>{{.i18n.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | 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"}}</p>
|
||||
<p>{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | Str2html}}</p><br>
|
||||
<p>{{.locale.Tr "mail.activate_email.text" .ActiveCodeLives | Str2html}}</p><p><a href="{{$activate_url}}">{{$activate_url}}</a></p><br>
|
||||
<p>{{.locale.Tr "mail.link_not_working_do_paste"}}</p>
|
||||
|
||||
<p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p>
|
||||
</body>
|
||||
|
@@ -3,15 +3,15 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="format-detection" content="telephone=no,date=no,address=no,email=no,url=no"/>
|
||||
<title>{{.i18n.Tr "mail.register_notify.title" (.DisplayName|DotEscape) AppName}}</title>
|
||||
<title>{{.locale.Tr "mail.register_notify.title" (.DisplayName|DotEscape) AppName}}</title>
|
||||
</head>
|
||||
|
||||
{{$set_pwd_url := printf "%[1]suser/forgot_password" AppUrl}}
|
||||
<body>
|
||||
<p>{{.i18n.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | 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 | Escape) | Str2html}}</p><br>
|
||||
<p>{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | Str2html}}</p><br>
|
||||
<p>{{.locale.Tr "mail.register_notify.text_1" AppName}}</p><br>
|
||||
<p>{{.locale.Tr "mail.register_notify.text_2" .Username}}</p><p><a href="{{AppUrl}}user/login">{{AppUrl}}user/login</a></p><br>
|
||||
<p>{{.locale.Tr "mail.register_notify.text_3" ($set_pwd_url | Escape) | Str2html}}</p><br>
|
||||
|
||||
<p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p>
|
||||
</body>
|
||||
|
@@ -3,14 +3,14 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="format-detection" content="telephone=no,date=no,address=no,email=no,url=no"/>
|
||||
<title>{{.i18n.Tr "mail.reset_password.title" (.DisplayName|DotEscape)}}</title>
|
||||
<title>{{.locale.Tr "mail.reset_password.title" (.DisplayName|DotEscape)}}</title>
|
||||
</head>
|
||||
|
||||
{{ $recover_url := printf "%suser/recover_account?code=%s" AppUrl (QueryEscape .Code)}}
|
||||
<body>
|
||||
<p>{{.i18n.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | 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"}}</p>
|
||||
<p>{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | Str2html}}</p><br>
|
||||
<p>{{.locale.Tr "mail.reset_password.text" .ResetPwdCodeLives | Str2html}}</p><p><a href="{{$recover_url}}">{{$recover_url}}</a></p><br>
|
||||
<p>{{.locale.Tr "mail.link_not_working_do_paste"}}</p>
|
||||
|
||||
<p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p>
|
||||
</body>
|
||||
|
@@ -13,16 +13,16 @@
|
||||
<body>
|
||||
<p>
|
||||
{{if .IsPull}}
|
||||
{{.i18n.Tr "mail.issue_assigned.pull" .Doer.Name $link $repo_url | Str2html}}
|
||||
{{.locale.Tr "mail.issue_assigned.pull" .Doer.Name $link $repo_url | Str2html}}
|
||||
{{else}}
|
||||
{{.i18n.Tr "mail.issue_assigned.issue" .Doer.Name $link $repo_url | Str2html}}
|
||||
{{.locale.Tr "mail.issue_assigned.issue" .Doer.Name $link $repo_url | Str2html}}
|
||||
{{end}}
|
||||
</p>
|
||||
<div class="footer">
|
||||
<p>
|
||||
---
|
||||
<br>
|
||||
<a href="{{.Link}}">{{.i18n.Tr "mail.view_it_on" AppName}}</a>.
|
||||
<a href="{{.Link}}">{{.locale.Tr "mail.view_it_on" AppName}}</a>.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
|
@@ -16,7 +16,7 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{{if .IsMention}}<p>{{.i18n.Tr "mail.issue.x_mentioned_you" .Doer.Name | Str2html}}</p>{{end}}
|
||||
{{if .IsMention}}<p>{{.locale.Tr "mail.issue.x_mentioned_you" .Doer.Name | Str2html}}</p>{{end}}
|
||||
{{if eq .ActionName "push"}}
|
||||
<p>
|
||||
{{if .Comment.IsForcePush}}
|
||||
@@ -28,41 +28,41 @@
|
||||
{{$newShortSha := ShortSha .Comment.NewCommit}}
|
||||
{{$newCommitLink := printf "<a href='%[1]s'><b>%[2]s</b></a>" (Escape $newCommitUrl) (Escape $newShortSha)}}
|
||||
|
||||
{{.i18n.Tr "mail.issue.action.force_push" .Doer.Name .Comment.Issue.PullRequest.HeadBranch $oldCommitLink $newCommitLink | Str2html}}
|
||||
{{.locale.Tr "mail.issue.action.force_push" .Doer.Name .Comment.Issue.PullRequest.HeadBranch $oldCommitLink $newCommitLink | Str2html}}
|
||||
{{else}}
|
||||
{{.i18n.TrN (len .Comment.Commits) "mail.issue.action.push_1" "mail.issue.action.push_n" .Doer.Name .Comment.Issue.PullRequest.HeadBranch (len .Comment.Commits) | Str2html}}
|
||||
{{.locale.TrN (len .Comment.Commits) "mail.issue.action.push_1" "mail.issue.action.push_n" .Doer.Name .Comment.Issue.PullRequest.HeadBranch (len .Comment.Commits) | Str2html}}
|
||||
{{end}}
|
||||
</p>
|
||||
{{end}}
|
||||
<p>
|
||||
{{if eq .ActionName "close"}}
|
||||
{{.i18n.Tr "mail.issue.action.close" (Escape .Doer.Name) .Issue.Index | Str2html}}
|
||||
{{.locale.Tr "mail.issue.action.close" (Escape .Doer.Name) .Issue.Index | Str2html}}
|
||||
{{else if eq .ActionName "reopen"}}
|
||||
{{.i18n.Tr "mail.issue.action.reopen" (Escape .Doer.Name) .Issue.Index | Str2html}}
|
||||
{{.locale.Tr "mail.issue.action.reopen" (Escape .Doer.Name) .Issue.Index | Str2html}}
|
||||
{{else if eq .ActionName "merge"}}
|
||||
{{.i18n.Tr "mail.issue.action.merge" (Escape .Doer.Name) .Issue.Index (Escape .Issue.PullRequest.BaseBranch) | Str2html}}
|
||||
{{.locale.Tr "mail.issue.action.merge" (Escape .Doer.Name) .Issue.Index (Escape .Issue.PullRequest.BaseBranch) | Str2html}}
|
||||
{{else if eq .ActionName "approve"}}
|
||||
{{.i18n.Tr "mail.issue.action.approve" (Escape .Doer.Name) | Str2html}}
|
||||
{{.locale.Tr "mail.issue.action.approve" (Escape .Doer.Name) | Str2html}}
|
||||
{{else if eq .ActionName "reject"}}
|
||||
{{.i18n.Tr "mail.issue.action.reject" (Escape .Doer.Name) | Str2html}}
|
||||
{{.locale.Tr "mail.issue.action.reject" (Escape .Doer.Name) | Str2html}}
|
||||
{{else if eq .ActionName "review"}}
|
||||
{{.i18n.Tr "mail.issue.action.review" (Escape .Doer.Name) | Str2html}}
|
||||
{{.locale.Tr "mail.issue.action.review" (Escape .Doer.Name) | Str2html}}
|
||||
{{else if eq .ActionName "review_dismissed"}}
|
||||
{{.i18n.Tr "mail.issue.action.review_dismissed" (Escape .Doer.Name) (Escape .Comment.Review.Reviewer.Name) | Str2html}}
|
||||
{{.locale.Tr "mail.issue.action.review_dismissed" (Escape .Doer.Name) (Escape .Comment.Review.Reviewer.Name) | Str2html}}
|
||||
{{else if eq .ActionName "ready_for_review"}}
|
||||
{{.i18n.Tr "mail.issue.action.ready_for_review" (Escape .Doer.Name) | Str2html}}
|
||||
{{.locale.Tr "mail.issue.action.ready_for_review" (Escape .Doer.Name) | Str2html}}
|
||||
{{end}}
|
||||
|
||||
{{- if eq .Body ""}}
|
||||
{{if eq .ActionName "new"}}
|
||||
{{.i18n.Tr "mail.issue.action.new" (Escape .Doer.Name) .Issue.Index | Str2html}}
|
||||
{{.locale.Tr "mail.issue.action.new" (Escape .Doer.Name) .Issue.Index | Str2html}}
|
||||
{{end}}
|
||||
{{else}}
|
||||
{{.Body | Str2html}}
|
||||
{{end -}}
|
||||
{{- range .ReviewComments}}
|
||||
<hr>
|
||||
{{$.i18n.Tr "mail.issue.in_tree_path" .TreePath}}
|
||||
{{$.locale.Tr "mail.issue.in_tree_path" .TreePath}}
|
||||
<div class="review">
|
||||
<pre>{{.Patch}}</pre>
|
||||
<div>{{.RenderedContent | Safe}}</div>
|
||||
@@ -84,7 +84,7 @@
|
||||
<p>
|
||||
---
|
||||
<br>
|
||||
<a href="{{.Link}}">{{.i18n.Tr "mail.view_it_on" AppName}}</a>.
|
||||
<a href="{{.Link}}">{{.locale.Tr "mail.view_it_on" AppName}}</a>.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
|
@@ -9,12 +9,12 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>{{.i18n.Tr "mail.repo.collaborator.added.text"}} <code>{{.RepoName}}</code></p>
|
||||
<p>{{.locale.Tr "mail.repo.collaborator.added.text"}} <code>{{.RepoName}}</code></p>
|
||||
<div class="footer">
|
||||
<p>
|
||||
---
|
||||
<br>
|
||||
<a href="{{.Link}}">{{.i18n.Tr "mail.view_it_on" AppName}}</a>.
|
||||
<a href="{{.Link}}">{{.locale.Tr "mail.view_it_on" AppName}}</a>.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
|
@@ -8,11 +8,11 @@
|
||||
{{$url := printf "<a href='%[1]s'>%[2]s</a>" (Escape .Link) (Escape .Repo)}}
|
||||
<body>
|
||||
<p>{{.Subject}}.
|
||||
{{.i18n.Tr "mail.repo.transfer.body" $url | Str2html}}
|
||||
{{.locale.Tr "mail.repo.transfer.body" $url | Str2html}}
|
||||
<p>
|
||||
---
|
||||
<br>
|
||||
<a href="{{.Link}}">{{.i18n.Tr "mail.view_it_on" AppName}}</a>.
|
||||
<a href="{{.Link}}">{{.locale.Tr "mail.view_it_on" AppName}}</a>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -15,11 +15,11 @@
|
||||
{{$repo_url := printf "<a href='%s'>%s</a>" (.Release.Repo.HTMLURL | Escape) (.Release.Repo.FullName | Escape)}}
|
||||
<body>
|
||||
<p>
|
||||
{{.i18n.Tr "mail.release.new.text" .Release.Publisher.Name $release_url $repo_url | Str2html}}
|
||||
{{.locale.Tr "mail.release.new.text" .Release.Publisher.Name $release_url $repo_url | Str2html}}
|
||||
</p>
|
||||
<h4>{{.i18n.Tr "mail.release.title" .Release.Title}}</h4>
|
||||
<h4>{{.locale.Tr "mail.release.title" .Release.Title}}</h4>
|
||||
<p>
|
||||
{{.i18n.Tr "mail.release.note"}}<br>
|
||||
{{.locale.Tr "mail.release.note"}}<br>
|
||||
{{- if eq .Release.RenderedNote ""}}
|
||||
{{else}}
|
||||
{{.Release.RenderedNote | Str2html}}
|
||||
@@ -29,13 +29,13 @@
|
||||
<p>
|
||||
---
|
||||
<br>
|
||||
{{.i18n.Tr "mail.release.downloads"}}
|
||||
{{.locale.Tr "mail.release.downloads"}}
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{.Release.Repo.Link}}/archive/{{.Release.TagName | PathEscapeSegments}}.zip" rel="nofollow"><strong>{{.i18n.Tr "mail.release.download.zip"}}</strong></a>
|
||||
<a href="{{.Release.Repo.Link}}/archive/{{.Release.TagName | PathEscapeSegments}}.zip" rel="nofollow"><strong>{{.locale.Tr "mail.release.download.zip"}}</strong></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{.Release.Repo.Link}}/archive/{{.Release.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow"><strong>{{.i18n.Tr "mail.release.download.targz"}}</strong></a>
|
||||
<a href="{{.Release.Repo.Link}}/archive/{{.Release.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow"><strong>{{.locale.Tr "mail.release.download.targz"}}</strong></a>
|
||||
</li>
|
||||
{{if .Release.Attachments}}
|
||||
{{range .Release.Attachments}}
|
||||
@@ -52,7 +52,7 @@
|
||||
<p>
|
||||
---
|
||||
<br>
|
||||
<a href="{{.Link}}">{{.i18n.Tr "mail.view_it_on" AppName}}</a>.
|
||||
<a href="{{.Link}}">{{.locale.Tr "mail.view_it_on" AppName}}</a>.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
|
Reference in New Issue
Block a user