From 748240ce3bd3b4d27884179ef4d97e5ec427be3f Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Wed, 5 Jun 2024 16:20:48 +1000 Subject: [PATCH] FIX: Pluralisation for short password count (#27342) Followup 0434112aa71fc091583d8356a84fbf958f7228fb, when I introduced the pluralisation for the password.too_short message I didn't change the key name to `count`, which is necessary. --- .../javascripts/discourse/app/mixins/password-validation.js | 2 +- .../discourse/tests/acceptance/password-reset-test.js | 2 +- .../discourse/tests/unit/components/create-account-test.js | 2 +- config/locales/client.en.yml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/discourse/app/mixins/password-validation.js b/app/assets/javascripts/discourse/app/mixins/password-validation.js index e3bc3997909..d329576d822 100644 --- a/app/assets/javascripts/discourse/app/mixins/password-validation.js +++ b/app/assets/javascripts/discourse/app/mixins/password-validation.js @@ -82,7 +82,7 @@ export default Mixin.create({ return EmberObject.create( Object.assign(failedAttrs, { reason: I18n.t("user.password.too_short", { - password_min_length: passwordMinLength, + count: passwordMinLength, }), }) ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/password-reset-test.js b/app/assets/javascripts/discourse/tests/acceptance/password-reset-test.js index 258ebd045f4..64a102d062d 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/password-reset-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/password-reset-test.js @@ -79,7 +79,7 @@ acceptance("Password Reset", function (needs) { assert.ok( query(".password-reset .tip.bad").innerHTML.includes( I18n.t("user.password.too_short", { - password_min_length: this.siteSettings.min_password_length, + count: this.siteSettings.min_password_length, }) ), "password too short" diff --git a/app/assets/javascripts/discourse/tests/unit/components/create-account-test.js b/app/assets/javascripts/discourse/tests/unit/components/create-account-test.js index cdc22f98953..00e7dd45d53 100644 --- a/app/assets/javascripts/discourse/tests/unit/components/create-account-test.js +++ b/app/assets/javascripts/discourse/tests/unit/components/create-account-test.js @@ -81,7 +81,7 @@ module("Unit | Component | create-account", function (hooks) { testInvalidPassword( "x", I18n.t("user.password.too_short", { - password_min_length: siteSettings.min_password_length, + count: siteSettings.min_password_length, }) ); testInvalidPassword( diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 9bf1450bc07..e2a947a3647 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1936,8 +1936,8 @@ en: password: title: "Password" too_short: - one: "Your password is too short (minimum is %{password_min_length} character)." - other: "Your password is too short (minimum is %{password_min_length} characters)." + one: "Your password is too short (minimum is %{count} character)." + other: "Your password is too short (minimum is %{count} characters)." common: "That password is too common." same_as_username: "Your password is the same as your username." same_as_email: "Your password is the same as your email."