mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-27 04:07:08 +00:00
Refactor i18n, use Locale to provide i18n/translation related functions (#18648)
* remove unnecessary web context data fields, and unify the i18n/translation related functions to `Locale` * in development, show an error if a translation key is missing * remove the unnecessary loops `for _, lang := range translation.AllLangs()` for every request, which improves the performance slightly * use `ctx.Locale.Language()` instead of `ctx.Data["Lang"].(string)` * add more comments about how the Locale/LangType fields are used
This commit is contained in:
parent
7b25a010c8
commit
a60e8be8d1
31 changed files with 75 additions and 75 deletions
|
@ -1,7 +1,7 @@
|
|||
{{ template "base/alert" }}
|
||||
{{range .Issue.Comments}}
|
||||
{{if call $.ShouldShowCommentType .Type}}
|
||||
{{ $createdStr:= TimeSinceUnix .CreatedUnix $.Lang }}
|
||||
{{ $createdStr:= TimeSinceUnix .CreatedUnix $.i18n.Lang }}
|
||||
|
||||
<!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF,
|
||||
5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 12 = START_TRACKING,
|
||||
|
@ -146,7 +146,7 @@
|
|||
{{else if eq .RefAction 2 }}
|
||||
{{ $refTr = "repo.issues.ref_reopening_from" }}
|
||||
{{end}}
|
||||
{{ $createdStr:= TimeSinceUnix .CreatedUnix $.Lang }}
|
||||
{{ $createdStr:= TimeSinceUnix .CreatedUnix $.i18n.Lang }}
|
||||
<div class="timeline-item event" id="{{.HashTag}}">
|
||||
<span class="badge">{{svg "octicon-bookmark"}}</span>
|
||||
<a href="{{.Poster.HomeLink}}">
|
||||
|
@ -557,7 +557,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 $.Lang }}
|
||||
{{ $createdSubStr:= TimeSinceUnix .CreatedUnix $.i18n.Lang }}
|
||||
<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 $.Lang }}
|
||||
{{ $createdStr:= TimeSinceUnix .Review.UpdatedUnix $.i18n.Lang }}
|
||||
<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 $.Lang }}
|
||||
{{ $createdStr:= TimeSinceUnix .UpdatedUnix $.i18n.Lang }}
|
||||
<div class="ui divider"></div>
|
||||
<div class="review-item">
|
||||
<div class="review-item-left">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue