Hi I have a strange behaviour with the locale module (version drupal core 7.7.)
Determine the language from the browser's language settings doesn't work - no error message or dblog messge about ..
I don't know if it is not a bug - eventually a conflict with other modules - but after disabling various suspicious candidate the phenomena continues and as far as I remember this happens siunce update to 7.7
- user, session, url and default language is recognized, but not browser language … and that is in my case the most important part …

Comments

plach’s picture

Status: Active » Postponed (maintainer needs more info)

The browser detection works only if a user is logged in or if page cache is disabled. Is this your case?

ChoY’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

thank you very much - the page cache was the point. I didn't were aware about this contextual consequences, when I enabled anonymous caching some days ago
... would be good to have this explanation at detection and selection help text ...

JonMcL’s picture

Hello,

I'm curious if there is a simple explanation anywhere as to why this is designed to work this way?

I would like to use anonymous page cache, but still have the site switch languages based on user's browser language preference. Is the language key not kept with the cache?

Thanks!

..jon

fenda’s picture

I also would like to know why browser detection works only if cache is disabled / logged in?

fietserwin’s picture

It works as designed. You can read #339958: Cached pages returned in wrong language when browser language used for details, but in short: the home page (one of the few URLs that can represent content in multiple languages) gets cached in the language that happens to be requested first and will subsequently be served to every anonymous user regardless its language preference.

As an IMHO "less than optimal" solution, it was decided to disable browser detection if page caching is switched on. For the home page this will normally result in the default language being presented. The problem with this solution is that contrib solutions like redirecting form the homepage to the language specific homepage, cannot be made to work (unless contrib is providing its own (browser based) language detection method).

If someone knows of a solution, in contrib or custom code, I would like to know that, so please post a follow-up here.

GiorgosK’s picture

#5
according to this comment http://drupal.org/node/1740902#comment-6898094
Boost does a good job with language detection (personally did not work for me)

and this solution I mostly use
http://drupal.org/node/339958#comment-2503184