1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-03 09:07:19 +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:
Gusted
2022-06-26 16:19:22 +02:00
committed by GitHub
parent 711cbcce8d
commit 5d3f99c7c6
60 changed files with 340 additions and 282 deletions

View File

@ -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">

View File

@ -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>