Skip to content

Commit

Permalink
Add localization to tagged by / since this tag
Browse files Browse the repository at this point in the history
  • Loading branch information
a1012112796 authored and wiktor-k committed Mar 27, 2023
1 parent e7c96f7 commit c6c6fad
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,7 @@ release = Release
releases = Releases
tag = Tag
released_this = released this
tagged_this = tagged this
file.title = %s at %s
file_raw = Raw
file_history = History
Expand Down Expand Up @@ -2287,6 +2288,7 @@ release.compare = Compare
release.edit = edit
release.ahead.commits = <strong>%d</strong> commits
release.ahead.target = to %s since this release
tag.ahead.target = to %s since this tag
release.source_code = Source Code
release.new_subheader = Releases organize project versions.
release.edit_subheader = Releases organize project versions.
Expand Down
7 changes: 6 additions & 1 deletion routers/web/repo/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ func releasesOrTagsFeed(ctx *context.Context, isReleasesOnly bool, formatType st

// SingleRelease renders a single release's page
func SingleRelease(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.release.releases")
ctx.Data["PageIsReleaseList"] = true
ctx.Data["DefaultBranch"] = ctx.Repo.Repository.DefaultBranch

Expand All @@ -242,6 +241,12 @@ func SingleRelease(ctx *context.Context) {
ctx.ServerError("GetReleasesByRepoID", err)
return
}
ctx.Data["PageIsSingleTag"] = release.IsTag
if release.IsTag {
ctx.Data["Title"] = release.TagName
} else {
ctx.Data["Title"] = release.Title
}

err = repo_model.GetReleaseAttachments(ctx, release)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions templates/repo/release/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
{{template "base/alert" .}}
<h2 class="ui compact small menu header">
{{if .Permission.CanRead $.UnitTypeReleases}}
<a class="{{if (not .PageIsTagList)}}active {{end}}item" href="{{.RepoLink}}/releases">{{.locale.Tr "repo.release.releases"}}</a>
<a class="{{if (and (not .PageIsSingleTag) (not .PageIsTagList))}}active {{end}}item" href="{{.RepoLink}}/releases">{{.locale.Tr "repo.release.releases"}}</a>
{{end}}
{{if .Permission.CanRead $.UnitTypeCode}}
<a class="{{if .PageIsTagList}}active {{end}}item" href="{{.RepoLink}}/tags">{{.locale.Tr "repo.release.tags"}}</a>
<a class="{{if (or .PageIsSingleTag .PageIsTagList)}}active {{end}}item" href="{{.RepoLink}}/tags">{{.locale.Tr "repo.release.tags"}}</a>
{{end}}
</h2>
{{if .EnableFeed}}
Expand Down Expand Up @@ -105,14 +105,14 @@
<a href="{{.Publisher.HomeLink}}">{{.Publisher.Name}}</a>
</span>
<span class="released">
{{$.locale.Tr "repo.released_this"}}
{{$.locale.Tr "repo.tagged_this"}}
</span>
{{if .CreatedUnix}}
<span class="time">{{TimeSinceUnix .CreatedUnix $.locale}}</span>
{{end}}
|
{{end}}
<span class="ahead"><a href="{{$.RepoLink}}/compare/{{.TagName | PathEscapeSegments}}{{if .Target}}...{{.Target | PathEscapeSegments}}{{end}}">{{$.locale.Tr "repo.release.ahead.commits" .NumCommitsBehind | Str2html}}</a> {{$.locale.Tr "repo.release.ahead.target" $.DefaultBranch}}</span>
<span class="ahead"><a href="{{$.RepoLink}}/compare/{{.TagName | PathEscapeSegments}}{{if .Target}}...{{.Target | PathEscapeSegments}}{{end}}">{{$.locale.Tr "repo.release.ahead.commits" .NumCommitsBehind | Str2html}}</a> {{$.locale.Tr "repo.tag.ahead.target" $.DefaultBranch}}</span>
</p>
{{else}}
<p class="text grey">
Expand Down

0 comments on commit c6c6fad

Please sign in to comment.