diff options
author | Gusted <williamzijl7@hotmail.com> | 2022-06-26 16:19:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-26 22:19:22 +0800 |
commit | 5d3f99c7c6d0f2c304dc13c6fa6aa675daf310cc (patch) | |
tree | b44b05216bef3051123cd6b2fd9495cee1b91ece /templates | |
parent | 711cbcce8d6a193f5738c45861d11cb86b412ec7 (diff) | |
download | gitea-5d3f99c7c6d0f2c304dc13c6fa6aa675daf310cc.tar.gz gitea-5d3f99c7c6d0f2c304dc13c6fa6aa675daf310cc.zip |
Make better use of i18n (#20096)
* Prototyping
* Start work on creating offsets
* Modify tests
* Start prototyping with actual MPH
* Twiddle around
* Twiddle around comments
* Convert templates
* Fix external languages
* Fix latest translation
* Fix some test
* Tidy up code
* Use simple map
* go mod tidy
* Move back to data structure
- Uses less memory by creating for each language a map.
* Apply suggestions from code review
Co-authored-by: delvh <dev.lh@web.de>
* Add some comments
* Fix tests
* Try to fix tests
* Use en-US as defacto fallback
* Use correct slices
* refactor (#4)
* Remove TryTr, add log for missing translation key
* Refactor i18n
- Separate dev and production locale stores.
- Allow for live-reloading in dev mode.
Co-authored-by: zeripath <art27@cantab.net>
* Fix live-reloading & check for errors
* Make linter happy
* live-reload with periodic check (#5)
* Fix tests
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'templates')
33 files changed, 49 insertions, 49 deletions
diff --git a/templates/admin/cron.tmpl b/templates/admin/cron.tmpl index a73813ef88..cf3532c77d 100644 --- a/templates/admin/cron.tmpl +++ b/templates/admin/cron.tmpl @@ -24,7 +24,7 @@ <td>{{DateFmtLong .Next}}</td> <td>{{if gt .Prev.Year 1 }}{{DateFmtLong .Prev}}{{else}}N/A{{end}}</td> <td>{{.ExecTimes}}</td> - <td {{if ne .Status ""}}class="tooltip" data-content="{{.FormatLastMessage $.i18n.Language}}"{{end}} >{{if eq .Status "" }}—{{else if eq .Status "finished"}}{{svg "octicon-check" 16}}{{else}}{{svg "octicon-x" 16}}{{end}}</td> + <td {{if ne .Status ""}}class="tooltip" data-content="{{.FormatLastMessage $.i18n}}"{{end}} >{{if eq .Status "" }}—{{else if eq .Status "finished"}}{{svg "octicon-check" 16}}{{else}}{{svg "octicon-x" 16}}{{end}}</td> </tr> {{end}} </tbody> diff --git a/templates/admin/process-row.tmpl b/templates/admin/process-row.tmpl index 2191677a5c..d072a649f2 100644 --- a/templates/admin/process-row.tmpl +++ b/templates/admin/process-row.tmpl @@ -3,7 +3,7 @@ <div class="icon ml-3 mr-3">{{if eq .Process.Type "request"}}{{svg "octicon-globe" 16 }}{{else if eq .Process.Type "system"}}{{svg "octicon-cpu" 16 }}{{else}}{{svg "octicon-terminal" 16 }}{{end}}</div> <div class="content f1"> <div class="header">{{.Process.Description}}</div> - <div class="description"><span title="{{DateFmtLong .Process.Start}}">{{TimeSince .Process.Start .root.i18n.Lang}}</span></div> + <div class="description"><span title="{{DateFmtLong .Process.Start}}">{{TimeSince .Process.Start .root.i18n}}</span></div> </div> <div> {{if ne .Process.Type "system"}} diff --git a/templates/admin/stacktrace-row.tmpl b/templates/admin/stacktrace-row.tmpl index a21ef72d63..af7ea36230 100644 --- a/templates/admin/stacktrace-row.tmpl +++ b/templates/admin/stacktrace-row.tmpl @@ -13,7 +13,7 @@ </div> <div class="content f1"> <div class="header">{{.Process.Description}}</div> - <div class="description">{{if ne .Process.Type "none"}}<span title="{{DateFmtLong .Process.Start}}">{{TimeSince .Process.Start .root.i18n.Lang}}</span>{{end}}</div> + <div class="description">{{if ne .Process.Type "none"}}<span title="{{DateFmtLong .Process.Start}}">{{TimeSince .Process.Start .root.i18n}}</span>{{end}}</div> </div> <div> {{if or (eq .Process.Type "request") (eq .Process.Type "normal") }} diff --git a/templates/explore/repo_list.tmpl b/templates/explore/repo_list.tmpl index 1bc831d9df..c0e371b8a0 100644 --- a/templates/explore/repo_list.tmpl +++ b/templates/explore/repo_list.tmpl @@ -60,7 +60,7 @@ {{end}} </div> {{end}} - <p class="time">{{$.i18n.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.i18n.Lang}}</p> + <p class="time">{{$.i18n.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.i18n}}</p> </div> </div> {{else}} diff --git a/templates/package/shared/list.tmpl b/templates/package/shared/list.tmpl index ce2b57e4a0..eb2beac9e7 100644 --- a/templates/package/shared/list.tmpl +++ b/templates/package/shared/list.tmpl @@ -29,7 +29,7 @@ <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.Lang}} + {{$timeStr := TimeSinceUnix .Version.CreatedUnix $.i18n}} {{$hasRepositoryAccess := false}} {{if .Repository}} {{$hasRepositoryAccess = index $.RepositoryAccessMap .Repository.ID}} diff --git a/templates/package/shared/versionlist.tmpl b/templates/package/shared/versionlist.tmpl index 59f7cd1647..3d9ae5ef44 100644 --- a/templates/package/shared/versionlist.tmpl +++ b/templates/package/shared/versionlist.tmpl @@ -21,7 +21,7 @@ <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.Lang) .Creator.HomeLink (.Creator.GetDisplayName | Escape) | Safe}} + {{$.i18n.Tr "packages.published_by" (TimeSinceUnix .Version.CreatedUnix $.i18n) .Creator.HomeLink (.Creator.GetDisplayName | Escape) | Safe}} </div> </div> </li> diff --git a/templates/package/view.tmpl b/templates/package/view.tmpl index efad9f9b8f..9a3157c284 100644 --- a/templates/package/view.tmpl +++ b/templates/package/view.tmpl @@ -9,7 +9,7 @@ <h1>{{.PackageDescriptor.Package.Name}} ({{.PackageDescriptor.Version.Version}})</h1> </div> <div> - {{$timeStr := TimeSinceUnix .PackageDescriptor.Version.CreatedUnix $.i18n.Lang}} + {{$timeStr := TimeSinceUnix .PackageDescriptor.Version.CreatedUnix $.i18n}} {{if .HasRepositoryAccess}} {{.i18n.Tr "packages.published_by_in" $timeStr .PackageDescriptor.Creator.HomeLink (.PackageDescriptor.Creator.GetDisplayName | Escape) .PackageDescriptor.Repository.HTMLURL (.PackageDescriptor.Repository.FullName | Escape) | Safe}} {{else}} diff --git a/templates/repo/activity.tmpl b/templates/repo/activity.tmpl index 36108dddcb..c6fca86774 100644 --- a/templates/repo/activity.tmpl +++ b/templates/repo/activity.tmpl @@ -131,7 +131,7 @@ {{if not .IsTag}} <a class="title" href="{{$.RepoLink}}/src/{{.TagName | PathEscapeSegments}}">{{.Title | RenderEmoji}}</a> {{end}} - {{TimeSinceUnix .CreatedUnix $.i18n.Lang}} + {{TimeSinceUnix .CreatedUnix $.i18n}} </p> {{end}} </div> @@ -150,7 +150,7 @@ <p class="desc"> <span class="ui purple label">{{$.i18n.Tr "repo.activity.merged_prs_label"}}</span> #{{.Index}} <a class="title" href="{{$.RepoLink}}/pulls/{{.Index}}">{{.Issue.Title | RenderEmoji}}</a> - {{TimeSinceUnix .MergedUnix $.i18n.Lang}} + {{TimeSinceUnix .MergedUnix $.i18n}} </p> {{end}} </div> @@ -169,7 +169,7 @@ <p class="desc"> <span class="ui green label">{{$.i18n.Tr "repo.activity.opened_prs_label"}}</span> #{{.Index}} <a class="title" href="{{$.RepoLink}}/pulls/{{.Index}}">{{.Issue.Title | RenderEmoji}}</a> - {{TimeSinceUnix .Issue.CreatedUnix $.i18n.Lang}} + {{TimeSinceUnix .Issue.CreatedUnix $.i18n}} </p> {{end}} </div> @@ -188,7 +188,7 @@ <p class="desc"> <span class="ui red label">{{$.i18n.Tr "repo.activity.closed_issue_label"}}</span> #{{.Index}} <a class="title" href="{{$.RepoLink}}/issues/{{.Index}}">{{.Title | RenderEmoji}}</a> - {{TimeSinceUnix .ClosedUnix $.i18n.Lang}} + {{TimeSinceUnix .ClosedUnix $.i18n}} </p> {{end}} </div> @@ -207,7 +207,7 @@ <p class="desc"> <span class="ui green label">{{$.i18n.Tr "repo.activity.new_issue_label"}}</span> #{{.Index}} <a class="title" href="{{$.RepoLink}}/issues/{{.Index}}">{{.Title | RenderEmoji}}</a> - {{TimeSinceUnix .CreatedUnix $.i18n.Lang}} + {{TimeSinceUnix .CreatedUnix $.i18n}} </p> {{end}} </div> @@ -231,7 +231,7 @@ {{else}} <a class="title" href="{{$.RepoLink}}/issues/{{.Index}}">{{.Title | RenderEmoji}}</a> {{end}} - {{TimeSinceUnix .UpdatedUnix $.i18n.Lang}} + {{TimeSinceUnix .UpdatedUnix $.i18n}} </p> {{end}} </div> diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index 6c34ba4c19..d36a69e5be 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -18,7 +18,7 @@ {{svg "octicon-shield-lock"}} {{end}} <a href="{{.RepoLink}}/src/branch/{{PathEscapeSegments .DefaultBranch}}">{{.DefaultBranch}}</a> - <p class="info df ac my-2">{{svg "octicon-git-commit" 16 "mr-2"}}<a href="{{.RepoLink}}/commit/{{PathEscape .DefaultBranchBranch.Commit.ID.String}}">{{ShortSha .DefaultBranchBranch.Commit.ID.String}}</a> · <span class="commit-message">{{RenderCommitMessage $.Context .DefaultBranchBranch.Commit.CommitMessage .RepoLink .Repository.ComposeMetas}}</span> · {{.i18n.Tr "org.repo_updated"}} {{TimeSince .DefaultBranchBranch.Commit.Committer.When .i18n.Lang}}</p> + <p class="info df ac my-2">{{svg "octicon-git-commit" 16 "mr-2"}}<a href="{{.RepoLink}}/commit/{{PathEscape .DefaultBranchBranch.Commit.ID.String}}">{{ShortSha .DefaultBranchBranch.Commit.ID.String}}</a> · <span class="commit-message">{{RenderCommitMessage $.Context .DefaultBranchBranch.Commit.CommitMessage .RepoLink .Repository.ComposeMetas}}</span> · {{.i18n.Tr "org.repo_updated"}} {{TimeSince .DefaultBranchBranch.Commit.Committer.When .i18n}}</p> </td> <td class="right aligned overflow-visible"> {{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted)}} @@ -53,13 +53,13 @@ <td class="six wide"> {{if .IsDeleted}} <s><a href="{{$.RepoLink}}/src/branch/{{PathEscapeSegments .Name}}">{{.Name}}</a></s> - <p class="info">{{$.i18n.Tr "repo.branch.deleted_by" .DeletedBranch.DeletedBy.Name}} {{TimeSinceUnix .DeletedBranch.DeletedUnix $.i18n.Lang}}</p> + <p class="info">{{$.i18n.Tr "repo.branch.deleted_by" .DeletedBranch.DeletedBy.Name}} {{TimeSinceUnix .DeletedBranch.DeletedUnix $.i18n}}</p> {{else}} {{if .IsProtected}} {{svg "octicon-shield-lock"}} {{end}} <a href="{{$.RepoLink}}/src/branch/{{PathEscapeSegments .Name}}">{{.Name}}</a> - <p class="info df ac my-2">{{svg "octicon-git-commit" 16 "mr-2"}}<a href="{{$.RepoLink}}/commit/{{PathEscape .Commit.ID.String}}">{{ShortSha .Commit.ID.String}}</a> · <span class="commit-message">{{RenderCommitMessage $.Context .Commit.CommitMessage $.RepoLink $.Repository.ComposeMetas}}</span> · {{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}</p> + <p class="info df ac my-2">{{svg "octicon-git-commit" 16 "mr-2"}}<a href="{{$.RepoLink}}/commit/{{PathEscape .Commit.ID.String}}">{{ShortSha .Commit.ID.String}}</a> · <span class="commit-message">{{RenderCommitMessage $.Context .Commit.CommitMessage $.RepoLink $.Repository.ComposeMetas}}</span> · {{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n}}</p> {{end}} </td> <td class="three wide ui"> diff --git a/templates/repo/commit_page.tmpl b/templates/repo/commit_page.tmpl index 1e62968363..96190e3abf 100644 --- a/templates/repo/commit_page.tmpl +++ b/templates/repo/commit_page.tmpl @@ -156,7 +156,7 @@ {{avatarByEmail .Commit.Author.Email .Commit.Author.Email 28 "mr-3"}} <strong>{{.Commit.Author.Name}}</strong> {{end}} - <span class="text grey ml-3" id="authored-time">{{TimeSince .Commit.Author.When $.i18n.Lang}}</span> + <span class="text grey ml-3" id="authored-time">{{TimeSince .Commit.Author.When $.i18n}}</span> {{if or (ne .Commit.Committer.Name .Commit.Author.Name) (ne .Commit.Committer.Email .Commit.Author.Email)}} <span class="text grey mx-3">{{.i18n.Tr "repo.diff.committed_by"}}</span> {{if ne .Verification.CommittingUser.ID 0}} @@ -277,7 +277,7 @@ {{else}} <strong>{{.NoteCommit.Author.Name}}</strong> {{end}} - <span class="text grey" id="note-authored-time">{{TimeSince .NoteCommit.Author.When $.i18n.Lang}}</span> + <span class="text grey" id="note-authored-time">{{TimeSince .NoteCommit.Author.When $.i18n}}</span> </div> <div class="ui bottom attached info segment git-notes"> <pre class="commit-body">{{RenderNote $.Context .Note $.RepoLink $.Repository.ComposeMetas}}</pre> diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl index 65baee6b63..d94d313071 100644 --- a/templates/repo/commits_list.tmpl +++ b/templates/repo/commits_list.tmpl @@ -76,9 +76,9 @@ {{end}} </td> {{if .Committer}} - <td class="text right aligned">{{TimeSince .Committer.When $.i18n.Lang}}</td> + <td class="text right aligned">{{TimeSince .Committer.When $.i18n}}</td> {{else}} - <td class="text right aligned">{{TimeSince .Author.When $.i18n.Lang}}</td> + <td class="text right aligned">{{TimeSince .Author.When $.i18n}}</td> {{end}} </tr> {{end}} diff --git a/templates/repo/diff/comments.tmpl b/templates/repo/diff/comments.tmpl index 6a581ba04a..912c9d72ff 100644 --- a/templates/repo/diff/comments.tmpl +++ b/templates/repo/diff/comments.tmpl @@ -1,6 +1,6 @@ {{range .comments}} -{{ $createdStr:= TimeSinceUnix .CreatedUnix $.root.i18n.Lang }} +{{ $createdStr:= TimeSinceUnix .CreatedUnix $.root.i18n }} <div class="comment" id="{{.HashTag}}"> {{if .OriginalAuthor }} <span class="avatar"><img src="{{AppSubUrl}}/assets/img/avatar_default.png"></span> diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index cb2779db32..ca08b44fca 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -22,7 +22,7 @@ </div> <div class="ui one column stackable grid"> <div class="column"> - {{ $closedDate:= TimeSinceUnix .Milestone.ClosedDateUnix $.i18n.Lang }} + {{ $closedDate:= TimeSinceUnix .Milestone.ClosedDateUnix $.i18n }} {{if .IsClosed}} {{svg "octicon-clock"}} {{$.i18n.Tr "repo.milestones.closed" $closedDate|Str2html}} {{else}} diff --git a/templates/repo/issue/milestones.tmpl b/templates/repo/issue/milestones.tmpl index 235044cb17..6185ff3703 100644 --- a/templates/repo/issue/milestones.tmpl +++ b/templates/repo/issue/milestones.tmpl @@ -71,7 +71,7 @@ </div> </div> <div class="meta"> - {{ $closedDate:= TimeSinceUnix .ClosedDateUnix $.i18n.Lang }} + {{ $closedDate:= TimeSinceUnix .ClosedDateUnix $.i18n }} {{if .IsClosed}} {{svg "octicon-clock"}} {{$.i18n.Tr "repo.milestones.closed" $closedDate|Str2html}} {{else}} diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index 52353d46d9..a1a53c80f2 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -15,7 +15,7 @@ <input type="hidden" id="issueIndex" value="{{.Issue.Index}}"/> <input type="hidden" id="type" value="{{.IssueType}}"> - {{ $createdStr:= TimeSinceUnix .Issue.CreatedUnix $.i18n.Lang }} + {{ $createdStr:= TimeSinceUnix .Issue.CreatedUnix $.i18n }} <div class="twelve wide column comment-list prevent-before-timeline"> <ui class="ui timeline"> <div id="{{.Issue.HashTag}}" class="timeline-item comment first"> diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 0258a9f969..2dbc34e029 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -1,7 +1,7 @@ {{ template "base/alert" }} {{range .Issue.Comments}} {{if call $.ShouldShowCommentType .Type}} - {{ $createdStr:= TimeSinceUnix .CreatedUnix $.i18n.Lang }} + {{ $createdStr:= TimeSinceUnix .CreatedUnix $.i18n }} <!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF, 5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 12 = START_TRACKING, @@ -152,7 +152,7 @@ {{else if eq .RefAction 2 }} {{ $refTr = "repo.issues.ref_reopening_from" }} {{end}} - {{ $createdStr:= TimeSinceUnix .CreatedUnix $.i18n.Lang }} + {{ $createdStr:= TimeSinceUnix .CreatedUnix $.i18n }} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-bookmark"}}</span> <a href="{{.Poster.HomeLink}}"> @@ -563,7 +563,7 @@ <div id="code-comments-{{(index $comms 0).ID}}" class="comment-code-cloud ui segment{{if $resolved}} hide{{end}}"> <div class="ui comments mb-0"> {{range $comms}} - {{ $createdSubStr:= TimeSinceUnix .CreatedUnix $.i18n.Lang }} + {{ $createdSubStr:= TimeSinceUnix .CreatedUnix $.i18n }} <div class="comment code-comment pb-4" id="{{.HashTag}}"> <div class="content"> <div class="header comment-header"> diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 5a23bfa33b..e28eef30c2 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -4,7 +4,7 @@ <div class="ui segment"> <h4>{{$.i18n.Tr "repo.issues.review.reviewers"}}</h4> {{range .PullReviewers}} - {{ $createdStr:= TimeSinceUnix .Review.UpdatedUnix $.i18n.Lang }} + {{ $createdStr:= TimeSinceUnix .Review.UpdatedUnix $.i18n }} <div class="ui divider"></div> <div class="review-item"> <div class="review-item-left"> @@ -82,7 +82,7 @@ </div> {{end}} {{range .OriginalReviews}} - {{ $createdStr:= TimeSinceUnix .UpdatedUnix $.i18n.Lang }} + {{ $createdStr:= TimeSinceUnix .UpdatedUnix $.i18n }} <div class="ui divider"></div> <div class="review-item"> <div class="review-item-left"> @@ -328,7 +328,7 @@ {{if or $prUnit.PullRequestsConfig.AllowMerge $prUnit.PullRequestsConfig.AllowRebase $prUnit.PullRequestsConfig.AllowRebaseMerge $prUnit.PullRequestsConfig.AllowSquash}} {{$hasPendingPullRequestMergeTip := ""}} {{if .HasPendingPullRequestMerge}} - {{$createdPRMergeStr := TimeSinceUnix .PendingPullRequestMerge.CreatedUnix $.i18n.Lang}} + {{$createdPRMergeStr := TimeSinceUnix .PendingPullRequestMerge.CreatedUnix $.i18n}} {{$hasPendingPullRequestMergeTip = $.i18n.Tr "repo.pulls.auto_merge_has_pending_schedule" .PendingPullRequestMerge.Doer.Name $createdPRMergeStr}} {{end}} <div class="ui divider"></div> diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl index 22ad58876f..e229731a4e 100644 --- a/templates/repo/issue/view_title.tmpl +++ b/templates/repo/issue/view_title.tmpl @@ -40,7 +40,7 @@ {{$baseHref = printf "<a href=\"%s\">%s</a>" (.BaseBranchHTMLURL | Escape) $baseHref}} {{end}} {{if .Issue.PullRequest.HasMerged}} - {{ $mergedStr:= TimeSinceUnix .Issue.PullRequest.MergedUnix $.i18n.Lang }} + {{ $mergedStr:= TimeSinceUnix .Issue.PullRequest.MergedUnix $.i18n }} {{if .Issue.OriginalAuthor }} {{.Issue.OriginalAuthor}} <span class="pull-desc">{{$.i18n.Tr "repo.pulls.merged_title_desc" .NumCommits $headHref $baseHref $mergedStr | Safe}}</span> @@ -88,7 +88,7 @@ </span> {{end}} {{else}} - {{ $createdStr:= TimeSinceUnix .Issue.CreatedUnix $.i18n.Lang }} + {{ $createdStr:= TimeSinceUnix .Issue.CreatedUnix $.i18n }} <span class="time-desc"> {{if .Issue.OriginalAuthor }} {{$.i18n.Tr "repo.issues.opened_by_fake" $createdStr (.Issue.OriginalAuthor|Escape) | Safe}} diff --git a/templates/repo/projects/list.tmpl b/templates/repo/projects/list.tmpl index 7a2366da0b..54ec8aaf00 100644 --- a/templates/repo/projects/list.tmpl +++ b/templates/repo/projects/list.tmpl @@ -42,7 +42,7 @@ <li class="item"> {{svg "octicon-project"}} <a href="{{$.RepoLink}}/projects/{{.ID}}">{{.Title}}</a> <div class="meta"> - {{ $closedDate:= TimeSinceUnix .ClosedDateUnix $.i18n.Lang }} + {{ $closedDate:= TimeSinceUnix .ClosedDateUnix $.i18n }} {{if .IsClosed }} {{svg "octicon-clock"}} {{$.i18n.Tr "repo.milestones.closed" $closedDate|Str2html}} {{end}} diff --git a/templates/repo/projects/view.tmpl b/templates/repo/projects/view.tmpl index 7d4d21f8fe..89a285dccb 100644 --- a/templates/repo/projects/view.tmpl +++ b/templates/repo/projects/view.tmpl @@ -207,7 +207,7 @@ <div class="meta my-2"> <span class="text light grey"> #{{.Index}} - {{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.i18n.Lang }} + {{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.i18n }} {{if .OriginalAuthor }} {{$.i18n.Tr .GetLastEventLabelFake $timeStr (.OriginalAuthor|Escape) | Safe}} {{else if gt .Poster.ID 0}} diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl index 956c60ad78..d6d9c2b991 100644 --- a/templates/repo/release/list.tmpl +++ b/templates/repo/release/list.tmpl @@ -65,7 +65,7 @@ <li class="ui grid"> <div class="ui four wide column meta mt-2"> {{if .IsTag}} - {{if .CreatedUnix}}<span class="time">{{TimeSinceUnix .CreatedUnix $.i18n.Lang}}</span>{{end}} + {{if .CreatedUnix}}<span class="time">{{TimeSinceUnix .CreatedUnix $.i18n}}</span>{{end}} {{else}} {{if .IsDraft}} <span class="ui yellow label">{{$.i18n.Tr "repo.release.draft"}}</span> @@ -132,7 +132,7 @@ {{$.i18n.Tr "repo.released_this"}} </span> {{if .CreatedUnix}} - <span class="time">{{TimeSinceUnix .CreatedUnix $.i18n.Lang}}</span> + <span class="time">{{TimeSinceUnix .CreatedUnix $.i18n}}</span> {{end}} {{if not .IsDraft}} | <span class="ahead"><a href="{{$.RepoLink}}/compare/{{.TagName | PathEscapeSegments}}...{{.Target | PathEscapeSegments}}">{{$.i18n.Tr "repo.release.ahead.commits" .NumCommitsBehind | Str2html}}</a> {{$.i18n.Tr "repo.release.ahead.target" .Target}}</span> diff --git a/templates/repo/settings/lfs.tmpl b/templates/repo/settings/lfs.tmpl index 9b5c646209..e5b0edd03d 100644 --- a/templates/repo/settings/lfs.tmpl +++ b/templates/repo/settings/lfs.tmpl @@ -23,7 +23,7 @@ </span> </td> <td>{{FileSize .Size}}</td> - <td>{{TimeSince .CreatedUnix.AsTime $.i18n.Lang}}</td> + <td>{{TimeSince .CreatedUnix.AsTime $.i18n}}</td> <td class="right aligned"> <a class="ui primary show-panel button" href="{{$.Link}}/find?oid={{.Oid}}&size={{.Size}}">{{$.i18n.Tr "repo.settings.lfs_findcommits"}}</a> <button class="ui basic show-modal icon button" data-modal="#delete-{{.Oid}}"> diff --git a/templates/repo/settings/lfs_file_find.tmpl b/templates/repo/settings/lfs_file_find.tmpl index 77e49989dd..53c1d69113 100644 --- a/templates/repo/settings/lfs_file_find.tmpl +++ b/templates/repo/settings/lfs_file_find.tmpl @@ -37,7 +37,7 @@ {{$.i18n.Tr "repo.diff.commit"}} <a class="ui primary sha label" href="{{$.RepoLink}}/commit/{{.SHA}}">{{ShortSha .SHA}}</a> </td> - <td>{{TimeSince .When $.i18n.Lang}}</td> + <td>{{TimeSince .When $.i18n}}</td> </tr> {{else}} <tr> diff --git a/templates/repo/settings/lfs_locks.tmpl b/templates/repo/settings/lfs_locks.tmpl index 5079381453..aa1064fa37 100644 --- a/templates/repo/settings/lfs_locks.tmpl +++ b/templates/repo/settings/lfs_locks.tmpl @@ -39,7 +39,7 @@ {{$.Owner.DisplayName}} </a> </td> - <td>{{TimeSince .Created $.i18n.Lang}}</td> + <td>{{TimeSince .Created $.i18n}}</td> <td class="right aligned"> <form action="{{$.LFSFilesLink}}/locks/{{$lock.ID}}/unlock" method="POST"> {{$.CsrfTokenHtml}} diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl index ef0ab866f5..188bb9f3ce 100644 --- a/templates/repo/view_list.tmpl +++ b/templates/repo/view_list.tmpl @@ -34,7 +34,7 @@ </span> {{end}} </th> - <th class="text grey right age">{{if .LatestCommit}}{{if .LatestCommit.Committer}}{{TimeSince .LatestCommit.Committer.When $.i18n.Lang}}{{end}}{{end}}</th> + <th class="text grey right age">{{if .LatestCommit}}{{if .LatestCommit.Committer}}{{TimeSince .LatestCommit.Committer.When $.i18n}}{{end}}{{end}}</th> </tr> </thead> <tbody> @@ -87,7 +87,7 @@ {{end}} </span> </td> - <td class="text right age three wide">{{if $commit}}{{TimeSince $commit.Committer.When $.i18n.Lang}}{{end}}</td> + <td class="text right age three wide">{{if $commit}}{{TimeSince $commit.Committer.When $.i18n}}{{end}}</td> </tr> {{end}} </tbody> diff --git a/templates/repo/wiki/pages.tmpl b/templates/repo/wiki/pages.tmpl index 74674c6f1c..c680327d8b 100644 --- a/templates/repo/wiki/pages.tmpl +++ b/templates/repo/wiki/pages.tmpl @@ -20,7 +20,7 @@ {{svg "octicon-file"}} <a href="{{$.RepoLink}}/wiki/{{.SubURL}}">{{.Name}}</a> </td> - {{$timeSince := TimeSinceUnix .UpdatedUnix $.i18n.Lang}} + {{$timeSince := TimeSinceUnix .UpdatedUnix $.i18n}} <td class="text right grey">{{$.i18n.Tr "repo.wiki.last_updated" $timeSince | Safe}}</td> </tr> {{end}} diff --git a/templates/repo/wiki/revision.tmpl b/templates/repo/wiki/revision.tmpl index 4e55da82fb..365f565213 100644 --- a/templates/repo/wiki/revision.tmpl +++ b/templates/repo/wiki/revision.tmpl @@ -13,7 +13,7 @@ <a class="file-revisions-btn ui basic button" title="{{.i18n.Tr "repo.wiki.back_to_wiki"}}" href="{{.RepoLink}}/wiki/{{.PageURL}}" ><span>{{.revision}}</span> {{svg "octicon-home"}}</a> {{$title}} <div class="ui sub header word-break"> - {{$timeSince := TimeSince .Author.When $.i18n.Lang}} + {{$timeSince := TimeSince .Author.When $.i18n}} {{.i18n.Tr "repo.wiki.last_commit_info" .Author.Name $timeSince | Safe}} </div> </div> diff --git a/templates/repo/wiki/view.tmpl b/templates/repo/wiki/view.tmpl index 3189ed64ca..12318858c9 100644 --- a/templates/repo/wiki/view.tmpl +++ b/templates/repo/wiki/view.tmpl @@ -40,7 +40,7 @@ <a class="file-revisions-btn ui basic button" title="{{.i18n.Tr "repo.wiki.file_revision"}}" href="{{.RepoLink}}/wiki/{{.PageURL}}?action=_revision" ><span>{{.CommitCount}}</span> {{svg "octicon-history"}}</a> {{$title}} <div class="ui sub header"> - {{$timeSince := TimeSince .Author.When $.i18n.Lang}} + {{$timeSince := TimeSince .Author.When $.i18n}} {{.i18n.Tr "repo.wiki.last_commit_info" .Author.Name $timeSince | Safe}} </div> </div> diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index 5392365dd1..25dcc5d458 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -51,7 +51,7 @@ #{{.Index}} {{end}} </a> - {{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.i18n.Lang }} + {{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.i18n }} {{if .OriginalAuthor }} {{$.i18n.Tr .GetLastEventLabelFake $timeStr (.OriginalAuthor|Escape) | Safe}} {{else if gt .Poster.ID 0}} diff --git a/templates/shared/searchbottom.tmpl b/templates/shared/searchbottom.tmpl index ab4c135ffe..bb38210eca 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.Lang) | Safe}}</span> + <span class="ui grey text">{{.root.i18n.Tr "explore.code_last_indexed_at" (TimeSinceUnix .result.UpdatedUnix .root.i18n) | Safe}}</span> {{end}} </div> </div> diff --git a/templates/user/dashboard/feeds.tmpl b/templates/user/dashboard/feeds.tmpl index 09786499b8..d3a8afcb55 100644 --- a/templates/user/dashboard/feeds.tmpl +++ b/templates/user/dashboard/feeds.tmpl @@ -114,7 +114,7 @@ <p class="text light grey">{{$.i18n.Tr "action.review_dismissed_reason"}}</p> <p class="text light grey">{{index .GetIssueInfos 2 | RenderEmoji}}</p> {{end}} - <p class="text italic light grey">{{TimeSince .GetCreate $.i18n.Lang}}</p> + <p class="text italic light grey">{{TimeSince .GetCreate $.i18n}}</p> </div> </div> <div class="ui two wide right aligned column"> diff --git a/templates/user/dashboard/milestones.tmpl b/templates/user/dashboard/milestones.tmpl index 738438423f..f231d52215 100644 --- a/templates/user/dashboard/milestones.tmpl +++ b/templates/user/dashboard/milestones.tmpl @@ -91,7 +91,7 @@ </div> </div> <div class="meta"> - {{ $closedDate:= TimeSinceUnix .ClosedDateUnix $.i18n.Lang }} + {{ $closedDate:= TimeSinceUnix .ClosedDateUnix $.i18n }} {{if .IsClosed}} {{svg "octicon-clock"}} {{$.i18n.Tr "repo.milestones.closed" $closedDate|Str2html}} {{else}} diff --git a/templates/user/settings/security/webauthn.tmpl b/templates/user/settings/security/webauthn.tmpl index 51a6deb187..733b3066c5 100644 --- a/templates/user/settings/security/webauthn.tmpl +++ b/templates/user/settings/security/webauthn.tmpl @@ -14,7 +14,7 @@ <div class="content"> <strong>{{.Name}}</strong> </div> - <span class="time">{{TimeSinceUnix .CreatedUnix $.i18n.Lang}}</span> + <span class="time">{{TimeSinceUnix .CreatedUnix $.i18n}}</span> </div> {{end}} </div> |