diff options
Diffstat (limited to 'routers/web')
-rw-r--r-- | routers/web/repo/migrate.go | 7 | ||||
-rw-r--r-- | routers/web/repo/repo.go | 7 | ||||
-rw-r--r-- | routers/web/repo/setting.go | 7 |
3 files changed, 4 insertions, 17 deletions
diff --git a/routers/web/repo/migrate.go b/routers/web/repo/migrate.go index 1bbb192b24..23e5b21b48 100644 --- a/routers/web/repo/migrate.go +++ b/routers/web/repo/migrate.go @@ -81,13 +81,8 @@ func handleMigrateError(ctx *context.Context, owner *user_model.User, err error, case migrations.IsTwoFactorAuthError(err): ctx.RenderWithErr(ctx.Tr("form.2fa_auth_required"), tpl, form) case repo_model.IsErrReachLimitOfRepo(err): - var msg string maxCreationLimit := owner.MaxCreationLimit() - if maxCreationLimit == 1 { - msg = ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit) - } else { - msg = ctx.Tr("repo.form.reach_limit_of_creation_n", maxCreationLimit) - } + msg := ctx.TrN(maxCreationLimit, "repo.form.reach_limit_of_creation_1", "repo.form.reach_limit_of_creation_n", maxCreationLimit) ctx.RenderWithErr(msg, tpl, form) case repo_model.IsErrRepoAlreadyExist(err): ctx.Data["Err_RepoName"] = true diff --git a/routers/web/repo/repo.go b/routers/web/repo/repo.go index 8e0998225a..6bd16ff2b8 100644 --- a/routers/web/repo/repo.go +++ b/routers/web/repo/repo.go @@ -162,13 +162,8 @@ func Create(ctx *context.Context) { func handleCreateError(ctx *context.Context, owner *user_model.User, err error, name string, tpl base.TplName, form interface{}) { switch { case repo_model.IsErrReachLimitOfRepo(err): - var msg string maxCreationLimit := owner.MaxCreationLimit() - if maxCreationLimit == 1 { - msg = ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit) - } else { - msg = ctx.Tr("repo.form.reach_limit_of_creation_n", maxCreationLimit) - } + msg := ctx.TrN(maxCreationLimit, "repo.form.reach_limit_of_creation_1", "repo.form.reach_limit_of_creation_n", maxCreationLimit) ctx.RenderWithErr(msg, tpl, form) case repo_model.IsErrRepoAlreadyExist(err): ctx.Data["Err_RepoName"] = true diff --git a/routers/web/repo/setting.go b/routers/web/repo/setting.go index 57a195ee62..7ff83cc3d7 100644 --- a/routers/web/repo/setting.go +++ b/routers/web/repo/setting.go @@ -610,11 +610,8 @@ func SettingsPost(ctx *context.Context) { if !ctx.Repo.Owner.CanCreateRepo() { maxCreationLimit := ctx.Repo.Owner.MaxCreationLimit() - if maxCreationLimit == 1 { - ctx.Flash.Error(ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit)) - } else { - ctx.Flash.Error(ctx.Tr("repo.form.reach_limit_of_creation_n", maxCreationLimit)) - } + msg := ctx.TrN(maxCreationLimit, "repo.form.reach_limit_of_creation_1", "repo.form.reach_limit_of_creation_n", maxCreationLimit) + ctx.Flash.Error(msg) ctx.Redirect(repo.Link() + "/settings") return } |