willdurand / Negotiation

Content Negotiation tools for PHP.
https://williamdurand.fr/Negotiation/
MIT License
1.41k stars 62 forks source link

Language negotiator doesn't seem to work with IE and Edge #97

Closed bbalet closed 6 years ago

bbalet commented 7 years ago

Internet Explorer and Edge send an HTTP_ACCEPT_LANGUAGE header equal to something like "fr-FR" that looks diferent from the format used by Chrome or Firefox, for example: "fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3"

With Internet Explorer and Edge, your lib returns null on this call:

$bestLanguage = $negotiator->getBest($_SERVER['HTTP_ACCEPT_LANGUAGE'], $languages);

You may try on your side with this example: http://benjamin-balet.info/tauch/ Although the outcome may differ depending on your configuration.

hirbod commented 6 years ago

I can confirm this. It doesn't work on Safari either, because HTTP_ACCEPT_LANGUAGE is empty...

bbalet commented 6 years ago

I realize this is a duplicate of #76