From a7d81a893001e061ff6841225a673e842dbb162b Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Sat, 29 Apr 2023 15:28:52 +0000 Subject: [PATCH 1/2] Localize `N/A` I saw this string hardcoded in a few places. I'm not sure how to call this key, hopefully `short_not_available` is good enough. Signed-off-by: Yarden Shoham --- options/locale/locale_en-US.ini | 1 + templates/admin/cron.tmpl | 2 +- templates/repo/pulls/tab_menu.tmpl | 4 ++-- templates/repo/settings/protected_branch.tmpl | 2 +- templates/repo/settings/webhook/history.tmpl | 6 +++--- web_src/js/features/repo-settings.js | 1 + 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 32d9bebc8b1a..0c562ca56c25 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -23,6 +23,7 @@ enable_javascript = This website requires JavaScript. toc = Table of Contents licenses = Licenses return_to_gitea = Return to Gitea +short_not_available = N/A username = Username email = Email Address diff --git a/templates/admin/cron.tmpl b/templates/admin/cron.tmpl index 6ab37ca35484..baba6687b31d 100644 --- a/templates/admin/cron.tmpl +++ b/templates/admin/cron.tmpl @@ -22,7 +22,7 @@ {{$.locale.Tr (printf "admin.dashboard.%s" .Name)}} {{.Spec}} {{DateTime "full" .Next}} - {{if gt .Prev.Year 1}}{{DateTime "full" .Prev}}{{else}}N/A{{end}} + {{if gt .Prev.Year 1}}{{DateTime "full" .Prev}}{{else}}{{$.locale.Tr "short_not_available"}}{{end}} {{.ExecTimes}} {{if eq .Status ""}}—{{else if eq .Status "finished"}}{{svg "octicon-check" 16}}{{else}}{{svg "octicon-x" 16}}{{end}} diff --git a/templates/repo/pulls/tab_menu.tmpl b/templates/repo/pulls/tab_menu.tmpl index 5e4390937c5f..0aae07e00821 100644 --- a/templates/repo/pulls/tab_menu.tmpl +++ b/templates/repo/pulls/tab_menu.tmpl @@ -7,11 +7,11 @@ {{svg "octicon-git-commit"}} {{$.locale.Tr "repo.pulls.tab_commits"}} - {{if .NumCommits}}{{.NumCommits}}{{else}}N/A{{end}} + {{if .NumCommits}}{{.NumCommits}}{{else}}{{$.locale.Tr "short_not_available"}}{{end}} {{svg "octicon-diff"}} {{$.locale.Tr "repo.pulls.tab_files"}} - {{if .NumFiles}}{{.NumFiles}}{{else}}N/A{{end}} + {{if .NumFiles}}{{.NumFiles}}{{else}}{{$.locale.Tr "short_not_available"}}{{end}} diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl index 2102dac64102..3f6472653cdf 100644 --- a/templates/repo/settings/protected_branch.tmpl +++ b/templates/repo/settings/protected_branch.tmpl @@ -174,7 +174,7 @@ {{else}} - N/A + {{$.locale.Tr "short_not_available"}} {{end}} diff --git a/templates/repo/settings/webhook/history.tmpl b/templates/repo/settings/webhook/history.tmpl index e573d221d14b..50759e1b90c6 100644 --- a/templates/repo/settings/webhook/history.tmpl +++ b/templates/repo/settings/webhook/history.tmpl @@ -37,7 +37,7 @@ {{.ResponseInfo.Status}} {{end}} {{else}} - N/A + {{$.locale.Tr "short_not_available"}} {{end}} {{if or $.Permission.IsAdmin $.IsOrganizationOwner $.PageIsAdmin $.PageIsUserSettings}} @@ -59,7 +59,7 @@
{{$.locale.Tr "repo.settings.webhook.payload"}}
{{.PayloadContent}}
{{else}} - N/A + {{$.locale.Tr "short_not_available"}} {{end}}
@@ -70,7 +70,7 @@
{{$.locale.Tr "repo.settings.webhook.body"}}
{{.ResponseInfo.Body}}
{{else}} - N/A + {{$.locale.Tr "short_not_available"}} {{end}}
diff --git a/web_src/js/features/repo-settings.js b/web_src/js/features/repo-settings.js index 9f094cd2d162..8b4f50c040fe 100644 --- a/web_src/js/features/repo-settings.js +++ b/web_src/js/features/repo-settings.js @@ -32,6 +32,7 @@ export function initRepoSettingsCollaboration() { if ($item) { $dropdown.dropdown('set selected', $dropdown.attr('data-last-value')); } else { + // TODO: should use the localized key "short_not_available" $text.text('(N/A)'); // prevent from misleading users when the access mode is undefined } }, 0); From 2d55aff767ca344e25f4a11cf6c22de47919d014 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Sat, 29 Apr 2023 16:43:15 +0000 Subject: [PATCH 2/2] abbr Co-authored-by: wxiaoguang --- options/locale/locale_en-US.ini | 2 +- templates/admin/cron.tmpl | 2 +- templates/repo/pulls/tab_menu.tmpl | 4 ++-- templates/repo/settings/protected_branch.tmpl | 2 +- templates/repo/settings/webhook/history.tmpl | 6 +++--- web_src/js/features/repo-settings.js | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 0c562ca56c25..2ae800c21fbc 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -23,7 +23,7 @@ enable_javascript = This website requires JavaScript. toc = Table of Contents licenses = Licenses return_to_gitea = Return to Gitea -short_not_available = N/A +abbr_not_available = N/A username = Username email = Email Address diff --git a/templates/admin/cron.tmpl b/templates/admin/cron.tmpl index baba6687b31d..6e812632e861 100644 --- a/templates/admin/cron.tmpl +++ b/templates/admin/cron.tmpl @@ -22,7 +22,7 @@ {{$.locale.Tr (printf "admin.dashboard.%s" .Name)}} {{.Spec}} {{DateTime "full" .Next}} - {{if gt .Prev.Year 1}}{{DateTime "full" .Prev}}{{else}}{{$.locale.Tr "short_not_available"}}{{end}} + {{if gt .Prev.Year 1}}{{DateTime "full" .Prev}}{{else}}{{$.locale.Tr "abbr_not_available"}}{{end}} {{.ExecTimes}} {{if eq .Status ""}}—{{else if eq .Status "finished"}}{{svg "octicon-check" 16}}{{else}}{{svg "octicon-x" 16}}{{end}} diff --git a/templates/repo/pulls/tab_menu.tmpl b/templates/repo/pulls/tab_menu.tmpl index 0aae07e00821..9b5d48e7a91b 100644 --- a/templates/repo/pulls/tab_menu.tmpl +++ b/templates/repo/pulls/tab_menu.tmpl @@ -7,11 +7,11 @@ {{svg "octicon-git-commit"}} {{$.locale.Tr "repo.pulls.tab_commits"}} - {{if .NumCommits}}{{.NumCommits}}{{else}}{{$.locale.Tr "short_not_available"}}{{end}} + {{if .NumCommits}}{{.NumCommits}}{{else}}{{$.locale.Tr "abbr_not_available"}}{{end}} {{svg "octicon-diff"}} {{$.locale.Tr "repo.pulls.tab_files"}} - {{if .NumFiles}}{{.NumFiles}}{{else}}{{$.locale.Tr "short_not_available"}}{{end}} + {{if .NumFiles}}{{.NumFiles}}{{else}}{{$.locale.Tr "abbr_not_available"}}{{end}} diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl index 3f6472653cdf..39d85b8847af 100644 --- a/templates/repo/settings/protected_branch.tmpl +++ b/templates/repo/settings/protected_branch.tmpl @@ -174,7 +174,7 @@ {{else}} - {{$.locale.Tr "short_not_available"}} + {{$.locale.Tr "abbr_not_available"}} {{end}} diff --git a/templates/repo/settings/webhook/history.tmpl b/templates/repo/settings/webhook/history.tmpl index 50759e1b90c6..cfde83d5aba7 100644 --- a/templates/repo/settings/webhook/history.tmpl +++ b/templates/repo/settings/webhook/history.tmpl @@ -37,7 +37,7 @@ {{.ResponseInfo.Status}} {{end}} {{else}} - {{$.locale.Tr "short_not_available"}} + {{$.locale.Tr "abbr_not_available"}} {{end}} {{if or $.Permission.IsAdmin $.IsOrganizationOwner $.PageIsAdmin $.PageIsUserSettings}} @@ -59,7 +59,7 @@
{{$.locale.Tr "repo.settings.webhook.payload"}}
{{.PayloadContent}}
{{else}} - {{$.locale.Tr "short_not_available"}} + {{$.locale.Tr "abbr_not_available"}} {{end}}
@@ -70,7 +70,7 @@
{{$.locale.Tr "repo.settings.webhook.body"}}
{{.ResponseInfo.Body}}
{{else}} - {{$.locale.Tr "short_not_available"}} + {{$.locale.Tr "abbr_not_available"}} {{end}}
diff --git a/web_src/js/features/repo-settings.js b/web_src/js/features/repo-settings.js index 8b4f50c040fe..67a71c4fdd0f 100644 --- a/web_src/js/features/repo-settings.js +++ b/web_src/js/features/repo-settings.js @@ -32,7 +32,7 @@ export function initRepoSettingsCollaboration() { if ($item) { $dropdown.dropdown('set selected', $dropdown.attr('data-last-value')); } else { - // TODO: should use the localized key "short_not_available" + // TODO: should use the localized key "abbr_not_available" $text.text('(N/A)'); // prevent from misleading users when the access mode is undefined } }, 0);