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/shared | |
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/shared')
-rw-r--r-- | templates/shared/issuelist.tmpl | 20 | ||||
-rw-r--r-- | templates/shared/searchbottom.tmpl | 2 |
2 files changed, 11 insertions, 11 deletions
diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index 25dcc5d458..0adcc34671 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -51,13 +51,13 @@ #{{.Index}} {{end}} </a> - {{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.i18n }} + {{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.locale }} {{if .OriginalAuthor }} - {{$.i18n.Tr .GetLastEventLabelFake $timeStr (.OriginalAuthor|Escape) | Safe}} + {{$.locale.Tr .GetLastEventLabelFake $timeStr (.OriginalAuthor|Escape) | Safe}} {{else if gt .Poster.ID 0}} - {{$.i18n.Tr .GetLastEventLabel $timeStr (.Poster.HomeLink|Escape) (.Poster.GetDisplayName | Escape) | Safe}} + {{$.locale.Tr .GetLastEventLabel $timeStr (.Poster.HomeLink|Escape) (.Poster.GetDisplayName | Escape) | Safe}} {{else}} - {{$.i18n.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}} + {{$.locale.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}} {{end}} {{if .IsPull}} <div class="branches"> @@ -99,7 +99,7 @@ </span> {{end}} {{if ne .DeadlineUnix 0}} - <span class="due-date tooltip" data-content="{{$.i18n.Tr "repo.issues.due_date"}}" data-position="right center"> + <span class="due-date tooltip" data-content="{{$.locale.Tr "repo.issues.due_date"}}" data-position="right center"> <span{{if .IsOverdue}} class="overdue"{{end}}> {{svg "octicon-calendar" 14 "mr-2"}} {{.DeadlineUnix.FormatShort}} @@ -113,25 +113,25 @@ {{if gt $approveOfficial 0}} <span class="approvals df ac"> {{svg "octicon-check" 14 "mr-1"}} - {{$.i18n.TrN $approveOfficial "repo.pulls.approve_count_1" "repo.pulls.approve_count_n" $approveOfficial}} + {{$.locale.TrN $approveOfficial "repo.pulls.approve_count_1" "repo.pulls.approve_count_n" $approveOfficial}} </span> {{end}} {{if gt $rejectOfficial 0}} <span class="rejects df ac"> {{svg "octicon-diff" 14 "mr-2"}} - {{$.i18n.TrN $rejectOfficial "repo.pulls.reject_count_1" "repo.pulls.reject_count_n" $rejectOfficial}} + {{$.locale.TrN $rejectOfficial "repo.pulls.reject_count_1" "repo.pulls.reject_count_n" $rejectOfficial}} </span> {{end}} {{if gt $waitingOfficial 0}} <span class="waiting df ac"> {{svg "octicon-eye" 14 "mr-2"}} - {{$.i18n.TrN $waitingOfficial "repo.pulls.waiting_count_1" "repo.pulls.waiting_count_n" $waitingOfficial}} + {{$.locale.TrN $waitingOfficial "repo.pulls.waiting_count_1" "repo.pulls.waiting_count_n" $waitingOfficial}} </span> {{end}} {{if and (not .PullRequest.HasMerged) (gt (len .PullRequest.ConflictedFiles) 0)}} <span class="conflicting df ac"> {{svg "octicon-x" 14}} - {{$.i18n.TrN (len .PullRequest.ConflictedFiles) "repo.pulls.num_conflicting_files_1" "repo.pulls.num_conflicting_files_n" (len .PullRequest.ConflictedFiles)}} + {{$.locale.TrN (len .PullRequest.ConflictedFiles) "repo.pulls.num_conflicting_files_1" "repo.pulls.num_conflicting_files_n" (len .PullRequest.ConflictedFiles)}} </span> {{end}} {{end}} @@ -163,7 +163,7 @@ {{end}} {{if .IssueIndexerUnavailable}} <div class="ui error message"> - <p>{{$.i18n.Tr "repo.issues.keyword_search_unavailable"}}</p> + <p>{{$.locale.Tr "repo.issues.keyword_search_unavailable"}}</p> </div> {{end}} </div> diff --git a/templates/shared/searchbottom.tmpl b/templates/shared/searchbottom.tmpl index bb38210eca..9a008cc31e 100644 --- a/templates/shared/searchbottom.tmpl +++ b/templates/shared/searchbottom.tmpl @@ -6,7 +6,7 @@ </div> <div class="mr-4"> {{if not .result.UpdatedUnix.IsZero}} - <span class="ui grey text">{{.root.i18n.Tr "explore.code_last_indexed_at" (TimeSinceUnix .result.UpdatedUnix .root.i18n) | Safe}}</span> + <span class="ui grey text">{{.root.locale.Tr "explore.code_last_indexed_at" (TimeSinceUnix .result.UpdatedUnix .root.locale) | Safe}}</span> {{end}} </div> </div> |