From bd9366e7fc834d42fd60dbe5391c268f65452db7 Mon Sep 17 00:00:00 2001 From: Gusted Date: Wed, 2 Apr 2025 14:50:02 +0000 Subject: [PATCH] fix(i18n): fix several usages of i18n (#7422) - Add new translations, if an existing one couldn't be used. - Use existing translations, if one existed and fit the purpose. - Spotted by the lint-locale-usage tooling by @fogti. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7422 Reviewed-by: 0ko <0ko@noreply.codeberg.org> Co-authored-by: Gusted Co-committed-by: Gusted --- options/locale/locale_en-US.ini | 2 +- options/locale_next/locale_en-US.json | 5 ++++- routers/web/repo/editor.go | 2 +- templates/admin/auth/list.tmpl | 2 +- templates/admin/emails/list.tmpl | 2 +- templates/admin/notice.tmpl | 2 +- templates/admin/org/list.tmpl | 2 +- templates/admin/packages/list.tmpl | 2 +- templates/admin/repo/list.tmpl | 2 +- templates/admin/user/list.tmpl | 2 +- templates/repo/settings/lfs_file.tmpl | 2 +- templates/user/auth/finalize_openid.tmpl | 2 +- 12 files changed, 15 insertions(+), 12 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index ea7191b906..d97f90ec9c 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1436,7 +1436,7 @@ editor.file_is_a_symlink = `"%s" is a symbolic link. Symbolic links cannot be ed editor.filename_is_a_directory = Filename "%s" is already used as a directory name in this repository. editor.file_editing_no_longer_exists = The file being edited, "%s", no longer exists in this repository. editor.file_deleting_no_longer_exists = The file being deleted, "%s", no longer exists in this repository. -editor.file_changed_while_editing = The file contents have changed since you started editing. Click here to see them or Commit changes again to overwrite them. +editor.file_changed_while_editing = The file contents have changed since you opened the file. Click here to see them or Commit changes again to overwrite them. editor.file_already_exists = A file named "%s" already exists in this repository. editor.commit_id_not_matching = The file was changed while you were editing it. Commit to a new branch and then merge. editor.push_out_of_date = The push appears to be out of date. diff --git a/options/locale_next/locale_en-US.json b/options/locale_next/locale_en-US.json index def49e1a58..7f9b81a77b 100644 --- a/options/locale_next/locale_en-US.json +++ b/options/locale_next/locale_en-US.json @@ -18,5 +18,8 @@ "themes.names.forgejo-light": "Forgejo light", "themes.names.forgejo-dark": "Forgejo dark", "error.not_found.title": "Page not found", - "alert.asset_load_failed": "Failed to load asset files from {path}. Please make sure the asset files can be accessed." + "alert.asset_load_failed": "Failed to load asset files from {path}. Please make sure the asset files can be accessed.", + "settings.adopt": "Adopt", + "install.invalid_lfs_path": "Unable to create the LFS root at the specified path: %[1]s", + "install.lfs_jwt_secret_failed": "Unable to generate a LFS JWT secret: %[1]s" } \ No newline at end of file diff --git a/routers/web/repo/editor.go b/routers/web/repo/editor.go index 77f71fd2b1..5114cc9c05 100644 --- a/routers/web/repo/editor.go +++ b/routers/web/repo/editor.go @@ -585,7 +585,7 @@ func DeleteFilePost(ctx *context.Context) { ctx.Error(http.StatusInternalServerError, err.Error()) } } else if models.IsErrCommitIDDoesNotMatch(err) || git.IsErrPushOutOfDate(err) { - ctx.RenderWithErr(ctx.Tr("repo.editor.file_changed_while_deleting", ctx.Repo.RepoLink+"/compare/"+util.PathEscapeSegments(form.LastCommit)+"..."+util.PathEscapeSegments(ctx.Repo.CommitID)), tplDeleteFile, &form) + ctx.RenderWithErr(ctx.Tr("repo.editor.file_changed_while_editing", ctx.Repo.RepoLink+"/compare/"+util.PathEscapeSegments(form.LastCommit)+"..."+util.PathEscapeSegments(ctx.Repo.CommitID)), tplDeleteFile, &form) } else if git.IsErrPushRejected(err) { errPushRej := err.(*git.ErrPushRejected) if len(errPushRej.Message) == 0 { diff --git a/templates/admin/auth/list.tmpl b/templates/admin/auth/list.tmpl index 9c283fe3d8..0c7138bd68 100644 --- a/templates/admin/auth/list.tmpl +++ b/templates/admin/auth/list.tmpl @@ -31,7 +31,7 @@ {{svg "octicon-pencil"}} {{else}} - {{ctx.Locale.Tr "no_results_found"}} + {{ctx.Locale.Tr "repo.pulls.no_results"}} {{end}} diff --git a/templates/admin/emails/list.tmpl b/templates/admin/emails/list.tmpl index 8796794aee..5c30df87af 100644 --- a/templates/admin/emails/list.tmpl +++ b/templates/admin/emails/list.tmpl @@ -67,7 +67,7 @@ {{else}} - {{ctx.Locale.Tr "no_results_found"}} + {{ctx.Locale.Tr "repo.pulls.no_results"}} {{end}} diff --git a/templates/admin/notice.tmpl b/templates/admin/notice.tmpl index 4f8783dd42..08f0a4f204 100644 --- a/templates/admin/notice.tmpl +++ b/templates/admin/notice.tmpl @@ -25,7 +25,7 @@ {{svg "octicon-note" 16}} {{else}} - {{ctx.Locale.Tr "no_results_found"}} + {{ctx.Locale.Tr "repo.pulls.no_results"}} {{end}} {{if .Notices}} diff --git a/templates/admin/org/list.tmpl b/templates/admin/org/list.tmpl index b719d259e0..8c9c198897 100644 --- a/templates/admin/org/list.tmpl +++ b/templates/admin/org/list.tmpl @@ -67,7 +67,7 @@ {{svg "octicon-pencil"}} {{else}} - {{ctx.Locale.Tr "no_results_found"}} + {{ctx.Locale.Tr "repo.pulls.no_results"}} {{end}} diff --git a/templates/admin/packages/list.tmpl b/templates/admin/packages/list.tmpl index f22600a449..5f9965e34c 100644 --- a/templates/admin/packages/list.tmpl +++ b/templates/admin/packages/list.tmpl @@ -75,7 +75,7 @@ {{svg "octicon-trash"}} {{else}} - {{ctx.Locale.Tr "no_results_found"}} + {{ctx.Locale.Tr "repo.pulls.no_results"}} {{end}} diff --git a/templates/admin/repo/list.tmpl b/templates/admin/repo/list.tmpl index 0422705ea9..7a75ceded7 100644 --- a/templates/admin/repo/list.tmpl +++ b/templates/admin/repo/list.tmpl @@ -87,7 +87,7 @@ {{svg "octicon-trash"}} {{else}} - {{ctx.Locale.Tr "no_results_found"}} + {{ctx.Locale.Tr "repo.pulls.no_results"}} {{end}} diff --git a/templates/admin/user/list.tmpl b/templates/admin/user/list.tmpl index f4609edbbf..368e113d24 100644 --- a/templates/admin/user/list.tmpl +++ b/templates/admin/user/list.tmpl @@ -110,7 +110,7 @@ {{else}} - {{ctx.Locale.Tr "no_results_found"}} + {{ctx.Locale.Tr "repo.pulls.no_results"}} {{end}} diff --git a/templates/repo/settings/lfs_file.tmpl b/templates/repo/settings/lfs_file.tmpl index 941d09f3e6..3b6b763536 100644 --- a/templates/repo/settings/lfs_file.tmpl +++ b/templates/repo/settings/lfs_file.tmpl @@ -31,7 +31,7 @@ {{ctx.Locale.Tr "repo.audio_not_supported_in_browser"}} {{else if .IsPDFFile}} -
+
{{else}} {{ctx.Locale.Tr "repo.file_view_raw"}} {{end}} diff --git a/templates/user/auth/finalize_openid.tmpl b/templates/user/auth/finalize_openid.tmpl index f84f860b02..372471368f 100644 --- a/templates/user/auth/finalize_openid.tmpl +++ b/templates/user/auth/finalize_openid.tmpl @@ -30,7 +30,7 @@ {{if .ShowRegistrationButton}}