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

Added chapter about the locale based on the user entity #4875

Merged
merged 4 commits into from
Mar 13, 2015
Merged

Added chapter about the locale based on the user entity #4875

merged 4 commits into from
Mar 13, 2015

Conversation

peterrehm
Copy link
Contributor

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
Copy link
Member

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.

@javiereguiluz
Copy link
Member

@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
Copy link
Member

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"

@peterrehm
Copy link
Contributor Author

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
Copy link
Member

Choose a reason for hiding this comment

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

Based

@xabbuh
Copy link
Member

xabbuh commented Jan 20, 2015

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?

@peterrehm
Copy link
Contributor Author

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.

@peterrehm
Copy link
Contributor Author

I think this one is finished now?

services:
app.user_locale_listener:
class: AppBundle\EventListener\UserLocaleListener
tags:
Copy link
Contributor

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]

@wouterj
Copy link
Member

wouterj commented Mar 7, 2015

Sorry, @peterrehm, I missed the update of this PR. Labelled it as finished now

@weaverryan weaverryan merged commit 1aaa491 into symfony:2.3 Mar 13, 2015
weaverryan added a commit that referenced this pull request Mar 13, 2015
… (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
weaverryan added a commit that referenced this pull request Mar 13, 2015
@weaverryan
Copy link
Member

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!

weaverryan added a commit that referenced this pull request Mar 13, 2015
* 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
weaverryan added a commit that referenced this pull request Mar 13, 2015
* 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
  ...
weaverryan added a commit that referenced this pull request Mar 13, 2015
* 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
  ...
@xabbuh
Copy link
Member

xabbuh commented Mar 13, 2015

@peterrehm @weaverryan Sadly, I missed a few minor issues (see #5081).

@peterrehm peterrehm deleted the locale-user-dependend branch May 24, 2016 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants