Skip to content

Commit

Permalink
feature #18190 Add Twig app.locale documentation (SVillette)
Browse files Browse the repository at this point in the history
This PR was merged into the 6.3 branch.

Discussion
----------

Add Twig `app.locale` documentation

The PR add documentation of symfony/symfony#49913

Commits
-------

ac51842 docs: add `app.locale` from Twig `AppVariable`
  • Loading branch information
OskarStark committed Apr 14, 2023
2 parents ac271b6 + ac51842 commit 70e861f
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 70e861f

Please sign in to comment.