From 66726a7966e214ab1d7b7ea1bce8ce2aa47f9395 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 15 Oct 2025 12:31:09 +0200 Subject: [PATCH] [Routing] Initialize router.request_context's _locale parameter to %kernel.default_locale% --- routing.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/routing.rst b/routing.rst index bf016faad02..753b4d4719d 100644 --- a/routing.rst +++ b/routing.rst @@ -2833,6 +2833,18 @@ Now you'll get the expected results when generating URLs in your commands:: value, but you can change it with the ``asset.request_context.base_path`` and ``asset.request_context.secure`` container parameters. +.. note:: + + By default, routes generated outside the HTTP context use the + :ref:`default locale ` as the value of the + ``_locale`` parameter. You can override this by providing a different value + for the ``_locale`` parameter when generating each route. + + .. versionadded:: 7.4 + + The default locale is used as the value of the ``_locale`` parameter + starting from Symfony 7.4. + Checking if a Route Exists ~~~~~~~~~~~~~~~~~~~~~~~~~~