I've a multilingual website which use the language prefix for each language.

Take an example: my domain name is "example.com".

When I use example.com/fr, i'm redirected to the french language and the language cookie is set to "fr". Normal behavior indeed.

So I restart my browser and I use the url without prefix (example.com).
Normaly, I will be redirected to the french language... No, i'm always redirected to the website default language.

This cause by the option "Frontpage Redirect Handler" in the module "Global Redirect".
I've no possibility to disable this option.

My goal is to be redirected to the right language (in cookie) without disable this option.
A "nice to have" will to be redirected to an URL with the right language prefix.

Example:
If my cookie is set to "fr" and I use "example.com", i want to be redirected to "example.com/fr".

Comments

Echofive’s picture

I've written a patch to do what I need.

My solution is based on the hook_url_outbound_alter().
The "Global Redirect" module invokes all of this hooks to set the redirection.

For me it work fine but probably don't fixes all cases...
It's interesting to test:

  • with one different domain by language...
  • with one prefix by language exept for the default...

The language management is complex and I've no time to test all cases.

Echofive’s picture

Status: Active » Needs review
StatusFileSize
new1.53 KB

Sorry bad patch name :(