Language preference detection bug

The “Accepted-Language” header include priority for the language in it. All redirection or locale detection should respect the priority specified there.

For example, when provided with this “Accepted-Language” header:

zh-HK,zh-TW;q=0.8,en-US;q=0.5,en;q=0.3"

a website should:

  1. find “zh-HK” (Traditional Chinese, Hong Kong) and “zh-TW” (Traditional Chinese, Taiwan) first. If exists, redirect / show the content in that language.
  2. If not exists, find “en-US”. redirect / show the content in that language.
  3. If not exists, find “en”. redirect / show the content in that language.

However, if you supply a request to addons.mozilla.org/firefox with the said header, it will redirect you to addons.mozilla.org/zh-CN/firefox. That is not an expected response. It is wrong in multiple levels:

  1. Even there is no “zh-HK” in the site, there is “zh-TW”. From language priority, it should be shown.
  2. zh-CN” is never a part of the language preference. If should not be shown, or it should be shown as a fallback only if both “zh-HK” and “zh-TW” are absent.
  3. Event without language priority to “zh-TW”, the fallback to “zh-HK” should always be “zh-TW” (both Traditional Chinese).

Please fix this redirection issue. Thanks.

Please file an issue here, if you haven’t already.

Thanks. The issue is now here.