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/explore | |
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/explore')
-rw-r--r-- | templates/explore/code.tmpl | 20 | ||||
-rw-r--r-- | templates/explore/navbar.tmpl | 8 | ||||
-rw-r--r-- | templates/explore/organizations.tmpl | 6 | ||||
-rw-r--r-- | templates/explore/repo_list.tmpl | 14 | ||||
-rw-r--r-- | templates/explore/repo_search.tmpl | 26 | ||||
-rw-r--r-- | templates/explore/search.tmpl | 18 | ||||
-rw-r--r-- | templates/explore/users.tmpl | 4 |
7 files changed, 48 insertions, 48 deletions
diff --git a/templates/explore/code.tmpl b/templates/explore/code.tmpl index 6bd8be7aff..45783b2263 100644 --- a/templates/explore/code.tmpl +++ b/templates/explore/code.tmpl @@ -4,27 +4,27 @@ <div class="ui container"> <form class="ui form ignore-dirty" style="max-width: 100%"> <div class="ui fluid action input"> - <input name="q" value="{{.Keyword}}"{{if .CodeIndexerUnavailable }} disabled{{end}} placeholder="{{.i18n.Tr "explore.search"}}..." autofocus> + <input name="q" value="{{.Keyword}}"{{if .CodeIndexerUnavailable }} disabled{{end}} placeholder="{{.locale.Tr "explore.search"}}..." autofocus> <div class="ui dropdown selection{{if .CodeIndexerUnavailable }} disabled{{end}}"> <input name="t" type="hidden" value="{{.queryType}}"{{if .CodeIndexerUnavailable }} disabled{{end}}>{{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="text">{{.i18n.Tr (printf "explore.search.%s" (or .queryType "fuzzy"))}}</div> + <div class="text">{{.locale.Tr (printf "explore.search.%s" (or .queryType "fuzzy"))}}</div> <div class="menu transition hidden" tabindex="-1" style="display: block !important;"> - <div class="item" data-value="">{{.i18n.Tr "explore.search.fuzzy"}}</div> - <div class="item" data-value="match">{{.i18n.Tr "explore.search.match"}}</div> + <div class="item" data-value="">{{.locale.Tr "explore.search.fuzzy"}}</div> + <div class="item" data-value="match">{{.locale.Tr "explore.search.match"}}</div> </div> </div> - <button class="ui primary button"{{if .CodeIndexerUnavailable }} disabled{{end}}>{{.i18n.Tr "explore.search"}}</button> + <button class="ui primary button"{{if .CodeIndexerUnavailable }} disabled{{end}}>{{.locale.Tr "explore.search"}}</button> </div> </form> <div class="ui divider"></div> <div class="ui user list"> {{if .CodeIndexerUnavailable }} <div class="ui error message"> - <p>{{$.i18n.Tr "explore.code_search_unavailable"}}</p> + <p>{{$.locale.Tr "explore.code_search_unavailable"}}</p> </div> {{else if .SearchResults}} <h3> - {{.i18n.Tr "explore.code_search_results" (.Keyword|Escape) | Str2html }} + {{.locale.Tr "explore.code_search_results" (.Keyword|Escape) | Str2html }} </h3> <div class="df ac fw"> {{range $term := .SearchResultLanguages}} @@ -43,11 +43,11 @@ <span class="file"> <a rel="nofollow" href="{{$repo.HTMLURL}}">{{$repo.FullName}}</a> {{if $repo.IsArchived}} - <span class="ui basic label">{{$.i18n.Tr "repo.desc.archived"}}</span> + <span class="ui basic label">{{$.locale.Tr "repo.desc.archived"}}</span> {{end}} - {{.Filename}} </span> - <a class="ui basic tiny button" rel="nofollow" href="{{$repo.HTMLURL}}/src/commit/{{$result.CommitID | PathEscape}}/{{.Filename | PathEscapeSegments}}">{{$.i18n.Tr "repo.diff.view_file"}}</a> + <a class="ui basic tiny button" rel="nofollow" href="{{$repo.HTMLURL}}/src/commit/{{$result.CommitID | PathEscape}}/{{.Filename | PathEscapeSegments}}">{{$.locale.Tr "repo.diff.view_file"}}</a> </h4> <div class="ui attached table segment"> <div class="file-body file-code code-view"> @@ -70,7 +70,7 @@ {{end}} </div> {{else}} - <div>{{$.i18n.Tr "explore.code_no_results"}}</div> + <div>{{$.locale.Tr "explore.code_no_results"}}</div> {{end}} </div> diff --git a/templates/explore/navbar.tmpl b/templates/explore/navbar.tmpl index 5b1e6b5d06..1c59cfd03e 100644 --- a/templates/explore/navbar.tmpl +++ b/templates/explore/navbar.tmpl @@ -1,18 +1,18 @@ <div class="ui secondary pointing tabular top attached borderless stackable menu new-menu navbar"> <a class="{{if .PageIsExploreRepositories}}active{{end}} item" href="{{AppSubUrl}}/explore/repos"> - {{svg "octicon-repo"}} {{.i18n.Tr "explore.repos"}} + {{svg "octicon-repo"}} {{.locale.Tr "explore.repos"}} </a> {{if not .UsersIsDisabled}} <a class="{{if .PageIsExploreUsers}}active{{end}} item" href="{{AppSubUrl}}/explore/users"> - {{svg "octicon-person"}} {{.i18n.Tr "explore.users"}} + {{svg "octicon-person"}} {{.locale.Tr "explore.users"}} </a> {{end}} <a class="{{if .PageIsExploreOrganizations}}active{{end}} item" href="{{AppSubUrl}}/explore/organizations"> - {{svg "octicon-organization"}} {{.i18n.Tr "explore.organizations"}} + {{svg "octicon-organization"}} {{.locale.Tr "explore.organizations"}} </a> {{if .IsRepoIndexerEnabled}} <a class="{{if .PageIsExploreCode}}active{{end}} item" href="{{AppSubUrl}}/explore/code"> - {{svg "octicon-code"}} {{.i18n.Tr "explore.code"}} + {{svg "octicon-code"}} {{.locale.Tr "explore.code"}} </a> {{end}} </div> diff --git a/templates/explore/organizations.tmpl b/templates/explore/organizations.tmpl index b2fee6c19a..2073b8c69c 100644 --- a/templates/explore/organizations.tmpl +++ b/templates/explore/organizations.tmpl @@ -12,7 +12,7 @@ <span class="header"> <a href="{{.HomeLink}}">{{.Name}}</a> {{.FullName}} {{if .Visibility.IsPrivate}} - <span class="ui basic label">{{$.i18n.Tr "repo.desc.private"}}</span> + <span class="ui basic label">{{$.locale.Tr "repo.desc.private"}}</span> {{end}} </span> <div class="description"> @@ -23,12 +23,12 @@ {{svg "octicon-link"}} <a href="{{.Website}}" rel="nofollow">{{.Website}}</a> {{end}} - {{svg "octicon-clock"}} {{$.i18n.Tr "user.join_on"}} {{.CreatedUnix.FormatShort}} + {{svg "octicon-clock"}} {{$.locale.Tr "user.join_on"}} {{.CreatedUnix.FormatShort}} </div> </div> </div> {{else}} - <div>{{$.i18n.Tr "explore.org_no_results"}}</div> + <div>{{$.locale.Tr "explore.org_no_results"}}</div> {{end}} </div> diff --git a/templates/explore/repo_list.tmpl b/templates/explore/repo_list.tmpl index c0e371b8a0..10b503b219 100644 --- a/templates/explore/repo_list.tmpl +++ b/templates/explore/repo_list.tmpl @@ -12,22 +12,22 @@ </a> <div class="labels df ac fw"> {{if .IsArchived}} - <span class="ui basic label">{{$.i18n.Tr "repo.desc.archived"}}</span> + <span class="ui basic label">{{$.locale.Tr "repo.desc.archived"}}</span> {{end}} {{if .IsTemplate}} {{if .IsPrivate}} - <span class="ui basic label">{{$.i18n.Tr "repo.desc.private_template"}}</span> + <span class="ui basic label">{{$.locale.Tr "repo.desc.private_template"}}</span> {{else}} {{if .Owner.Visibility.IsPrivate}} - <span class="ui basic label">{{$.i18n.Tr "repo.desc.internal_template"}}</span> + <span class="ui basic label">{{$.locale.Tr "repo.desc.internal_template"}}</span> {{end}} {{end}} {{else}} {{if .IsPrivate}} - <span class="ui basic label">{{$.i18n.Tr "repo.desc.private"}}</span> + <span class="ui basic label">{{$.locale.Tr "repo.desc.private"}}</span> {{else}} {{if .Owner.Visibility.IsPrivate}} - <span class="ui basic label">{{$.i18n.Tr "repo.desc.internal"}}</span> + <span class="ui basic label">{{$.locale.Tr "repo.desc.internal"}}</span> {{end}} {{end}} {{end}} @@ -60,12 +60,12 @@ {{end}} </div> {{end}} - <p class="time">{{$.i18n.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.i18n}}</p> + <p class="time">{{$.locale.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.locale}}</p> </div> </div> {{else}} <div> - {{$.i18n.Tr "explore.repo_no_results"}} + {{$.locale.Tr "explore.repo_no_results"}} </div> {{end}} </div> diff --git a/templates/explore/repo_search.tmpl b/templates/explore/repo_search.tmpl index a937cad648..e1df2fa0ee 100644 --- a/templates/explore/repo_search.tmpl +++ b/templates/explore/repo_search.tmpl @@ -2,22 +2,22 @@ <!-- Sort --> <div class="ui right dropdown type jump item"> <span class="text"> - {{.i18n.Tr "repo.issues.filter_sort"}} + {{.locale.Tr "repo.issues.filter_sort"}} {{svg "octicon-triangle-down" 14 "dropdown icon"}} </span> <div class="menu"> - <a class="{{if eq .SortType "newest"}}active{{end}} item" href="{{$.Link}}?sort=newest&q={{$.Keyword}}&language={{$.Language}}">{{.i18n.Tr "repo.issues.filter_sort.latest"}}</a> - <a class="{{if eq .SortType "oldest"}}active{{end}} item" href="{{$.Link}}?sort=oldest&q={{$.Keyword}}&language={{$.Language}}">{{.i18n.Tr "repo.issues.filter_sort.oldest"}}</a> - <a class="{{if eq .SortType "alphabetically"}}active{{end}} item" href="{{$.Link}}?sort=alphabetically&q={{$.Keyword}}&language={{$.Language}}">{{.i18n.Tr "repo.issues.label.filter_sort.alphabetically"}}</a> - <a class="{{if eq .SortType "reversealphabetically"}}active{{end}} item" href="{{$.Link}}?sort=reversealphabetically&q={{$.Keyword}}&language={{$.Language}}">{{.i18n.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a> - <a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}&language={{$.Language}}">{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a> - <a class="{{if eq .SortType "leastupdate"}}active{{end}} item" href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}&language={{$.Language}}">{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a> + <a class="{{if eq .SortType "newest"}}active{{end}} item" href="{{$.Link}}?sort=newest&q={{$.Keyword}}&language={{$.Language}}">{{.locale.Tr "repo.issues.filter_sort.latest"}}</a> + <a class="{{if eq .SortType "oldest"}}active{{end}} item" href="{{$.Link}}?sort=oldest&q={{$.Keyword}}&language={{$.Language}}">{{.locale.Tr "repo.issues.filter_sort.oldest"}}</a> + <a class="{{if eq .SortType "alphabetically"}}active{{end}} item" href="{{$.Link}}?sort=alphabetically&q={{$.Keyword}}&language={{$.Language}}">{{.locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</a> + <a class="{{if eq .SortType "reversealphabetically"}}active{{end}} item" href="{{$.Link}}?sort=reversealphabetically&q={{$.Keyword}}&language={{$.Language}}">{{.locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a> + <a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}&language={{$.Language}}">{{.locale.Tr "repo.issues.filter_sort.recentupdate"}}</a> + <a class="{{if eq .SortType "leastupdate"}}active{{end}} item" href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}&language={{$.Language}}">{{.locale.Tr "repo.issues.filter_sort.leastupdate"}}</a> {{if not .DisableStars}} - <a class="{{if eq .SortType "moststars"}}active{{end}} item" href="{{$.Link}}?sort=moststars&q={{$.Keyword}}&language={{$.Language}}">{{.i18n.Tr "repo.issues.filter_sort.moststars"}}</a> - <a class="{{if eq .SortType "feweststars"}}active{{end}} item" href="{{$.Link}}?sort=feweststars&q={{$.Keyword}}&language={{$.Language}}">{{.i18n.Tr "repo.issues.filter_sort.feweststars"}}</a> + <a class="{{if eq .SortType "moststars"}}active{{end}} item" href="{{$.Link}}?sort=moststars&q={{$.Keyword}}&language={{$.Language}}">{{.locale.Tr "repo.issues.filter_sort.moststars"}}</a> + <a class="{{if eq .SortType "feweststars"}}active{{end}} item" href="{{$.Link}}?sort=feweststars&q={{$.Keyword}}&language={{$.Language}}">{{.locale.Tr "repo.issues.filter_sort.feweststars"}}</a> {{end}} - <a class="{{if eq .SortType "mostforks"}}active{{end}} item" href="{{$.Link}}?sort=mostforks&q={{$.Keyword}}&language={{$.Language}}">{{.i18n.Tr "repo.issues.filter_sort.mostforks"}}</a> - <a class="{{if eq .SortType "fewestforks"}}active{{end}} item" href="{{$.Link}}?sort=fewestforks&q={{$.Keyword}}&language={{$.Language}}">{{.i18n.Tr "repo.issues.filter_sort.fewestforks"}}</a> + <a class="{{if eq .SortType "mostforks"}}active{{end}} item" href="{{$.Link}}?sort=mostforks&q={{$.Keyword}}&language={{$.Language}}">{{.locale.Tr "repo.issues.filter_sort.mostforks"}}</a> + <a class="{{if eq .SortType "fewestforks"}}active{{end}} item" href="{{$.Link}}?sort=fewestforks&q={{$.Keyword}}&language={{$.Language}}">{{.locale.Tr "repo.issues.filter_sort.fewestforks"}}</a> </div> </div> </div> @@ -25,8 +25,8 @@ <input type="hidden" name="sort" value="{{$.SortType}}"> <input type="hidden" name="language" value="{{$.Language}}"> <div class="ui fluid action input"> - <input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr "explore.search"}}..." autofocus> - <button class="ui primary button">{{.i18n.Tr "explore.search"}}</button> + <input name="q" value="{{.Keyword}}" placeholder="{{.locale.Tr "explore.search"}}..." autofocus> + <button class="ui primary button">{{.locale.Tr "explore.search"}}</button> </div> </form> <div class="ui divider"></div> diff --git a/templates/explore/search.tmpl b/templates/explore/search.tmpl index c83c75e279..7e10412db8 100644 --- a/templates/explore/search.tmpl +++ b/templates/explore/search.tmpl @@ -2,23 +2,23 @@ <!-- Sort --> <div class="ui right dropdown type jump item"> <span class="text"> - {{.i18n.Tr "repo.issues.filter_sort"}} + {{.locale.Tr "repo.issues.filter_sort"}} {{svg "octicon-triangle-down" 14 "dropdown icon"}} </span> <div class="menu"> - <a class="{{if eq .SortType "newest"}}active{{end}} item" href="{{$.Link}}?sort=newest&q={{$.Keyword}}">{{.i18n.Tr "repo.issues.filter_sort.latest"}}</a> - <a class="{{if eq .SortType "oldest"}}active{{end}} item" href="{{$.Link}}?sort=oldest&q={{$.Keyword}}">{{.i18n.Tr "repo.issues.filter_sort.oldest"}}</a> - <a class="{{if eq .SortType "alphabetically"}}active{{end}} item" href="{{$.Link}}?sort=alphabetically&q={{$.Keyword}}">{{.i18n.Tr "repo.issues.label.filter_sort.alphabetically"}}</a> - <a class="{{if eq .SortType "reversealphabetically"}}active{{end}} item" href="{{$.Link}}?sort=reversealphabetically&q={{$.Keyword}}">{{.i18n.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a> - <a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}">{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a> - <a class="{{if eq .SortType "leastupdate"}}active{{end}} item" href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}">{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a> + <a class="{{if eq .SortType "newest"}}active{{end}} item" href="{{$.Link}}?sort=newest&q={{$.Keyword}}">{{.locale.Tr "repo.issues.filter_sort.latest"}}</a> + <a class="{{if eq .SortType "oldest"}}active{{end}} item" href="{{$.Link}}?sort=oldest&q={{$.Keyword}}">{{.locale.Tr "repo.issues.filter_sort.oldest"}}</a> + <a class="{{if eq .SortType "alphabetically"}}active{{end}} item" href="{{$.Link}}?sort=alphabetically&q={{$.Keyword}}">{{.locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</a> + <a class="{{if eq .SortType "reversealphabetically"}}active{{end}} item" href="{{$.Link}}?sort=reversealphabetically&q={{$.Keyword}}">{{.locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a> + <a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}">{{.locale.Tr "repo.issues.filter_sort.recentupdate"}}</a> + <a class="{{if eq .SortType "leastupdate"}}active{{end}} item" href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}">{{.locale.Tr "repo.issues.filter_sort.leastupdate"}}</a> </div> </div> </div> <form class="ui form ignore-dirty" style="max-width: 90%"> <div class="ui fluid action input"> - <input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr "explore.search"}}..." autofocus> - <button class="ui primary button">{{.i18n.Tr "explore.search"}}</button> + <input name="q" value="{{.Keyword}}" placeholder="{{.locale.Tr "explore.search"}}..." autofocus> + <button class="ui primary button">{{.locale.Tr "explore.search"}}</button> </div> </form> <div class="ui divider"></div> diff --git a/templates/explore/users.tmpl b/templates/explore/users.tmpl index dff4e8c8be..94a21d9959 100644 --- a/templates/explore/users.tmpl +++ b/templates/explore/users.tmpl @@ -18,12 +18,12 @@ {{svg "octicon-mail"}} <a href="mailto:{{.Email}}" rel="nofollow">{{.Email}}</a> {{end}} - {{svg "octicon-clock"}} {{$.i18n.Tr "user.join_on"}} {{.CreatedUnix.FormatShort}} + {{svg "octicon-clock"}} {{$.locale.Tr "user.join_on"}} {{.CreatedUnix.FormatShort}} </div> </div> </div> {{else}} - <div>{{$.i18n.Tr "explore.user_no_results"}}</div> + <div>{{$.locale.Tr "explore.user_no_results"}}</div> {{end}} </div> |