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

Update localization.rst: Added a note how to get the current locale #803

Closed
wants to merge 40 commits into from

Conversation

spackmat
Copy link
Contributor

Hopefully preventing confusion as noted in sulu/sulu#7443

Q A
Fixed tickets Prevents confusion as in #7443
Related PRs none
License MIT

What's in this PR?

Adds a note how to get the currently active locale in the documentation for the localizations.

Why?

#7443 describes the confusion about that.

vinceAmstoutz and others added 30 commits November 25, 2022 13:33
* add documentation for global-blocks

* fix code-block

* fix code-review

* Update book/templates.rst

Co-authored-by: Prokyonn <daniel@sulu.io>

---------

Co-authored-by: Prokyonn <daniel@sulu.io>
* Extend Docs for Admin View Debug Command

* Update book/extend-admin.rst

Co-authored-by: Prokyonn <daniel.mathis@sector8.eu>

---------

Co-authored-by: Prokyonn <daniel.mathis@sector8.eu>
* Add reference bundle docs

* Add review suggestion

* Add review suggestion
* add cleanup phpcr database

* Apply suggestions from code review

Co-authored-by: Prokyonn <daniel@sulu.io>

---------

Co-authored-by: Prokyonn <daniel@sulu.io>
* Simplify global blocks example to ref

* Update book/templates.rst

---------

Co-authored-by: Prokyonn <daniel.mathis@sector8.eu>
@alexander-schranz
Copy link
Member

Can you target the 2.5 branch for this?

@@ -70,6 +70,8 @@ For the developer the only touching points with localizations are the
configuration and the eventual use of a language switcher on the homepage.
For the language switcher the ``localizations`` variable delivered to the twig template
can be used, which contains an associative array with the parameters ``locale``, ``url`` and ``country``.
The currently active locale can be obtained from the underlying Symfony Request object with
``app.request.locale``.
Copy link
Member

@alexander-schranz alexander-schranz Jun 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use the app.locale for template may rendering in CLI context without a request object. That was added sometime ago by Symfony.

symfony/symfony#49913

@spackmat spackmat changed the base branch from 2.x to 2.5 June 5, 2024 15:03
@spackmat spackmat closed this by deleting the head repository Jun 5, 2024
@spackmat
Copy link
Contributor Author

spackmat commented Jun 5, 2024

I have opened a new PR based on 2.5 branch: #805

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants