Skip to content

Commit

Permalink
docs: add app.locale from Twig AppVariable
Browse files Browse the repository at this point in the history
  • Loading branch information
SVillette committed Apr 11, 2023
1 parent 2f64d14 commit ac51842
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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.
Expand Down
2 changes: 2 additions & 0 deletions translation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------------------------

Expand Down

0 comments on commit ac51842

Please sign in to comment.