From d526486c199982c1f8fc55be1c5cd0242be08bd3 Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Thu, 8 Oct 2026 09:40:40 +0200 Subject: [PATCH] fix(bootstrap-admin-ui): translate login error with its parameters and the security domain --- .../login/page/content/form/error.html.twig | 2 +- .../FrenchTranslatedLoginTest.php | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 tests/Translations/FrenchTranslatedLoginTest.php diff --git a/src/BootstrapAdminUi/templates/security/login/page/content/form/error.html.twig b/src/BootstrapAdminUi/templates/security/login/page/content/form/error.html.twig index 7e2ee1dd..6f098dc5 100644 --- a/src/BootstrapAdminUi/templates/security/login/page/content/form/error.html.twig +++ b/src/BootstrapAdminUi/templates/security/login/page/content/form/error.html.twig @@ -2,6 +2,6 @@ {% if last_error is not null %}
- {{ last_error.messageKey|trans }} + {{ last_error.messageKey|trans(last_error.messageData, 'security') }}
{% endif %} diff --git a/tests/Translations/FrenchTranslatedLoginTest.php b/tests/Translations/FrenchTranslatedLoginTest.php new file mode 100644 index 00000000..552e27eb --- /dev/null +++ b/tests/Translations/FrenchTranslatedLoginTest.php @@ -0,0 +1,35 @@ +client = static::createClient(); + } + + public function testInvalidCredentialsMessageIsTranslated(): void + { + $this->markTestSkippedIfNecessary('fr'); + + $this->client->request('POST', '/admin/login_check', [ + '_username' => 'nonexistent@example.com', + '_password' => 'wrong-password', + ]); + $this->client->followRedirect(); + + self::assertSelectorTextContains('[data-test-invalid-credentials-message]', 'Identifiants invalides.'); + } +}