1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-23 10:48:37 +00:00

Always use ctx.Locale.Tr inside templates (#27231)

This commit is contained in:
delvh
2023-09-25 10:56:50 +02:00
committed by GitHub
parent e6d8b14620
commit 7960ba7e2b
305 changed files with 3810 additions and 3810 deletions

View File

@@ -1,6 +1,6 @@
<div class="runner-container">
<h4 class="ui top attached header">
{{.locale.Tr "actions.runners.runner_title"}} {{.Runner.ID}} {{.Runner.Name}}
{{ctx.Locale.Tr "actions.runners.runner_title"}} {{.Runner.ID}} {{.Runner.Name}}
</h4>
<div class="ui attached segment">
<form class="ui form" method="post">
@@ -8,15 +8,15 @@
{{.CsrfTokenHtml}}
<div class="runner-basic-info">
<div class="field gt-dib gt-mr-4">
<label>{{.locale.Tr "actions.runners.status"}}</label>
<label>{{ctx.Locale.Tr "actions.runners.status"}}</label>
<span class="ui {{if .Runner.IsOnline}}green{{else}}basic{{end}} label">{{.Runner.StatusLocaleName $.locale}}</span>
</div>
<div class="field gt-dib gt-mr-4">
<label>{{.locale.Tr "actions.runners.last_online"}}</label>
<span>{{if .Runner.LastOnline}}{{TimeSinceUnix .Runner.LastOnline $.locale}}{{else}}{{$.locale.Tr "never"}}{{end}}</span>
<label>{{ctx.Locale.Tr "actions.runners.last_online"}}</label>
<span>{{if .Runner.LastOnline}}{{TimeSinceUnix .Runner.LastOnline $.locale}}{{else}}{{ctx.Locale.Tr "never"}}{{end}}</span>
</div>
<div class="field gt-dib gt-mr-4">
<label>{{.locale.Tr "actions.runners.labels"}}</label>
<label>{{ctx.Locale.Tr "actions.runners.labels"}}</label>
<span>
{{range .Runner.AgentLabels}}
<span class="ui label">{{.}}</span>
@@ -24,7 +24,7 @@
</span>
</div>
<div class="field gt-dib gt-mr-4">
<label>{{.locale.Tr "actions.runners.owner_type"}}</label>
<label>{{ctx.Locale.Tr "actions.runners.owner_type"}}</label>
<span data-tooltip-content="{{.Runner.BelongsToOwnerName}}">{{.Runner.BelongsToOwnerType.LocaleString $.locale}}</span>
</div>
</div>
@@ -32,32 +32,32 @@
<div class="divider"></div>
<div class="field">
<label for="description">{{.locale.Tr "actions.runners.description"}}</label>
<label for="description">{{ctx.Locale.Tr "actions.runners.description"}}</label>
<input id="description" name="description" value="{{.Runner.Description}}">
</div>
<div class="divider"></div>
<div class="field">
<button class="ui primary button" data-url="{{.Link}}">{{.locale.Tr "actions.runners.update_runner"}}</button>
<button class="ui primary button" data-url="{{.Link}}">{{ctx.Locale.Tr "actions.runners.update_runner"}}</button>
<button class="ui red button delete-button show-modal" data-url="{{.Link}}/delete" data-modal="#runner-delete-modal">
{{.locale.Tr "actions.runners.delete_runner"}}</button>
{{ctx.Locale.Tr "actions.runners.delete_runner"}}</button>
</div>
</form>
</div>
<h4 class="ui top attached header">
{{.locale.Tr "actions.runners.task_list"}}
{{ctx.Locale.Tr "actions.runners.task_list"}}
</h4>
<div class="ui attached segment">
<table class="ui very basic striped table unstackable">
<thead>
<tr>
<th>{{.locale.Tr "actions.runners.task_list.run"}}</th>
<th>{{.locale.Tr "actions.runners.task_list.status"}}</th>
<th>{{.locale.Tr "actions.runners.task_list.repository"}}</th>
<th>{{.locale.Tr "actions.runners.task_list.commit"}}</th>
<th>{{.locale.Tr "actions.runners.task_list.done_at"}}</th>
<th>{{ctx.Locale.Tr "actions.runners.task_list.run"}}</th>
<th>{{ctx.Locale.Tr "actions.runners.task_list.status"}}</th>
<th>{{ctx.Locale.Tr "actions.runners.task_list.repository"}}</th>
<th>{{ctx.Locale.Tr "actions.runners.task_list.commit"}}</th>
<th>{{ctx.Locale.Tr "actions.runners.task_list.done_at"}}</th>
</tr>
</thead>
<tbody>
@@ -76,7 +76,7 @@
{{end}}
{{if not .Tasks}}
<tr>
<td colspan="5">{{.locale.Tr "actions.runners.task_list.no_tasks"}}</td>
<td colspan="5">{{ctx.Locale.Tr "actions.runners.task_list.no_tasks"}}</td>
</tr>
{{end}}
</tbody>
@@ -86,10 +86,10 @@
<div class="ui g-modal-confirm delete modal" id="runner-delete-modal">
<div class="header">
{{svg "octicon-trash"}}
{{.locale.Tr "actions.runners.delete_runner_header"}}
{{ctx.Locale.Tr "actions.runners.delete_runner_header"}}
</div>
<div class="content">
<p>{{.locale.Tr "actions.runners.delete_runner_notice" | Safe}}</p>
<p>{{ctx.Locale.Tr "actions.runners.delete_runner_notice" | Safe}}</p>
</div>
{{template "base/modal_actions_confirm" .}}
</div>

View File

@@ -5,7 +5,7 @@
<div class="flex-item-icon">
{{if $.CanWriteIssuesOrPulls}}
<input type="checkbox" autocomplete="off" class="issue-checkbox gt-mr-4" data-issue-id={{.ID}} aria-label="{{$.locale.Tr "repo.issues.action_check"}} &quot;{{.Title}}&quot;">
<input type="checkbox" autocomplete="off" class="issue-checkbox gt-mr-4" data-issue-id={{.ID}} aria-label="{{ctx.Locale.Tr "repo.issues.action_check"}} &quot;{{.Title}}&quot;">
{{end}}
{{template "shared/issueicon" .}}
</div>
@@ -62,11 +62,11 @@
</a>
{{$timeStr := TimeSinceUnix .GetLastEventTimestamp $.locale}}
{{if .OriginalAuthor}}
{{$.locale.Tr .GetLastEventLabelFake $timeStr (.OriginalAuthor|Escape) | Safe}}
{{ctx.Locale.Tr .GetLastEventLabelFake $timeStr (.OriginalAuthor|Escape) | Safe}}
{{else if gt .Poster.ID 0}}
{{$.locale.Tr .GetLastEventLabel $timeStr (.Poster.HomeLink|Escape) (.Poster.GetDisplayName | Escape) | Safe}}
{{ctx.Locale.Tr .GetLastEventLabel $timeStr (.Poster.HomeLink|Escape) (.Poster.GetDisplayName | Escape) | Safe}}
{{else}}
{{$.locale.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}}
{{ctx.Locale.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}}
{{end}}
{{if .IsPull}}
<div class="branches flex-text-inline">
@@ -111,7 +111,7 @@
</span>
{{end}}
{{if ne .DeadlineUnix 0}}
<span class="due-date flex-text-inline" data-tooltip-content="{{$.locale.Tr "repo.issues.due_date"}}">
<span class="due-date flex-text-inline" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.due_date"}}">
<span{{if .IsOverdue}} class="text red"{{end}}>
{{svg "octicon-calendar" 14}}
{{DateTime "short" .DeadlineUnix}}
@@ -125,25 +125,25 @@
{{if gt $approveOfficial 0}}
<span class="approvals green flex-text-inline">
{{svg "octicon-check" 14}}
{{$.locale.TrN $approveOfficial "repo.pulls.approve_count_1" "repo.pulls.approve_count_n" $approveOfficial}}
{{ctx.Locale.TrN $approveOfficial "repo.pulls.approve_count_1" "repo.pulls.approve_count_n" $approveOfficial}}
</span>
{{end}}
{{if gt $rejectOfficial 0}}
<span class="rejects red flex-text-inline">
{{svg "octicon-diff" 14}}
{{$.locale.TrN $rejectOfficial "repo.pulls.reject_count_1" "repo.pulls.reject_count_n" $rejectOfficial}}
{{ctx.Locale.TrN $rejectOfficial "repo.pulls.reject_count_1" "repo.pulls.reject_count_n" $rejectOfficial}}
</span>
{{end}}
{{if gt $waitingOfficial 0}}
<span class="waiting flex-text-inline">
{{svg "octicon-eye" 14}}
{{$.locale.TrN $waitingOfficial "repo.pulls.waiting_count_1" "repo.pulls.waiting_count_n" $waitingOfficial}}
{{ctx.Locale.TrN $waitingOfficial "repo.pulls.waiting_count_1" "repo.pulls.waiting_count_n" $waitingOfficial}}
</span>
{{end}}
{{if and (not .PullRequest.HasMerged) (gt (len .PullRequest.ConflictedFiles) 0)}}
<span class="conflicting flex-text-inline">
{{svg "octicon-x" 14}}
{{$.locale.TrN (len .PullRequest.ConflictedFiles) "repo.pulls.num_conflicting_files_1" "repo.pulls.num_conflicting_files_n" (len .PullRequest.ConflictedFiles)}}
{{ctx.Locale.TrN (len .PullRequest.ConflictedFiles) "repo.pulls.num_conflicting_files_1" "repo.pulls.num_conflicting_files_n" (len .PullRequest.ConflictedFiles)}}
</span>
{{end}}
{{end}}
@@ -153,7 +153,7 @@
{{end}}
{{if .IssueIndexerUnavailable}}
<div class="ui error message">
<p>{{$.locale.Tr "repo.issues.keyword_search_unavailable"}}</p>
<p>{{ctx.Locale.Tr "repo.issues.keyword_search_unavailable"}}</p>
</div>
{{end}}
</div>

View File

@@ -6,7 +6,7 @@
</div>
<div class="gt-mr-4">
{{if not .result.UpdatedUnix.IsZero}}
<span class="ui grey text">{{.root.locale.Tr "explore.code_last_indexed_at" (TimeSinceUnix .result.UpdatedUnix .root.locale) | Safe}}</span>
<span class="ui grey text">{{ctx.Locale.Tr "explore.code_last_indexed_at" (TimeSinceUnix .result.UpdatedUnix .root.locale) | Safe}}</span>
{{end}}
</div>
</div>

View File

@@ -1,12 +1,12 @@
<h4 class="ui top attached header">
{{.locale.Tr "secrets.management"}}
{{ctx.Locale.Tr "secrets.management"}}
<div class="ui right">
<button class="ui primary tiny button show-modal"
data-modal="#add-secret-modal"
data-modal-form.action="{{.Link}}"
data-modal-header="{{.locale.Tr "secrets.creation"}}"
data-modal-header="{{ctx.Locale.Tr "secrets.creation"}}"
>
{{.locale.Tr "secrets.creation"}}
{{ctx.Locale.Tr "secrets.creation"}}
</button>
</div>
</h4>
@@ -28,12 +28,12 @@
</div>
<div class="flex-item-trailing">
<span class="color-text-light-2">
{{$.locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix) | Safe}}
{{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix) | Safe}}
</span>
<button class="ui btn interact-bg link-action gt-p-3"
data-url="{{$.Link}}/delete?id={{.ID}}"
data-modal-confirm="{{$.locale.Tr "secrets.deletion.description"}}"
data-tooltip-content="{{$.locale.Tr "secrets.deletion"}}"
data-modal-confirm="{{ctx.Locale.Tr "secrets.deletion.description"}}"
data-tooltip-content="{{ctx.Locale.Tr "secrets.deletion"}}"
>
{{svg "octicon-trash"}}
</button>
@@ -42,7 +42,7 @@
{{end}}
</div>
{{else}}
{{.locale.Tr "secrets.none"}}
{{ctx.Locale.Tr "secrets.none"}}
{{end}}
</div>
@@ -55,24 +55,24 @@
<div class="content">
{{.CsrfTokenHtml}}
<div class="field">
{{.locale.Tr "secrets.description"}}
{{ctx.Locale.Tr "secrets.description"}}
</div>
<div class="field">
<label for="secret-name">{{.locale.Tr "name"}}</label>
<label for="secret-name">{{ctx.Locale.Tr "name"}}</label>
<input autofocus required
id="secret-name"
name="name"
value="{{.name}}"
pattern="^(?!GITEA_|GITHUB_)[a-zA-Z_][a-zA-Z0-9_]*$"
placeholder="{{.locale.Tr "secrets.creation.name_placeholder"}}"
placeholder="{{ctx.Locale.Tr "secrets.creation.name_placeholder"}}"
>
</div>
<div class="field">
<label for="secret-data">{{.locale.Tr "value"}}</label>
<label for="secret-data">{{ctx.Locale.Tr "value"}}</label>
<textarea required
id="secret-data"
name="data"
placeholder="{{.locale.Tr "secrets.creation.value_placeholder"}}"
placeholder="{{ctx.Locale.Tr "secrets.creation.value_placeholder"}}"
></textarea>
</div>
</div>

