jayco / accept-language-negotiator

RFC4647 compliant accept-language negotiator for parsing HTTP Accept-Language header and returning matched lists or language lookup.
MIT License
7 stars 3 forks source link

Tests demonstrating invalid matches #9

Closed FMCorz closed 3 years ago

FMCorz commented 3 years ago

Hi,

Unless I am mistaken, there are some issues with the matches.

An existing test seems faulty and reports the wrong match (see 2nd commit).

I also identified that the lookup function could return a language that is neither the part of the available languages, nor the default one. For instance, with a range of en-US, and available languages as [en-GB], then the language en will be returned regardless of the default (see 3rd commit).

With some guidance I'd be happy to contribute a solution.

Thank you!

jayco commented 3 years ago

Hey @FMCorz thanks for taking the time to look into this and for the PR!

TBH, I simply don't have the time to maintain this project anymore and it really needs some TLC!

I would love someone to take it over, would you be interested?

FMCorz commented 3 years ago

Hi @jayco, I'm afraid I would not have the time either.

But if you are going to retire this repository, then perhaps you could recommend the following repository as an alternative. I discovered it while looking for yours.

https://github.com/opentable/accept-language-parser

Thank you!

jayco commented 3 years ago

Thanks @FMCorz.

I have deprecated this package in NPM and also added a note in the repo as per your suggestion.