Amazing timing for me -- client just requested this functionality and here's your module! Thanks for putting this together!

I just found a possible bug..

My site uses user's browser language settings for language detection. I disabled removed anonymous user access to Spanish, leave it on for English and Russian. When a user with a browser language of Spanish comes to the site, I think they are being redirected to /es/, but since they don't haves permission to access Spanish, I think they are redirected back to / .. which then causes a redirect to /es/ again. So browser reports a "too many redirects" error.

Any possibility of influencing the language detection settings with this module?

Comments

Jānis Bebrītis’s picture

I was aware of the fact that at least default language should be accessible for that specific role. Usually it happens that there should be at least one visible language for anonymous user.

Let's see how we can solve this -

As a workaround I see 3 options:
- it could fall back to "/[default-lang]" instead of "/". That should do it for lang detection mode.
- module settings with drupal path for fallback
- die('Error #'.rand());

jonmcl’s picture

I like the first option: "/[default-lang]" instead of "/"

Technically it should take the next preferred language that the client has access to, but I think this would be a good compromise. Most sites (mine included) have a way to select a language anyway. So if client browser preference is for ES->RU->EN, but my default language is EN, they would get EN (for a site with EN & RU). Not perfect, but I think it's acceptable.

..jon

Jānis Bebrītis’s picture

Should be fixed in dev now. You can checkout code from git and test. Will be packed as tar.gz on d.o. in day or two.

jonmcl’s picture

Works perfectly!!

Thank you!!

..jon

jonmcl’s picture

Status: Active » Closed (fixed)

Forgot to update status.

shadysamir’s picture

Status: Closed (fixed) » Active

I am getting the too many redirects issue with the latest dev.

Default language "ar", detection is URL prefix then default, "ar" has no prefix defined. Only logged in users can view "en". Anonymous user get Too Many Redirects trying to open example.com/en

Jānis Bebrītis’s picture

I think this is related to issue here #1705122: No permissions set on install

Problem is - if anonymous user has no permission to access at least default language, he get's redirect loop. Felix has even supplied patch for it.

Jānis Bebrītis’s picture

Issue summary: View changes
Status: Active » Fixed

All fixed, there is default_language check now. Also, there are no funky drupal_goto's anymore, it's drupal_access_denied + exit instead;

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.