View File

@@ -6,8 +6,8 @@
{{ctx.AvatarUtils.Avatar . 100}}
<span class="text thin grey"><a href="{{.HomeLink}}">{{.DisplayName}}</a></span>
<span class="org-visibility">
{{if .Visibility.IsLimited}}<div class="ui medium basic horizontal label">{{$.locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}}
{{if .Visibility.IsPrivate}}<div class="ui medium basic horizontal label">{{$.locale.Tr "org.settings.visibility.private_shortname"}}</div>{{end}}
{{if .Visibility.IsLimited}}<div class="ui medium basic horizontal label">{{ctx.Locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}}
{{if .Visibility.IsPrivate}}<div class="ui medium basic horizontal label">{{ctx.Locale.Tr "org.settings.visibility.private_shortname"}}</div>{{end}}
</span>
</div>
</div>

View File

@@ -1,7 +1,7 @@
<div class="ui card">
<div id="profile-avatar" class="content gt-df">
{{if eq .SignedUserID .ContextUser.ID}}
<a class="image" href="{{AppSubUrl}}/user/settings" data-tooltip-content="{{.locale.Tr "user.change_avatar"}}">
<a class="image" href="{{AppSubUrl}}/user/settings" data-tooltip-content="{{ctx.Locale.Tr "user.change_avatar"}}">
{{/* the size doesn't take affect (and no need to take affect), image size(width) should be controlled by the parent container since this is not a flex layout*/}}
{{ctx.AvatarUtils.Avatar .ContextUser 256}}
</a>
@@ -15,9 +15,9 @@
{{if .ContextUser.FullName}}<span class="header text center">{{.ContextUser.FullName}}</span>{{end}}
<span class="username text center">{{.ContextUser.Name}}</span>
<div class="gt-mt-3">
<a class="muted" href="{{.ContextUser.HomeLink}}?tab=followers">{{svg "octicon-person" 18 "gt-mr-2"}}{{.NumFollowers}} {{.locale.Tr "user.followers"}}</a> · <a class="muted" href="{{.ContextUser.HomeLink}}?tab=following">{{.NumFollowing}} {{.locale.Tr "user.following"}}</a>
<a class="muted" href="{{.ContextUser.HomeLink}}?tab=followers">{{svg "octicon-person" 18 "gt-mr-2"}}{{.NumFollowers}} {{ctx.Locale.Tr "user.followers"}}</a> · <a class="muted" href="{{.ContextUser.HomeLink}}?tab=following">{{.NumFollowing}} {{.locale.Tr "user.following"}}</a>
{{if .EnableFeed}}
<a href="{{.ContextUser.HomeLink}}.rss"><i class="ui text grey gt-ml-3" data-tooltip-content="{{.locale.Tr "rss_feed"}}">{{svg "octicon-rss" 18}}</i></a>
<a href="{{.ContextUser.HomeLink}}.rss"><i class="ui text grey gt-ml-3" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">{{svg "octicon-rss" 18}}</i></a>
{{end}}
</div>
</div>
@@ -29,7 +29,7 @@
<span class="gt-f1">{{.ContextUser.Location}}</span>
{{if .UserLocationMapURL}}
{{/* We presume that the UserLocationMapURL is safe, as it is provided by the site administrator. */}}
<a href="{{.UserLocationMapURL | Safe}}{{.ContextUser.Location | QueryEscape}}" rel="nofollow noreferrer" data-tooltip-content="{{.locale.Tr "user.show_on_map"}}">
<a href="{{.UserLocationMapURL | Safe}}{{.ContextUser.Location | QueryEscape}}" rel="nofollow noreferrer" data-tooltip-content="{{ctx.Locale.Tr "user.show_on_map"}}">
{{svg "octicon-link-external"}}
</a>
{{end}}
@@ -41,11 +41,11 @@
<a class="gt-f1" href="mailto:{{.ContextUser.Email}}" rel="nofollow">{{.ContextUser.Email}}</a>
<a href="{{AppSubUrl}}/user/settings#privacy-user-settings">
{{if .ShowUserEmail}}
<i data-tooltip-content="{{.locale.Tr "user.email_visibility.limited"}}">
<i data-tooltip-content="{{ctx.Locale.Tr "user.email_visibility.limited"}}">
{{svg "octicon-unlock"}}
</i>
{{else}}
<i data-tooltip-content="{{.locale.Tr "user.email_visibility.private"}}">
<i data-tooltip-content="{{ctx.Locale.Tr "user.email_visibility.private"}}">
{{svg "octicon-lock"}}
</i>
{{end}}
@@ -78,7 +78,7 @@
</li>
{{end}}
{{end}}
<li>{{svg "octicon-calendar"}} <span>{{.locale.Tr "user.joined_on" (DateTime "short" .ContextUser.CreatedUnix) | Safe}}</span></li>
<li>{{svg "octicon-calendar"}} <span>{{ctx.Locale.Tr "user.joined_on" (DateTime "short" .ContextUser.CreatedUnix) | Safe}}</span></li>
{{if and .Orgs .HasOrgsVisible}}
<li>
<ul class="user-orgs">
@@ -109,11 +109,11 @@
<li class="follow">
{{if $.IsFollowing}}
<button class="ui basic red button link-action" data-url="{{.ContextUser.HomeLink}}?action=unfollow">
{{svg "octicon-person"}} {{.locale.Tr "user.unfollow"}}
{{svg "octicon-person"}} {{ctx.Locale.Tr "user.unfollow"}}
</button>
{{else}}
<button class="ui basic primary button link-action" data-url="{{.ContextUser.HomeLink}}?action=follow">
{{svg "octicon-person"}} {{.locale.Tr "user.follow"}}
{{svg "octicon-person"}} {{ctx.Locale.Tr "user.follow"}}
</button>
{{end}}
</li>

