diff options
author | Gusted <williamzijl7@hotmail.com> | 2022-06-27 22:58:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-27 15:58:46 -0500 |
commit | d55a0b723809f5b94acd948b924c8518014445e0 (patch) | |
tree | 0ef9ea54f30769ca1d16ce20e551bd7a078f7f5e /templates/mail | |
parent | b551bc2a089d3310dde5706d1b9702f112fe3ea0 (diff) | |
download | gitea-d55a0b723809f5b94acd948b924c8518014445e0.tar.gz gitea-d55a0b723809f5b94acd948b924c8518014445e0.zip |
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
Diffstat (limited to 'templates/mail')
-rw-r--r-- | templates/mail/auth/activate.tmpl | 8 | ||||
-rw-r--r-- | templates/mail/auth/activate_email.tmpl | 10 | ||||
-rw-r--r-- | templates/mail/auth/register_notify.tmpl | 10 | ||||
-rw-r--r-- | templates/mail/auth/reset_passwd.tmpl | 8 | ||||
-rw-r--r-- | templates/mail/issue/assigned.tmpl | 6 | ||||
-rw-r--r-- | templates/mail/issue/default.tmpl | 28 | ||||
-rw-r--r-- | templates/mail/notify/collaborator.tmpl | 4 | ||||
-rw-r--r-- | templates/mail/notify/repo_transfer.tmpl | 4 | ||||
-rw-r--r-- | templates/mail/release.tmpl | 14 |
9 files changed, 46 insertions, 46 deletions
diff --git a/templates/mail/auth/activate.tmpl b/templates/mail/auth/activate.tmpl index 5de3967bc4..fcb54c0a78 100644 --- a/templates/mail/auth/activate.tmpl +++ b/templates/mail/auth/activate.tmpl @@ -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> diff --git a/templates/mail/auth/activate_email.tmpl b/templates/mail/auth/activate_email.tmpl index 5c79798821..e65ebd6b98 100644 --- a/templates/mail/auth/activate_email.tmpl +++ b/templates/mail/auth/activate_email.tmpl @@ -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> diff --git a/templates/mail/auth/register_notify.tmpl b/templates/mail/auth/register_notify.tmpl index a32d8ce992..673e84c5c7 100644 --- a/templates/mail/auth/register_notify.tmpl +++ b/templates/mail/auth/register_notify.tmpl @@ -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> diff --git a/templates/mail/auth/reset_passwd.tmpl b/templates/mail/auth/reset_passwd.tmpl index 028d911a99..a013ebd7a6 100644 --- a/templates/mail/auth/reset_passwd.tmpl +++ b/templates/mail/auth/reset_passwd.tmpl @@ -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> diff --git a/templates/mail/issue/assigned.tmpl b/templates/mail/issue/assigned.tmpl index ffb15ef677..05bed69022 100644 --- a/templates/mail/issue/assigned.tmpl +++ b/templates/mail/issue/assigned.tmpl @@ -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> diff --git a/templates/mail/issue/default.tmpl b/templates/mail/issue/default.tmpl index aa91861d11..d9f7aff4cc 100644 --- a/templates/mail/issue/default.tmpl +++ b/templates/mail/issue/default.tmpl @@ -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> diff --git a/templates/mail/notify/collaborator.tmpl b/templates/mail/notify/collaborator.tmpl index baa46bafda..fcae84733e 100644 --- a/templates/mail/notify/collaborator.tmpl +++ b/templates/mail/notify/collaborator.tmpl @@ -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> diff --git a/templates/mail/notify/repo_transfer.tmpl b/templates/mail/notify/repo_transfer.tmpl index 6250ff7c20..85ed96f3f7 100644 --- a/templates/mail/notify/repo_transfer.tmpl +++ b/templates/mail/notify/repo_transfer.tmpl @@ -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> diff --git a/templates/mail/release.tmpl b/templates/mail/release.tmpl index 813aba556c..a95647105c 100644 --- a/templates/mail/release.tmpl +++ b/templates/mail/release.tmpl @@ -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> |