Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When cachin is turned on, cookie selection doesn't work.
When cachin is turned on, cookie selection doesn't work.
Comments
Comment #1
BladeduThis is because hook_init (where the cookie currently is set) is not invoked when cache is active for anonymous users. I think that the current hook_init implementation should be moved in language_cookie_language function and then apply a redirect in hook_boot (which is always called) to the correct language prefix (fetched from cookie) if the domain is called without language prefix.
Comment #2
alexweber CreditAttribution: alexweber commented@Bladedu, thanks! You are absolutely right and I gotta admit I've never been very happy with the hook_init() method. I'll try to take a closer look and refactor soon.
In the meantime, patches are welcome! :)
Comment #3
alexweber CreditAttribution: alexweber commentedI got around to it! :)
The current implementation feels more robust and has worked fine in my tests.
Committed in a7dd56a.