mirror of
https://github.com/go-gitea/gitea
synced 2025-07-27 04:38:36 +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:
@@ -131,7 +131,7 @@
|
||||
{{if not .IsTag}}
|
||||
<a class="title" href="{{$.RepoLink}}/src/{{.TagName | PathEscapeSegments}}">{{.Title | RenderEmoji}}</a>
|
||||
{{end}}
|
||||
{{TimeSinceUnix .CreatedUnix $.Lang}}
|
||||
{{TimeSinceUnix .CreatedUnix $.i18n.Lang}}
|
||||
</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 $.Lang}}
|
||||
{{TimeSinceUnix .MergedUnix $.i18n.Lang}}
|
||||
</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 $.Lang}}
|
||||
{{TimeSinceUnix .Issue.CreatedUnix $.i18n.Lang}}
|
||||
</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 $.Lang}}
|
||||
{{TimeSinceUnix .ClosedUnix $.i18n.Lang}}
|
||||
</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 $.Lang}}
|
||||
{{TimeSinceUnix .CreatedUnix $.i18n.Lang}}
|
||||
</p>
|
||||
{{end}}
|
||||
</div>
|
||||
@@ -231,7 +231,7 @@
|
||||
{{else}}
|
||||
<a class="title" href="{{$.RepoLink}}/issues/{{.Index}}">{{.Title | RenderEmoji}}</a>
|
||||
{{end}}
|
||||
{{TimeSinceUnix .UpdatedUnix $.Lang}}
|
||||
{{TimeSinceUnix .UpdatedUnix $.i18n.Lang}}
|
||||
</p>
|
||||
{{end}}
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user