-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Added chapter about the locale based on the user entity #4875
Conversation
peterrehm
commented
Jan 17, 2015
Q | A |
---|---|
Doc fix? | no |
New docs? | yes |
Applies to | 2.3 |
Fixed tickets | #4862 |
Setting the locale based on the user entity | ||
------------------------------------------- | ||
|
||
You might want to improve even further and want to define the locale based on |
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.
Original:
You might want to improve even further and want to define the locale based on
the user entity of the logged in user.
Proposed rewording:
You might want to improve this technique even further and define the locale based on
the user entity of the logged in user.
@peterrehm thanks for adding this nice addition to the cookbook. I've made lots of comments, but they are minor things about the syntax. Your contents are right and that's the important thing. Thanks! |
@@ -106,3 +106,86 @@ method:: | |||
{ | |||
$locale = $request->getLocale(); | |||
} | |||
|
|||
Setting the locale based on the user entity |
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.
"Setting the Locale based on the User Entity"
Thank you for the feedback on the chapter, I have made the adjustments based on our discussion. Let's see when @xabbuh wakes up I expect the next e-mail flood :) |
@@ -106,3 +106,93 @@ method:: | |||
{ | |||
$locale = $request->getLocale(); | |||
} | |||
|
|||
Setting the Locale based on the User Entity |
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.
Based
Thanks for this great work @peterrehm! I left you a few comments. :) However, I have one thought I would like to discuss with you: I am not convinced that we should actually talk about entities at all. In fact, it doesn't really matter if the user is stored in a relation database or if you load them from a custom file format or anything else. So I'd suggest to talk about "Choosing the Locale Based on the User's Preferences" or something like that. What do you think? |
Thank you for your feedback, I was awaiting that :) I changed it in the title to preferences, but we mainly talk about entities. I think it makes it more clear that you also have to watch out for changes to the entity as in the end in the caution block. |
I think this one is finished now? |
services: | ||
app.user_locale_listener: | ||
class: AppBundle\EventListener\UserLocaleListener | ||
tags: |
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.
I think you forget to inject the session here
...
arguments: [@session]
Sorry, @peterrehm, I missed the update of this PR. Labelled it as finished now |
… (peterrehm) This PR was merged into the 2.3 branch. Discussion ---------- Added chapter about the locale based on the user entity | Q | A | ------------- | --- | Doc fix? | no | New docs? | yes | Applies to | 2.3 | Fixed tickets | #4862 Commits ------- 1aaa491 Updated as per feedback. 0fc72a8 Updated as per feedback 6e986e1 Updated wording of the chapter as per discussion 66e21a9 Added chapter about the locale based on the user entity
Hey Peter! This is really great! I'll admit that this article sounds very useful and common, but I'm not sure I would have known how to implement it immediately. So, awesome :). I did make some minor language tweaks at sha: 4c190cf. If anyone sees any issues (I have the superpower of making more typos than everyone else), please let me know! Thanks! |
* 2.3: (23 commits) Update configuration.rst Update configuration.rst Readability [#4875] Minor language tweaks [#4779] Minor tweaks to a huge PR Fixed some of the comments [#4793] Very minor tweak that sounds more natural [config][translator] use the new fallbacks option. Linked "logrotate" to its official website Minor rewording Added a note about log file sizes and the use of logrotate Use snake_case for template names Made http cache chapter best-practices-compatible and lots of other fixes Made propel chapter best-practices-compatible and lots of other fixes Made testing chapter best-practices-compatible and lots of other fixes Made validation chapter best-practices-compatible Remove usage of first person Updated as per feedback. Updated as per feedback Fix typos ... Conflicts: book/forms.rst book/testing.rst cookbook/logging/monolog.rst reference/configuration/framework.rst
* 2.6: (32 commits) Update configuration.rst Update configuration.rst Readability [#4875] Minor language tweaks [#4779] Minor tweaks to a huge PR [#4724] Minor language tweaks and cross-link to form theming document the validation payload option Fixed some of the comments [#4793] Very minor tweak that sounds more natural [#4732] Tweaking language, clarifying purpose of disabling form and that you can disable CSRF on 1 form [#4732] Tweaking language, clarifying purpose of disabling form and that you can disable CSRF on 1 form [config][translator] use the new fallbacks option. add missing reference options and descriptions Linked "logrotate" to its official website Minor rewording Added a note about log file sizes and the use of logrotate Use snake_case for template names Fixed minor grammar issues Made http cache chapter best-practices-compatible and lots of other fixes Made propel chapter best-practices-compatible and lots of other fixes ...
* 2.7: (38 commits) Update configuration.rst Update configuration.rst Readability [#4875] Minor language tweaks [#4779] Minor tweaks to a huge PR [#4724] Minor language tweaks and cross-link to form theming [Serializer] Fix CS document the validation payload option Fixed some of the comments [#4793] Very minor tweak that sounds more natural [#4732] Tweaking language, clarifying purpose of disabling form and that you can disable CSRF on 1 form [#4732] Tweaking language, clarifying purpose of disabling form and that you can disable CSRF on 1 form [config][translator] use the new fallbacks option. add missing reference options and descriptions Linked "logrotate" to its official website Minor rewording Added a note about log file sizes and the use of logrotate Use snake_case for template names Fixed minor grammar issues Made http cache chapter best-practices-compatible and lots of other fixes ...
@peterrehm @weaverryan Sadly, I missed a few minor issues (see #5081). |