willdurand / Negotiation

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

port to v2 fix language negotiation to choose generic if available when asking for specific #96

Closed jaugustin closed 7 years ago

jaugustin commented 7 years ago

Hi,

I port my fix #65 to the 2.x branch

This should resolve #76 I add the same unit test and add also new data to test.

With my fix the priority is over the exact match, I don't know if this is expected or if fallback to generic should have less priority.

In the next unit test it match generic "FR" over specific "en-US"

array('fr-FR, en-US;q=0.8', array('fr', 'en-US'), 'fr'),
willdurand commented 7 years ago

Thanks!