View File

@@ -1,14 +1,14 @@
<h4 class="ui top attached header">
{{.locale.Tr "actions.variables.management"}}
{{ctx.Locale.Tr "actions.variables.management"}}
<div class="ui right">
<button class="ui primary tiny button show-modal"
data-modal="#edit-variable-modal"
data-modal-form.action="{{.Link}}/new"
data-modal-header="{{.locale.Tr "actions.variables.creation"}}"
data-modal-header="{{ctx.Locale.Tr "actions.variables.creation"}}"
data-modal-dialog-variable-name=""
data-modal-dialog-variable-data=""
>
{{.locale.Tr "actions.variables.creation"}}
{{ctx.Locale.Tr "actions.variables.creation"}}
</button>
</div>
</h4>
@@ -30,22 +30,22 @@
</div>
<div class="flex-item-trailing">
<span class="color-text-light-2">
{{$.locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix) | Safe}}
{{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix) | Safe}}
</span>
<button class="btn interact-bg gt-p-3 show-modal"
data-tooltip-content="{{$.locale.Tr "variables.edit"}}"
data-tooltip-content="{{ctx.Locale.Tr "variables.edit"}}"
data-modal="#edit-variable-modal"
data-modal-form.action="{{$.Link}}/{{.ID}}/edit"
data-modal-header="{{$.locale.Tr "actions.variables.edit"}}"
data-modal-header="{{ctx.Locale.Tr "actions.variables.edit"}}"
data-modal-dialog-variable-name="{{.Name}}"
data-modal-dialog-variable-data="{{.Data}}"
>
{{svg "octicon-pencil"}}
</button>
<button class="btn interact-bg gt-p-3 link-action"
data-tooltip-content="{{$.locale.Tr "actions.variables.deletion"}}"
data-tooltip-content="{{ctx.Locale.Tr "actions.variables.deletion"}}"
data-url="{{$.Link}}/{{.ID}}/delete"
data-modal-confirm="{{$.locale.Tr "actions.variables.deletion.description"}}"
data-modal-confirm="{{ctx.Locale.Tr "actions.variables.deletion.description"}}"
>
{{svg "octicon-trash"}}
</button>
@@ -54,7 +54,7 @@
{{end}}
</div>
{{else}}
{{.locale.Tr "actions.variables.none"}}
{{ctx.Locale.Tr "actions.variables.none"}}
{{end}}
</div>
@@ -65,24 +65,24 @@
<div class="content">
{{.CsrfTokenHtml}}
<div class="field">
{{.locale.Tr "actions.variables.description"}}
{{ctx.Locale.Tr "actions.variables.description"}}
</div>
<div class="field">
<label for="dialog-variable-name">{{.locale.Tr "name"}}</label>
<label for="dialog-variable-name">{{ctx.Locale.Tr "name"}}</label>
<input autofocus required
name="name"
id="dialog-variable-name"
value="{{.name}}"
pattern="^(?!GITEA_|GITHUB_)[a-zA-Z_][a-zA-Z0-9_]*$"
placeholder="{{.locale.Tr "secrets.creation.name_placeholder"}}"
placeholder="{{ctx.Locale.Tr "secrets.creation.name_placeholder"}}"
>
</div>
<div class="field">
<label for="dialog-variable-data">{{.locale.Tr "value"}}</label>
<label for="dialog-variable-data">{{ctx.Locale.Tr "value"}}</label>
<textarea required
name="data"
id="dialog-variable-data"
placeholder="{{.locale.Tr "secrets.creation.value_placeholder"}}"
placeholder="{{ctx.Locale.Tr "secrets.creation.value_placeholder"}}"
></textarea>
</div>
</div>