Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup locale function usage #27227

Merged
merged 6 commits into from
Sep 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion templates/admin/base/search.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="ui secondary filter menu gt-ac gt-mx-0">
<form class="ui form ignore-dirty gt-f1">
<div class="ui fluid action input">
{{template "shared/searchinput" dict "locale" .locale "Value" .Keyword "AutoFocus" true}}
{{template "shared/searchinput" dict "Value" .Keyword "AutoFocus" true}}
<button class="ui primary button">{{.locale.Tr "explore.search"}}</button>
</div>
</form>
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/emails/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="ui secondary filter menu gt-ac gt-mx-0">
<form class="ui form ignore-dirty gt-f1">
<div class="ui fluid action input">
{{template "shared/searchinput" dict "locale" .locale "Value" .Keyword "AutoFocus" true}}
{{template "shared/searchinput" dict "Value" .Keyword "AutoFocus" true}}
<button class="ui primary button">{{.locale.Tr "explore.search"}}</button>
</div>
</form>
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/packages/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<div class="ui attached segment">
<form class="ui form ignore-dirty">
<div class="ui fluid action input">
{{template "shared/searchinput" dict "locale" .locale "Value" .Query "AutoFocus" true}}
{{template "shared/searchinput" dict "Value" .Query "AutoFocus" true}}
<select class="ui dropdown" name="type">
<option value="">{{.locale.Tr "packages.filter.type"}}</option>
<option value="all">{{.locale.Tr "packages.filter.type.all"}}</option>
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/repo/search.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="ui secondary filter menu gt-ac gt-mx-0">
<form class="ui form ignore-dirty gt-f1">
<div class="ui fluid action input">
{{template "shared/searchinput" dict "locale" .locale "Value" .Keyword "AutoFocus" true}}
{{template "shared/searchinput" dict "Value" .Keyword "AutoFocus" true}}
<button class="ui primary button">{{.locale.Tr "explore.search"}}</button>
</div>
</form>
Expand Down
4 changes: 2 additions & 2 deletions templates/admin/repo/unadopted.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<input type="hidden" name="action" value="adopt">
<input type="hidden" name="q" value="{{$.Keyword}}">
<input type="hidden" name="page" value="{{$.CurrentPage}}">
{{template "base/modal_actions_confirm" (dict "locale" $.locale)}}
{{template "base/modal_actions_confirm"}}
</form>
</div>
<button class="ui button red show-modal gt-p-3" data-modal="#delete-unadopted-modal-{{$dirI}}">{{svg "octicon-x"}} {{$.locale.Tr "repo.delete_preexisting_label"}}</button>
Expand All @@ -54,7 +54,7 @@
<input type="hidden" name="action" value="delete">
<input type="hidden" name="q" value="{{$.Keyword}}">
<input type="hidden" name="page" value="{{$.CurrentPage}}">
{{template "base/modal_actions_confirm" (dict "locale" $.locale "ModalButtonColors" "yellow")}}
{{template "base/modal_actions_confirm" (dict "ModalButtonColors" "yellow")}}
</form>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/user/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

