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

Fixed session default locale, it now checks user's default language. #29

Merged
merged 2 commits into from Aug 28, 2013
Merged

Fixed session default locale, it now checks user's default language. #29

merged 2 commits into from Aug 28, 2013

Conversation

akiojalehto
Copy link
Contributor

User's default language was not used with internationalization addon.
This caused site to use predefined default for the site, even if user had selected different default.

Now default language will be returned by user's choise if site has corresponding locale available.

If current page is anything but homepage, en_US is allowed even if it is not available in content sections. That is because site might not have it, but you might like to use dashboard in english on a non english site.

In homepage only existing content section locales are allowed even for user's default, because existing locale is needed in case of forwarding rules.

@@ -48,6 +48,16 @@ public function getSessionDefaultLocale() {
if(isset($_COOKIE['DEFAULT_LOCALE'])) {
return $_COOKIE['DEFAULT_LOCALE'];
}

$u = new User();
if ($u->isLoggedIn()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

isLoggedIn is a static method, so you can call it without instantiating the User class. What about this?

if(User::isLoggedIn()) {
   $u = new User();
   ...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed that as you suggested. Thanks.

tylerryan added a commit that referenced this pull request Aug 28, 2013
…in-user

Fixed session default locale, it now checks user's default language.
@tylerryan tylerryan merged commit fdf71c8 into concretecms:master Aug 28, 2013
@tylerryan
Copy link
Contributor

Thanks, nice to have it honor the preference from the user object .

@akiojalehto akiojalehto deleted the fix/default-language-for-logged-in-user branch August 29, 2013 05:57
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

3 participants