Closed KCFindstr closed 3 years ago
Woow great that you mention it! Never would have found it without your help! I think we can change the behaviour of the default accept-language resolver so that it works with your scenario? Lemme know what you thinks :)
I'm not familiar with accept-language-parser but it seems that the loose option was added in #179 to fix another bug? I don't know if any other accept-language parsers can handle this better, but a temporary fix I can think about is to pick without loose first, and if nothing matched, then pick in loose mode again?
Are there any updates on this? If not, I'm going to write my own accept language resolver.
@KCFindstr sorry I’ve had the time yet to look into this. (Currently on vacation). Feel free to make a pull request (as long as it doesn’t break any existing tests)
I noticed that AcceptLanguageResolver uses accept-language-parser in loose mode, which means the order of the languages matter from the documentation.
This resulted in some strange behaviors. For example, if the provided languages are:
['zh-CN', 'zh-TW']
zh-CN
(simplified Chinese) will always be picked even if the accept language iszh-TW
orzh-Hant-TW
(traditional Chinese). I also tried['zh-Hans-CN', 'zh-Hant-TW']
but neither worked. Is there a workaround other than providing my own language resolver?