From ac51842c2a158a5fbd664c58d00730fc74410ee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sama=C3=ABl=20Villette?= Date: Tue, 11 Apr 2023 12:04:26 +0200 Subject: [PATCH] docs: add `app.locale` from Twig `AppVariable` --- templates.rst | 6 ++++++ translation.rst | 2 ++ 2 files changed, 8 insertions(+) diff --git a/templates.rst b/templates.rst index 4da6e9bdb86..b0bcaffec05 100644 --- a/templates.rst +++ b/templates.rst @@ -380,12 +380,18 @@ gives you access to these variables: ``app.current_route_parameters`` An array with the parameters passed to the route of the current request or an empty array if no request is available (equivalent to ``app.request.attributes.get('_route_params')``) +``app.locale`` + The locale used in the current :ref:`locale switcher ` context. .. versionadded:: 6.2 The ``app.current_route`` and ``app.current_route_parameters`` variables were introduced in Symfony 6.2. +.. versionadded:: 6.3 + + The ``app.locale`` variable was introduced in Symfony 6.3. + In addition to the global ``app`` variable injected by Symfony, you can also inject variables automatically to all Twig templates as explained in the next section. diff --git a/translation.rst b/translation.rst index 87c0dc8aaed..9cfbf7fed78 100644 --- a/translation.rst +++ b/translation.rst @@ -988,6 +988,8 @@ checks translation resources for several locales: add the missing translation to the log file. For details, see :ref:`reference-framework-translator-logging`. +.. _locale-switcher: + Switch Locale Programmatically ------------------------------