-
Notifications
You must be signed in to change notification settings - Fork 118
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* add documentation for global-blocks * fix code-block * fix code-review * Update book/templates.rst Co-authored-by: Prokyonn <[email protected]> --------- Co-authored-by: Prokyonn <[email protected]>
* Extend Docs for Admin View Debug Command * Update book/extend-admin.rst Co-authored-by: Prokyonn <[email protected]> --------- Co-authored-by: Prokyonn <[email protected]>
* Add reference bundle docs * Add review suggestion * Add review suggestion
* add cleanup phpcr database * Apply suggestions from code review Co-authored-by: Prokyonn <[email protected]> --------- Co-authored-by: Prokyonn <[email protected]>
* Simplify global blocks example to ref * Update book/templates.rst --------- Co-authored-by: Prokyonn <[email protected]>
* Simplify global blocks example to ref * Update book/templates.rst --------- Co-authored-by: Prokyonn <[email protected]>
Hopefully preventing confusion as noted in sulu/sulu#7443
Can you target the |
@@ -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``. |
There was a problem hiding this comment.
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.
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hopefully preventing confusion as noted in sulu/sulu#7443
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.