Author Topic: failing detection of preferred language from accept-language  (Read 1481 times)

Offline olaix

  • Beginner Budgeter
  • *
  • Posts: 19
    • View Profile
failing detection of preferred language from accept-language
« on: December 15, 2016, 04:54:51 AM »
If the browser sends an accept-language header containing both language and location the result is always english, regardless of languages preferred.

Example accept-language:
"nb-no,en-us,en" yields english (expected norwegian)
"es-mx,en-us,en" yields english (expected spanish)
"nb,en-us,en" yields norwegian (expected)
"es,en-us,en" yields spanish (expected)

"en-us,es,en" yields english which is really expected, but is puzzling considering it doesn't work with the other language and location strings...

This seems relevant:

I suppose adding aliases for each combination would be an easy (and flexible way) of adressing this. You could add a line in the translation-sheet for a comma separated list of locale aliases and the ones translating could add aliases for their languages. Ex. I'd add "nb-no,nn-no" to norwegian, and whoever translates spanish add "es-es,es-mx,es-xy" to spanish and so on.

Hoping for a fix - And thanks a lot for all your hard work :)