Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work with single language #102

Closed
crtl opened this issue Aug 26, 2019 · 10 comments
Closed

Does not work with single language #102

crtl opened this issue Aug 26, 2019 · 10 comments

Comments

@crtl
Copy link

crtl commented Aug 26, 2019

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:

Accept-Language: de-DE
@Marcin-TA
Copy link

Did you find any another working library?

@Seb33300
Copy link

Seb33300 commented Oct 18, 2019

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

@Seb33300
Copy link

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"

@emri99
Copy link

emri99 commented Aug 12, 2020

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 ;)

@Seb33300
Copy link

@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

@willdurand
Copy link
Owner

willdurand commented Mar 17, 2021

it looks like one fix applied to 2.x-dev was not properly merged into 3.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.

@Seb33300
Copy link

I didn't try it but #113 looks to be the missing fix

@willdurand
Copy link
Owner

I'll take a look this week.

@Seb33300
Copy link

Hello @willdurand, any news on this?

@willdurand
Copy link
Owner

should be fixed by #113, I am sorry that this took almost a year.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants