From 2325fe777dcb8c8bbaea84718dcfbdc298d33304 Mon Sep 17 00:00:00 2001 From: Denys Konovalov Date: Sun, 24 Sep 2023 22:31:58 +0200 Subject: [PATCH] cleanup locale function usage (#27227) --- templates/admin/base/search.tmpl | 2 +- templates/admin/emails/list.tmpl | 2 +- templates/admin/packages/list.tmpl | 2 +- templates/admin/repo/search.tmpl | 2 +- templates/admin/repo/unadopted.tmpl | 4 +-- templates/admin/user/list.tmpl | 2 +- templates/base/modal_actions_confirm.tmpl | 11 +++---- templates/code/searchform.tmpl | 2 +- templates/devtest/fomantic-modal.tmpl | 16 ++++----- templates/explore/repo_search.tmpl | 2 +- templates/explore/search.tmpl | 2 +- templates/package/shared/list.tmpl | 2 +- templates/package/shared/versionlist.tmpl | 2 +- templates/projects/list.tmpl | 2 +- templates/projects/view.tmpl | 4 +-- templates/repo/actions/runs_list.tmpl | 2 +- templates/repo/actions/status.tmpl | 2 +- templates/repo/blame.tmpl | 2 +- templates/repo/branch/list.tmpl | 4 +-- templates/repo/commit_statuses.tmpl | 2 +- templates/repo/diff/blob_excerpt.tmpl | 14 ++++---- templates/repo/diff/box.tmpl | 1 - templates/repo/diff/comment_form.tmpl | 13 ++++---- templates/repo/diff/comments.tmpl | 18 +++++----- templates/repo/diff/escape_title.tmpl | 4 +-- templates/repo/diff/new_review.tmpl | 1 - templates/repo/diff/section_split.tmpl | 28 ++++++++-------- templates/repo/diff/section_unified.tmpl | 8 ++--- templates/repo/issue/comment_tab.tmpl | 1 - templates/repo/issue/fields/textarea.tmpl | 1 - templates/repo/issue/milestones.tmpl | 2 +- templates/repo/issue/search.tmpl | 2 +- templates/repo/issue/view_content.tmpl | 1 - .../view_content/comments_delete_time.tmpl | 2 +- templates/repo/issue/view_content/pull.tmpl | 2 +- .../view_content/pull_merge_instruction.tmpl | 20 +++++------ templates/repo/release/new.tmpl | 1 - templates/repo/settings/lfs.tmpl | 2 +- templates/repo/shabox_badge.tmpl | 6 ++-- templates/repo/unicode_escape_prompt.tmpl | 10 +++--- templates/repo/wiki/new.tmpl | 1 - templates/shared/actions/runner_list.tmpl | 2 +- templates/shared/combomarkdowneditor.tmpl | 33 +++++++++---------- templates/shared/searchinput.tmpl | 2 +- templates/shared/secrets/add_list.tmpl | 2 +- templates/shared/variables/variable_list.tmpl | 2 +- templates/user/dashboard/issues.tmpl | 2 +- templates/user/dashboard/milestones.tmpl | 2 +- templates/user/settings/applications.tmpl | 2 +- 49 files changed, 121 insertions(+), 133 deletions(-) diff --git a/templates/admin/base/search.tmpl b/templates/admin/base/search.tmpl index 865cc8830..22f839bf0 100644 --- a/templates/admin/base/search.tmpl +++ b/templates/admin/base/search.tmpl @@ -1,7 +1,7 @@ @@ -36,7 +36,7 @@
- {{template "base/modal_actions_confirm" (dict "locale" $.locale "ModalButtonTypes" "confirm")}} + {{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}}
@@ -45,25 +45,25 @@
very long aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
- {{template "base/modal_actions_confirm" (dict "locale" $.locale)}} + {{template "base/modal_actions_confirm"}} @@ -258,7 +258,7 @@ - {{template "base/modal_actions_confirm" (dict "locale" $.locale "ModalButtonTypes" "confirm")}} + {{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}} {{template "base/footer" .}} diff --git a/templates/repo/commit_statuses.tmpl b/templates/repo/commit_statuses.tmpl index 20a59bf0d..0006dcb4a 100644 --- a/templates/repo/commit_statuses.tmpl +++ b/templates/repo/commit_statuses.tmpl @@ -14,7 +14,7 @@ {{template "repo/commit_status" .}} {{.Context}} {{.Description}} {{if .TargetURL}} - {{$.root.locale.Tr "repo.pulls.status_checks_details"}} + {{ctx.Locale.Tr "repo.pulls.status_checks_details"}} {{end}} {{end}} diff --git a/templates/repo/diff/blob_excerpt.tmpl b/templates/repo/diff/blob_excerpt.tmpl index 23149f611..feb2aa573 100644 --- a/templates/repo/diff/blob_excerpt.tmpl +++ b/templates/repo/diff/blob_excerpt.tmpl @@ -22,22 +22,22 @@ {{$inlineDiff := $.section.GetComputedInlineDiffFor $line $.locale}}{{/* - */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff "locale" $.locale}} + */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}} {{else}} {{$inlineDiff := $.section.GetComputedInlineDiffFor $line $.locale}} - {{if and $line.LeftIdx $inlineDiff.EscapeStatus.Escaped}}{{end}} + {{if and $line.LeftIdx $inlineDiff.EscapeStatus.Escaped}}{{end}} {{if $line.LeftIdx}}{{end}} {{/* - */}}{{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}}{{/* */}}{{/* */}}{{end}}{{/* */}} - {{if and $line.RightIdx $inlineDiff.EscapeStatus.Escaped}}{{end}} + {{if and $line.RightIdx $inlineDiff.EscapeStatus.Escaped}}{{end}} {{if $line.RightIdx}}{{end}} {{/* - */}}{{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}}{{/* */}}{{/* */}}{{end}}{{/* */}} @@ -72,9 +72,9 @@ {{end}} {{$inlineDiff := $.section.GetComputedInlineDiffFor $line $.locale}} - {{if $inlineDiff.EscapeStatus.Escaped}}{{end}} + {{if $inlineDiff.EscapeStatus.Escaped}}{{end}} - {{$inlineDiff.Content}} + {{$inlineDiff.Content}} {{end}} {{end}} diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 2e1461226..ff3fc7aef 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -225,7 +225,6 @@