fix(i18n): reuse string for repository access, fix capitalization consistency (#11683)

Followup to https://codeberg.org/forgejo/forgejo/pulls/11604

These strings are used in similar contexts and can be reused. Fixed capitalization consistency (`specific_repo_access` inherited capitalization from `repo_and_org_access` which was nearby in the UI)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11683
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Co-committed-by: 0ko <0ko@noreply.codeberg.org>
This commit is contained in:
0ko 2026-03-15 15:09:43 +01:00 committed by Mathieu Fenniak
parent 1d99ce0242
commit a480324595
5 changed files with 11 additions and 9 deletions

View file

@ -925,7 +925,7 @@ regenerate_token = Regenerate
access_token_regeneration = Regenerate access token
access_token_regeneration_desc = Regenerating a token will revoke access to your account for applications using it. This cannot be undone. Continue?
regenerate_token_success = The token has been regenerated. Applications that use it no longer have access to your account and must be updated with the new token.
repo_and_org_access = Repository and Organization Access
repo_and_org_access = Repository and organization access
permissions_public_only = Public only
permissions_access_all = All (public, private, and limited)
select_permissions = Select permissions
@ -2824,7 +2824,6 @@ team_name = Team name
team_desc = Description
team_name_helper = Team names should be short and memorable.
team_desc_helper = Describe the purpose or role of the team.
team_access_desc = Repository access
team_permission_desc = Permission
team_unit_desc = Allow access to repository sections
team_unit_disabled = (Disabled)

View file

@ -191,7 +191,7 @@
"settings.twofa_reenroll": "Re-enroll two-factor authentication",
"settings.twofa_reenroll.description": "Re-enroll your two-factor authentication",
"settings.must_enable_2fa": "This Forgejo instance requires users to enable two-factor authentication before they can access their accounts.",
"settings.specific_repo_access": "Repository Access",
"settings.specific_repo_access": "Repository access",
"error.must_enable_2fa": "This Forgejo instance requires users to enable two-factor authentication before they can access their accounts. Enable it at: %s",
"avatar.constraints_hint": "Custom avatar may not exceed %[1]s in size or be larger than %[2]dx%[3]d pixels",
"user.ghost.tooltip": "This user has been deleted, or cannot be matched.",

View file

@ -25,7 +25,7 @@
</div>
{{if not (eq .Team.LowerName "owners")}}
<fieldset>
<legend>{{ctx.Locale.Tr "org.team_access_desc"}}</legend>
<legend>{{ctx.Locale.Tr "settings.specific_repo_access"}}</legend>
<label>
<input type="radio" name="repo_access" value="specific" {{if not .Team.IncludesAllRepositories}}checked{{end}}>
{{ctx.Locale.Tr "org.teams.specific_repositories"}}

View file

@ -30,7 +30,7 @@
</div>
{{else}}
<div class="item">
<h3>{{ctx.Locale.Tr "org.team_access_desc"}}</h3>
<h3>{{ctx.Locale.Tr "settings.specific_repo_access"}}</h3>
<ul>
{{if .Team.IncludesAllRepositories}}
<li>{{ctx.Locale.Tr "org.teams.all_repositories"}}</li>

View file

@ -284,14 +284,17 @@ func TestAccessTokenRegenerate(t *testing.T) {
func TestAccessTokenResourceRepos(t *testing.T) {
defer tests.PrepareTestEnv(t)()
locale := translation.NewLocale("en-US")
repoAccess := locale.TrString("settings.specific_repo_access") + ":"
session := loginUser(t, "user2")
// Before creating a repo-specific access token, we shouldn't have the "Repository Access:" list in the personal
// Before creating a repo-specific access token, we shouldn't have the "Repository access:" list in the personal
// access token page:
req := NewRequest(t, "GET", "/user/settings/applications")
resp := session.MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
htmlDoc.AssertSelection(t, htmlDoc.FindByText(".user-setting-content p", "Repository Access:"), false)
htmlDoc.AssertSelection(t, htmlDoc.FindByText(".user-setting-content p", repoAccess), false)
// Then we create a repo-specific access token. We give it access to two repos, user2/repo2, but also user30/empty,
// a private repo owned by someone else... We'll pretend user2 used to be a collaborator on this repo and
@ -301,11 +304,11 @@ func TestAccessTokenResourceRepos(t *testing.T) {
[]int64{2, 52},
)
// Now we have "Repository Access:"...
// Now we have "Repository access:"...
req = NewRequest(t, "GET", "/user/settings/applications")
resp = session.MakeRequest(t, req, http.StatusOK)
htmlDoc = NewHTMLParser(t, resp.Body)
htmlDoc.AssertSelection(t, htmlDoc.FindByText(".user-setting-content p", "Repository Access:"), true)
htmlDoc.AssertSelection(t, htmlDoc.FindByText(".user-setting-content p", repoAccess), true)
htmlDoc.AssertSelection(t, htmlDoc.FindByText(".user-setting-content a", "user2/repo2"), true) // link to repo
htmlDoc.AssertSelection(t, htmlDoc.FindByText(".user-setting-content a", "user30/empty"), false) // missing - user2 has no visibility
}