diff --git a/src/Security/AuthenticationEntryPointRedirector.php b/src/Security/AuthenticationEntryPointRedirector.php index 3f1363faef..34a8455ae7 100644 --- a/src/Security/AuthenticationEntryPointRedirector.php +++ b/src/Security/AuthenticationEntryPointRedirector.php @@ -8,10 +8,12 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface; +use Symfony\Contracts\Translation\TranslatorInterface; class AuthenticationEntryPointRedirector implements AuthenticationEntryPointInterface { public function __construct( + private readonly TranslatorInterface $translator, private readonly UrlGeneratorInterface $urlGenerator ) { } @@ -21,7 +23,7 @@ public function start(Request $request, ?AuthenticationException $authException // add a custom flash message and redirect to the login page /** @var Session $session */ $session = $request->getSession(); - $session->getFlashBag()->add('warning', 'You have to login in order to access this page.'); + $session->getFlashBag()->add('warning', $this->translator->trans('You have to login in order to access this page.', [], 'security')); return new RedirectResponse($this->urlGenerator->generate('bolt_login')); } diff --git a/templates/content/_buttons.html.twig b/templates/content/_buttons.html.twig index 7010b56a04..4aa14d8232 100644 --- a/templates/content/_buttons.html.twig +++ b/templates/content/_buttons.html.twig @@ -31,7 +31,7 @@