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/package/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/package/shared')
-rw-r--r-- | templates/package/shared/list.tmpl | 20 | ||||
-rw-r--r-- | templates/package/shared/versionlist.tmpl | 14 |
2 files changed, 17 insertions, 17 deletions
diff --git a/templates/package/shared/list.tmpl b/templates/package/shared/list.tmpl index eb2beac9e7..3b3a1720ea 100644 --- a/templates/package/shared/list.tmpl +++ b/templates/package/shared/list.tmpl @@ -2,10 +2,10 @@ {{template "base/alert" .}} <form class="ui form ignore-dirty"> <div class="ui fluid action input"> - <input name="q" value="{{.Query}}" placeholder="{{.i18n.Tr "explore.search"}}..." autofocus> + <input name="q" value="{{.Query}}" placeholder="{{.locale.Tr "explore.search"}}..." autofocus> <select class="ui dropdown" name="type"> - <option value="">{{.i18n.Tr "packages.filter.type"}}</option> - <option value="all">{{.i18n.Tr "packages.filter.type.all"}}</option> + <option value="">{{.locale.Tr "packages.filter.type"}}</option> + <option value="all">{{.locale.Tr "packages.filter.type.all"}}</option> <option value="composer" {{if eq .PackageType "composer"}}selected="selected"{{end}}>Composer</option> <option value="conan" {{if eq .PackageType "conan"}}selected="selected"{{end}}>Conan</option> <option value="container" {{if eq .PackageType "container"}}selected="selected"{{end}}>Container</option> @@ -17,7 +17,7 @@ <option value="pypi" {{if eq .PackageType "pypi"}}selected="selected"{{end}}>PyPi</option> <option value="rubygems" {{if eq .PackageType "rubygems"}}selected="selected"{{end}}>RubyGems</option> </select> - <button class="ui primary button">{{.i18n.Tr "explore.search"}}</button> + <button class="ui primary button">{{.locale.Tr "explore.search"}}</button> </div> </form> <div class="ui {{if .PackageDescriptors}}issue list{{end}}"> @@ -29,15 +29,15 @@ <span class="ui label">{{svg .Package.Type.SVGName 16}} {{.Package.Type.Name}}</span> </div> <div class="desc issue-item-bottom-row df ac fw my-1"> - {{$timeStr := TimeSinceUnix .Version.CreatedUnix $.i18n}} + {{$timeStr := TimeSinceUnix .Version.CreatedUnix $.locale}} {{$hasRepositoryAccess := false}} {{if .Repository}} {{$hasRepositoryAccess = index $.RepositoryAccessMap .Repository.ID}} {{end}} {{if $hasRepositoryAccess}} - {{$.i18n.Tr "packages.published_by_in" $timeStr .Creator.HomeLink (.Creator.GetDisplayName | Escape) .Repository.HTMLURL (.Repository.FullName | Escape) | Safe}} + {{$.locale.Tr "packages.published_by_in" $timeStr .Creator.HomeLink (.Creator.GetDisplayName | Escape) .Repository.HTMLURL (.Repository.FullName | Escape) | Safe}} {{else}} - {{$.i18n.Tr "packages.published_by" $timeStr .Creator.HomeLink (.Creator.GetDisplayName | Escape) | Safe}} + {{$.locale.Tr "packages.published_by" $timeStr .Creator.HomeLink (.Creator.GetDisplayName | Escape) | Safe}} {{end}} </div> </div> @@ -46,11 +46,11 @@ {{if not .HasPackages}} <div class="empty center"> {{svg "octicon-package" 32}} - <h2>{{.i18n.Tr "packages.empty"}}</h2> - <p>{{.i18n.Tr "packages.empty.documentation" | Safe}}</p> + <h2>{{.locale.Tr "packages.empty"}}</h2> + <p>{{.locale.Tr "packages.empty.documentation" | Safe}}</p> </div> {{else}} - <p>{{.i18n.Tr "packages.filter.no_result"}}</p> + <p>{{.locale.Tr "packages.filter.no_result"}}</p> {{end}} {{end}} {{template "base/paginate" .}} diff --git a/templates/package/shared/versionlist.tmpl b/templates/package/shared/versionlist.tmpl index 3d9ae5ef44..02bda3fb8f 100644 --- a/templates/package/shared/versionlist.tmpl +++ b/templates/package/shared/versionlist.tmpl @@ -1,16 +1,16 @@ <div class="ui container"> - <p><a href="{{.PackageDescriptor.PackageWebLink}}">{{.PackageDescriptor.Package.Name}}</a> / <strong>{{.i18n.Tr "packages.versions"}}</strong></p> + <p><a href="{{.PackageDescriptor.PackageWebLink}}">{{.PackageDescriptor.Package.Name}}</a> / <strong>{{.locale.Tr "packages.versions"}}</strong></p> <form class="ui form ignore-dirty"> <div class="ui fluid action input"> - <input name="q" value="{{.Query}}" placeholder="{{.i18n.Tr "explore.search"}}..." autofocus> + <input name="q" value="{{.Query}}" placeholder="{{.locale.Tr "explore.search"}}..." autofocus> {{if eq .PackageDescriptor.Package.Type "container"}} <select class="ui dropdown" name="tagged"> {{$isTagged := or (eq .Tagged "") (eq .Tagged "tagged")}} - <option value="tagged" {{if $isTagged}}selected="selected"{{end}}>{{.i18n.Tr "packages.filter.container.tagged"}}</option> - <option value="untagged" {{if not $isTagged}}selected="selected"{{end}}>{{.i18n.Tr "packages.filter.container.untagged"}}</option> + <option value="tagged" {{if $isTagged}}selected="selected"{{end}}>{{.locale.Tr "packages.filter.container.tagged"}}</option> + <option value="untagged" {{if not $isTagged}}selected="selected"{{end}}>{{.locale.Tr "packages.filter.container.untagged"}}</option> </select> {{end}} - <button class="ui primary button">{{.i18n.Tr "explore.search"}}</button> + <button class="ui primary button">{{.locale.Tr "explore.search"}}</button> </div> </form> <div class="ui {{if .PackageDescriptors}}issue list{{end}}"> @@ -21,12 +21,12 @@ <a class="title" href="{{.FullWebLink}}">{{.Version.LowerVersion}}</a> </div> <div class="desc issue-item-bottom-row df ac fw my-1"> - {{$.i18n.Tr "packages.published_by" (TimeSinceUnix .Version.CreatedUnix $.i18n) .Creator.HomeLink (.Creator.GetDisplayName | Escape) | Safe}} + {{$.locale.Tr "packages.published_by" (TimeSinceUnix .Version.CreatedUnix $.locale) .Creator.HomeLink (.Creator.GetDisplayName | Escape) | Safe}} </div> </div> </li> {{else}} - <p>{{.i18n.Tr "packages.filter.no_result"}}</p> + <p>{{.locale.Tr "packages.filter.no_result"}}</p> {{end}} {{template "base/paginate" .}} </div> |