Skip to content

Commit 521945a

Browse files
bugreport0lafriks
authored andcommitted
Fix missing translations when updating username. (#3564)
* Fix missing translations when updating username. * Fix reserved username translated string test. * Fix 'username reserved' string test a bit more.
1 parent fc265b0 commit 521945a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

integrations/user_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func TestRenameReservedUsername(t *testing.T) {
9292
htmlDoc := NewHTMLParser(t, resp.Body)
9393
assert.Contains(t,
9494
htmlDoc.doc.Find(".ui.negative.message").Text(),
95-
i18n.Tr("en", "user.newName_reserved"),
95+
i18n.Tr("en", "user.form.name_reserved", reservedUsername),
9696
)
9797

9898
models.AssertNotExistsBean(t, &models.User{Name: reservedUsername})

routers/user/setting.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,16 @@ func handleUsernameChange(ctx *context.Context, newName string) {
6161
if err := models.ChangeUserName(ctx.User, newName); err != nil {
6262
switch {
6363
case models.IsErrUserAlreadyExist(err):
64-
ctx.Flash.Error(ctx.Tr("newName_been_taken"))
64+
ctx.Flash.Error(ctx.Tr("form.username_been_taken"))
6565
ctx.Redirect(setting.AppSubURL + "/user/settings")
6666
case models.IsErrEmailAlreadyUsed(err):
6767
ctx.Flash.Error(ctx.Tr("form.email_been_used"))
6868
ctx.Redirect(setting.AppSubURL + "/user/settings")
6969
case models.IsErrNameReserved(err):
70-
ctx.Flash.Error(ctx.Tr("user.newName_reserved"))
70+
ctx.Flash.Error(ctx.Tr("user.form.name_reserved", newName))
7171
ctx.Redirect(setting.AppSubURL + "/user/settings")
7272
case models.IsErrNamePatternNotAllowed(err):
73-
ctx.Flash.Error(ctx.Tr("user.newName_pattern_not_allowed"))
73+
ctx.Flash.Error(ctx.Tr("user.form.name_pattern_not_allowed", newName))
7474
ctx.Redirect(setting.AppSubURL + "/user/settings")
7575
default:
7676
ctx.ServerError("ChangeUserName", err)

0 commit comments

Comments
 (0)