Skip to content

Commit 141a470

Browse files
Gustedlunny
authored and
Stelios Malathouras
committed
Use correct translation key (go-gitea#18135)
- Resolves go-gitea#18122 Co-authored-by: Lunny Xiao <[email protected]>
1 parent e41fcbf commit 141a470

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

routers/web/repo/migrate.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,14 @@ func handleMigrateError(ctx *context.Context, owner *user_model.User, err error,
8181
case migrations.IsTwoFactorAuthError(err):
8282
ctx.RenderWithErr(ctx.Tr("form.2fa_auth_required"), tpl, form)
8383
case repo_model.IsErrReachLimitOfRepo(err):
84-
ctx.RenderWithErr(ctx.Tr("repo.form.reach_limit_of_creation", owner.MaxCreationLimit()), tpl, form)
84+
var msg string
85+
maxCreationLimit := ctx.User.MaxCreationLimit()
86+
if maxCreationLimit == 1 {
87+
msg = ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit)
88+
} else {
89+
msg = ctx.Tr("repo.form.reach_limit_of_creation_n", maxCreationLimit)
90+
}
91+
ctx.RenderWithErr(msg, tpl, form)
8592
case repo_model.IsErrRepoAlreadyExist(err):
8693
ctx.Data["Err_RepoName"] = true
8794
ctx.RenderWithErr(ctx.Tr("form.repo_name_been_taken"), tpl, form)

routers/web/repo/repo.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,14 @@ func Create(ctx *context.Context) {
162162
func handleCreateError(ctx *context.Context, owner *user_model.User, err error, name string, tpl base.TplName, form interface{}) {
163163
switch {
164164
case repo_model.IsErrReachLimitOfRepo(err):
165-
ctx.RenderWithErr(ctx.Tr("repo.form.reach_limit_of_creation", owner.MaxCreationLimit()), tpl, form)
165+
var msg string
166+
maxCreationLimit := ctx.User.MaxCreationLimit()
167+
if maxCreationLimit == 1 {
168+
msg = ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit)
169+
} else {
170+
msg = ctx.Tr("repo.form.reach_limit_of_creation_n", maxCreationLimit)
171+
}
172+
ctx.RenderWithErr(msg, tpl, form)
166173
case repo_model.IsErrRepoAlreadyExist(err):
167174
ctx.Data["Err_RepoName"] = true
168175
ctx.RenderWithErr(ctx.Tr("form.repo_name_been_taken"), tpl, form)

routers/web/repo/setting.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,12 @@ func SettingsPost(ctx *context.Context) {
609609
}
610610

611611
if !ctx.Repo.Owner.CanCreateRepo() {
612-
ctx.Flash.Error(ctx.Tr("repo.form.reach_limit_of_creation", ctx.User.MaxCreationLimit()))
612+
maxCreationLimit := ctx.User.MaxCreationLimit()
613+
if maxCreationLimit == 1 {
614+
ctx.Flash.Error(ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit))
615+
} else {
616+
ctx.Flash.Error(ctx.Tr("repo.form.reach_limit_of_creation_n", maxCreationLimit))
617+
}
613618
ctx.Redirect(repo.Link() + "/settings")
614619
return
615620
}

0 commit comments

Comments
 (0)