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.'); + } +}