Closed crtl closed 2 years ago
Did you find any another working library?
Same issue here with LanguageNegotiator
.
I have a computer where Edge returns only:
Accept-Language: fr-FR
And
$negotiator->getBest('fr-FR', ['en', 'fr']); // returns NULL
Just found out that the issue was already fixed on 2.x branch, but no new tag have been created since a while.
You need configure your composer.json to use the current 2.x branch to get the fix:
"willdurand/negotiation": "2.x-dev"
This should be greatly appreciated to create a new release 2.3.2 with this fix (for PHP 5.x) However, I haven't been able to find a fix for version related to PHP 7.x, did I miss something ? Thanks ;)
@willdurand I tested the new 3.0.0 tag but this issue is still here.
This can be easily reproduced with:
$negotiator = new \Negotiation\LanguageNegotiator();
$bestLanguage = $negotiator->getBest('fr-FR', ['en', 'fr']); // returns NULL
When using "willdurand/negotiation": "2.x-dev"
, it works as expected:
$negotiator = new \Negotiation\LanguageNegotiator();
$bestLanguage = $negotiator->getBest('fr-FR', ['en', 'fr']); // returns fr
it looks like one fix applied to 2.x-dev
was not properly merged into 3.0
it looks like one fix applied to
2.x-dev
was not properly merged into3.0
mm interesting and sorry about that. Maybe I should have merged 2.x
into master
before releasing 3.0
. I thought those branches were in sync already.
I didn't try it but #113 looks to be the missing fix
I'll take a look this week.
Hello @willdurand, any news on this?
should be fixed by https://github.com/willdurand/Negotiation/pull/113, I am sorry that this took almost a year.
When youve only selected a single language in your browser (I tried it in Firefox 68) the library will not detect the language. The header sent is: