mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
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>
This commit is contained in:
@@ -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}}
|
||||
|
@@ -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}}
|
||||
|
@@ -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">
|
||||
|
@@ -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">
|
||||
|
@@ -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>
|
||||
|
@@ -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}}
|
||||
|
Reference in New Issue
Block a user