Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

Bug in language handling

edited May 2012 in Miscellaneous


I downloaded version 1.3 and I found a bug in language handling. The error occurs with Chrome, Safari and Internet Explorer. With Firefox everything is ok.

My system:
Windows 7 Ultimate - Service Pack 1
Apache 2.2.17
PHP 5.4.3

See report


  • I think this can be improved, but is not a bug exactly. The default q value if not present is 1, q meaning quality, or preference for that language.

    So Chrome is saying "give me en-US or en or it-IT or it" in that order. It found a match at en and stopped, since that was preferred. Here I think your languages aren't sorted by preference in your Chrome settings. Can you make sure the most preferred languages are at the top of the list in Chrome and see if that works?

    Firefox says "give me it-it or it or en-us or en" in that order. It found a match at it and stopped.

    Safari and IE didn't match because there was no it-IT language in the system, only it, and those browsers didn't specify it as a fallback. Here's where it may be able to be improved, since when the language and locale codes are the same, perhaps they should be evaluated as one?

    There are rare cases where this could lead to incorrect language selection, but it would catch the "right one" more often, and those incorrect cases should be rare (where the site has it and it-IT and you specifically want it-IT but it would see them both as it now).

    Looking further into Safari, their language settings are poorly implemented. They only send one with no fallbacks, and don't allow you to customize this further (at least on Mac OS X). So in Safari, even if you'd like to specify it-IT, it;q=0.8 you can't, it will only send it-IT. That makes me think the above change is needed to compensate for their poor implementation of the Accept-Language header.

    After working through a few tests, I just made the above change. Can you try the latest master branch on GitHub and let me know if that fixes it for you?

    Thanks for pointing this out! :)

  • edited May 2012
    1. your change is ok;
    2. in Chrome the preferred language is at the top and now is ok.
  • Thanks, glad it works better now!

Sign In or Register to comment.