Skip to content

Commit ac51842

Browse files
committed
docs: add app.locale from Twig AppVariable
1 parent 2f64d14 commit ac51842

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

templates.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,12 +380,18 @@ gives you access to these variables:
380380
``app.current_route_parameters``
381381
An array with the parameters passed to the route of the current request or an
382382
empty array if no request is available (equivalent to ``app.request.attributes.get('_route_params')``)
383+
``app.locale``
384+
The locale used in the current :ref:`locale switcher <locale-switcher>` context.
383385

384386
.. versionadded:: 6.2
385387

386388
The ``app.current_route`` and ``app.current_route_parameters`` variables
387389
were introduced in Symfony 6.2.
388390

391+
.. versionadded:: 6.3
392+
393+
The ``app.locale`` variable was introduced in Symfony 6.3.
394+
389395
In addition to the global ``app`` variable injected by Symfony, you can also
390396
inject variables automatically to all Twig templates as explained in the next
391397
section.

translation.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,8 @@ checks translation resources for several locales:
988988
add the missing translation to the log file. For details,
989989
see :ref:`reference-framework-translator-logging`.
990990

991+
.. _locale-switcher:
992+
991993
Switch Locale Programmatically
992994
------------------------------
993995

0 commit comments

Comments
 (0)