<!-- Search Text -->
<div class="ui fluid action input">
{{template "shared/searchinput" dict "locale" .locale "Value" .Keyword "AutoFocus" true}}
{{template "shared/searchinput" dict "Value" .Keyword "AutoFocus" true}}
<button class="ui primary button">{{.locale.Tr "explore.search"}}</button>
</div>
</form>
Expand Down
11 changes: 4 additions & 7 deletions templates/base/modal_actions_confirm.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{{/*
Template Attributes:
* locale

Two buttons (negative, positive):
* ModalButtonTypes: "yes" (default) or "confirm"
* ModalButtonColors: "primary" (default) / "blue" / "yellow"
Expand All @@ -17,11 +14,11 @@ The ".ok.button" and ".cancel.button" selectors are also used by Fomantic Modal
{{if .ModalButtonDangerText}}
<button class="ui danger red ok button">{{.ModalButtonDangerText}}</button>
{{else}}
{{$textNegitive := .locale.Tr "modal.no"}}
{{$textPositive := .locale.Tr "modal.yes"}}
{{$textNegitive := ctx.Locale.Tr "modal.no"}}
{{$textPositive := ctx.Locale.Tr "modal.yes"}}
{{if eq .ModalButtonTypes "confirm"}}
{{$textNegitive = .locale.Tr "modal.cancel"}}
{{$textPositive = .locale.Tr "modal.confirm"}}
{{$textNegitive = ctx.Locale.Tr "modal.cancel"}}
{{$textPositive = ctx.Locale.Tr "modal.confirm"}}
{{end}}
{{if .ModalButtonCancelText}}{{$textNegitive = .ModalButtonCancelText}}{{end}}
{{if .ModalButtonOkText}}{{$textPositive = .ModalButtonOkText}}{{end}}
Expand Down
2 changes: 1 addition & 1 deletion templates/code/searchform.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<form class="ui form ignore-dirty">
<div class="ui fluid action input">
{{template "shared/searchinput" dict "locale" .locale "Value" .Keyword "AutoFocus" true "Disabled" .CodeIndexerUnavailable}}
{{template "shared/searchinput" dict "Value" .Keyword "AutoFocus" true "Disabled" .CodeIndexerUnavailable}}
<div class="ui dropdown selection {{if .CodeIndexerUnavailable}} disabled{{end}}" data-tooltip-content="{{.locale.Tr "explore.search.type.tooltip"}}">
<input name="t" type="hidden" value="{{.queryType}}"{{if .CodeIndexerUnavailable}} disabled{{end}}>{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="text">{{.locale.Tr (printf "explore.search.%s" (or .queryType "fuzzy"))}}</div>
Expand Down
16 changes: 8 additions & 8 deletions templates/devtest/fomantic-modal.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div class="header">Form dialog (layout 1)</div>
<form class="content" method="post">
<div class="ui input gt-w-100"><input name="user_input"></div>
{{template "base/modal_actions_confirm" (dict "locale" $.locale "ModalButtonTypes" "confirm")}}
{{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}}
</form>
</div>

Expand All @@ -15,7 +15,7 @@
<form method="post">
<div class="content">
<div class="ui input gt-w-100"><input name="user_input"></div>
{{template "base/modal_actions_confirm" (dict "locale" $.locale "ModalButtonTypes" "confirm")}}
{{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}}
</div>
</form>
</div>
Expand All @@ -26,7 +26,7 @@
<div class="content">
<div class="ui input gt-w-100"><input name="user_input"></div>
</div>
{{template "base/modal_actions_confirm" (dict "locale" $.locale "ModalButtonTypes" "confirm")}}
{{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}}
</form>
</div>

Expand All @@ -36,7 +36,7 @@
<div class="ui input gt-w-100"><input name="user_input"></div>
</div>
<form method="post">
{{template "base/modal_actions_confirm" (dict "locale" $.locale "ModalButtonTypes" "confirm")}}
{{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}}
</form>
</div>

Expand All @@ -45,25 +45,25 @@
<div class="content">
very long aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
</div>
{{template "base/modal_actions_confirm" (dict "locale" $.locale)}}
{{template "base/modal_actions_confirm"}}
</div>

<div class="ui g-modal-confirm modal" id="test-modal-confirm">
<div class="header">Confirm dialog</div>
<div class="content">hello, this is the modal dialog content</div>
{{template "base/modal_actions_confirm" (dict "locale" $.locale "ModalButtonTypes" "confirm")}}
{{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}}
</div>

<div class="ui g-modal-confirm modal" id="test-modal-blue">
<div class="header">Blue dialog</div>
<div class="content">hello, this is the modal dialog content</div>
{{template "base/modal_actions_confirm" (dict "locale" $.locale "ModalButtonColors" "blue")}}
{{template "base/modal_actions_confirm" (dict "ModalButtonColors" "blue")}}
</div>

<div class="ui g-modal-confirm modal" id="test-modal-yellow">
<div class="header">yellow dialog</div>
<div class="content">hello, this is the modal dialog content</div>
{{template "base/modal_actions_confirm" (dict "locale" $.locale "ModalButtonColors" "yellow")}}
{{template "base/modal_actions_confirm" (dict "ModalButtonColors" "yellow")}}
</div>

<div class="ui g-modal-confirm modal" id="test-modal-danger">
Expand Down
2 changes: 1 addition & 1 deletion templates/explore/repo_search.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<input type="hidden" name="sort" value="{{$.SortType}}">
<input type="hidden" name="language" value="{{$.Language}}">
<div class="ui fluid action input">
{{template "shared/searchinput" dict "locale" .locale "Value" .Keyword "AutoFocus" true}}
{{template "shared/searchinput" dict "Value" .Keyword "AutoFocus" true}}
{{if .PageIsExploreRepositories}}
<input type="hidden" name="only_show_relevant" value="{{.OnlyShowRelevant}}">
{{else}}
Expand Down
2 changes: 1 addition & 1 deletion templates/explore/search.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="ui secondary filter menu gt-ac gt-mx-0">
<form class="ui form ignore-dirty gt-f1">
<div class="ui fluid action input">
{{template "shared/searchinput" dict "locale" .locale "Value" .Keyword "AutoFocus" true}}
{{template "shared/searchinput" dict "Value" .Keyword "AutoFocus" true}}
<button class="ui primary button">{{.locale.Tr "explore.search"}}</button>
</div>
</form>
Expand Down
2 changes: 1 addition & 1 deletion templates/package/shared/list.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{template "base/alert" .}}
<form class="ui form ignore-dirty">
<div class="ui fluid action input">
{{template "shared/searchinput" dict "locale" .locale "Value" .Query "AutoFocus" true}}
{{template "shared/searchinput" dict "Value" .Query "AutoFocus" true}}
<select class="ui dropdown" name="type">
<option value="">{{.locale.Tr "packages.filter.type"}}</option>
<option value="all">{{.locale.Tr "packages.filter.type.all"}}</option>
Expand Down
2 changes: 1 addition & 1 deletion templates/package/shared/versionlist.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p><a href="{{.PackageDescriptor.PackageWebLink}}">{{.PackageDescriptor.Package.Name}}</a> / <strong>{{.locale.Tr "packages.versions"}}</strong></p>
<form class="ui form ignore-dirty">
<div class="ui fluid action input">
{{template "shared/searchinput" dict "locale" .locale "Value" .Query "AutoFocus" true}}
{{template "shared/searchinput" dict "Value" .Query "AutoFocus" true}}
<select class="ui dropdown" name="sort">
<option value="version_asc"{{if eq .Sort "version_asc"}} selected="selected"{{end}}>{{.locale.Tr "filter.string.asc"}}</option>
<option value="version_desc"{{if eq .Sort "version_desc"}} selected="selected"{{end}}>{{.locale.Tr "filter.string.desc"}}</option>
Expand Down
2 changes: 1 addition & 1 deletion templates/projects/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<form class="list-header-search ui form ignore-dirty">
<div class="ui small search fluid action input">
<input type="hidden" name="state" value="{{$.State}}">
{{template "shared/searchinput" dict "locale" .locale "Value" .Keyword}}
{{template "shared/searchinput" dict "Value" .Keyword}}
<button class="ui small icon button" type="submit" aria-label="{{.locale.Tr "explore.search"}}">
{{svg "octicon-search"}}
</button>
Expand Down
4 changes: 2 additions & 2 deletions templates/projects/view.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
<div class="content">
<label id="default-project-column-content"></label>
</div>
{{template "base/modal_actions_confirm" (dict "locale" ctx.Locale "ModalButtonTypes" "confirm")}}
{{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}}
</div>

<div class="ui g-modal-confirm modal" id="delete-project-column-modal-{{.ID}}">
Expand All @@ -154,7 +154,7 @@
{{ctx.Locale.Tr "repo.projects.column.deletion_desc"}}
</label>
</div>
{{template "base/modal_actions_confirm" (dict "locale" ctx.Locale "ModalButtonTypes" "confirm")}}
{{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}}
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/actions/runs_list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{{range .Runs}}
<div class="flex-item gt-ac">
<div class="flex-item-leading">
{{template "repo/actions/status" (dict "status" .Status.String "locale" $.locale)}}
{{template "repo/actions/status" (dict "status" .Status.String)}}
</div>
<div class="flex-item-main">
<a class="flex-item-title" title="{{.Title}}" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}">
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/actions/status.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{{- $className = .className -}}
{{- end -}}

<span class="gt-df gt-ac" data-tooltip-content="{{.locale.Tr (printf "actions.status.%s" .status)}}">
<span class="gt-df gt-ac" data-tooltip-content="{{ctx.Locale.Tr (printf "actions.status.%s" .status)}}">
{{if eq .status "success"}}
{{svg "octicon-check-circle-fill" $size (printf "text green %s" $className)}}
{{else if eq .status "skipped"}}
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/blame.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
{{if $.EscapeStatus.Escaped}}
<td class="lines-escape">
{{if $row.EscapeStatus.Escaped}}
<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $row "locale" $.locale}}"></button>
<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $row}}"></button>
{{end}}
</td>
{{end}}
Expand Down
4 changes: 2 additions & 2 deletions templates/repo/branch/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
<input id="new_branch_name" name="new_branch_name" required>
</div>
</div>
{{template "base/modal_actions_confirm" (dict "locale" $.locale "ModalButtonTypes" "confirm")}}
{{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}}
</form>
</div>

Expand All @@ -258,7 +258,7 @@
<input name="to" required>
</div>
</div>
{{template "base/modal_actions_confirm" (dict "locale" $.locale "ModalButtonTypes" "confirm")}}
{{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}}
</form>
</div>
{{template "base/footer" .}}
2 changes: 1 addition & 1 deletion templates/repo/commit_statuses.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{{template "repo/commit_status" .}}
<span class="ui gt-ml-3 gt-f1">{{.Context}} <span class="text grey">{{.Description}}</span></span>
{{if .TargetURL}}
<a class="gt-ml-3" href="{{.TargetURL}}" target="_blank" rel="noopener noreferrer">{{$.root.locale.Tr "repo.pulls.status_checks_details"}}</a>
<a class="gt-ml-3" href="{{.TargetURL}}" target="_blank" rel="noopener noreferrer">{{ctx.Locale.Tr "repo.pulls.status_checks_details"}}</a>
{{end}}
</div>
{{end}}
Expand Down
14 changes: 7 additions & 7 deletions templates/repo/diff/blob_excerpt.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@
</div>
</td>
<td colspan="7" class="lines-code lines-code-old ">{{$inlineDiff := $.section.GetComputedInlineDiffFor $line $.locale}}{{/*
*/}}{{template "repo/diff/section_code" dict "diff" $inlineDiff "locale" $.locale}}</td>
*/}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}</td>
{{else}}
{{$inlineDiff := $.section.GetComputedInlineDiffFor $line $.locale}}
<td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{$.FileNameHash}}L{{$line.LeftIdx}}{{end}}"></span></td>
<td class="blob-excerpt lines-escape lines-escape-old">{{if and $line.LeftIdx $inlineDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff "locale" $.locale}}"></button>{{end}}</td>
<td class="blob-excerpt lines-escape lines-escape-old">{{if and $line.LeftIdx $inlineDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"></button>{{end}}</td>
<td class="blob-excerpt lines-type-marker lines-type-marker-old">{{if $line.LeftIdx}}<span class="gt-mono" data-type-marker=""></span>{{end}}</td>
<td class="blob-excerpt lines-code lines-code-old">{{/*
*/}}{{if $line.LeftIdx}}{{template "repo/diff/section_code" dict "diff" $inlineDiff "locale" $.locale}}{{else}}{{/*
*/}}{{if $line.LeftIdx}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}{{else}}{{/*
*/}}<code class="code-inner"></code>{{/*
*/}}{{end}}{{/*
*/}}</td>
<td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{$.FileNameHash}}R{{$line.RightIdx}}{{end}}"></span></td>
<td class="blob-excerpt lines-escape lines-escape-new">{{if and $line.RightIdx $inlineDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff "locale" $.locale}}"></button>{{end}}</td>
<td class="blob-excerpt lines-escape lines-escape-new">{{if and $line.RightIdx $inlineDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"></button>{{end}}</td>
<td class="blob-excerpt lines-type-marker lines-type-marker-new">{{if $line.RightIdx}}<span class="gt-mono" data-type-marker=""></span>{{end}}</td>
<td class="blob-excerpt lines-code lines-code-new">{{/*
*/}}{{if $line.RightIdx}}{{template "repo/diff/section_code" dict "diff" $inlineDiff "locale" $.locale}}{{else}}{{/*
*/}}{{if $line.RightIdx}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}{{else}}{{/*
*/}}<code class="code-inner"></code>{{/*
*/}}{{end}}{{/*
*/}}</td>
Expand Down Expand Up @@ -72,9 +72,9 @@
<td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{$.FileNameHash}}R{{$line.RightIdx}}{{end}}"></span></td>
{{end}}
{{$inlineDiff := $.section.GetComputedInlineDiffFor $line $.locale}}
<td class="blob-excerpt lines-escape">{{if $inlineDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff "locale" $.locale}}"></button>{{end}}</td>
<td class="blob-excerpt lines-escape">{{if $inlineDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"></button>{{end}}</td>
<td class="blob-excerpt lines-type-marker"><span class="gt-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td>
<td class="blob-excerpt lines-code{{if (not $line.RightIdx)}} lines-code-old{{end}}"><code {{if $inlineDiff.EscapeStatus.Escaped}}class="code-inner has-escaped" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff "locale" $.locale}}"{{else}}class="code-inner"{{end}}>{{$inlineDiff.Content}}</code></td>
<td class="blob-excerpt lines-code{{if (not $line.RightIdx)}} lines-code-old{{end}}"><code {{if $inlineDiff.EscapeStatus.Escaped}}class="code-inner has-escaped" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"{{else}}class="code-inner"{{end}}>{{$inlineDiff.Content}}</code></td>
</tr>
{{end}}
{{end}}
1 change: 0 additions & 1 deletion templates/repo/diff/box.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@
<template id="issue-comment-editor-template">
<div class="ui comment form">
{{template "shared/combomarkdowneditor" (dict
"locale" $.locale
"MarkdownPreviewUrl" (print $.Repository.Link "/markup")
"MarkdownPreviewContext" $.RepoLink
"TextareaName" "content"
Expand Down
Loading