Language isn't detected on IOS Safari and Chrome


I tried from a new fresh instance of grav to create two pages, one in english, one in french.
I’ve enabled the multi language setting and also the http_accept_language parameter. My both environment (web and IOS) are in French.

  1. I fetch http://localhost/work-environment/grav/

On a web browser (IE, Chrome, Firefox) and on Android, no problem, I get redirected to

but on iPhone Safari (IOS 10), I always get redirected to http://localhost/work-environment/grav/en.

I’ve checked the Accept-Language header on both platforms:

  • Web: fr,en-US;q=0.8,en;q=0.6
  • Safari IOS: fr-fr

It looks like the language redirection doesn’t work.

Any idea about this issue? Thanks

Actually this is happening as well in Safari 9 on Mac (El Capitan), I’ve changed my Mac Language & Region Interface to French. In Chrome I’m redirecting to /fr. In Safari, to /en.


Uhm, I’ve replicated the problem and I’ve found some weirdness in how Safari sends the preferred language in the HTTP request headers. In short, instead of sending fr like all other browsers, it sends fr-fr which causes confusion in the language identifier. Looking into it.

Can you test this PR?

@flaviocopes Yes exactly, this is what I found this morning.

I also found that using “français (France)” in Chrome, will populate the following HTTP_ACCEPT_LANGUAGE : "fr-FR,fr;q=0.8"

And it does work in Chrome, but maybe that’s because it’s fr-FR instead of `fr-fr.

I also found that in Android and IOS, from any webview (for example facebook webview after link click from a user timeline) always redirect you to the en version (or fallback language).

I think it’s the same related issue. I’m on slack if you need help for debugging. Thanks

Thanks @flaviocopes, it looks like it’s fixed.

Tested on:

  • Safari IOS 10
  • Safari 9 Mac OSX El Capitan
  • Chrome Mac OSX El Capitan
  • Android Nexus 5 Facebook Webview