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/repo/issue | |
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/repo/issue')
-rw-r--r-- | templates/repo/issue/milestone_issues.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/milestones.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/view_content.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/view_content/comments.tmpl | 6 | ||||
-rw-r--r-- | templates/repo/issue/view_content/pull.tmpl | 6 | ||||
-rw-r--r-- | templates/repo/issue/view_title.tmpl | 4 |
6 files changed, 11 insertions, 11 deletions
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}} |