Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Twig] Add app.locale documentation #18190

Merged
merged 1 commit into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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