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

best() returning traditional chinese when it should be returning simplified chinese #33

Open
kellenwheaton opened this issue Feb 19, 2016 · 1 comment

Comments

@kellenwheaton
Copy link

My supported locales are:

["en", "fr", "de", "zh-hant", "zh-hans"]

In Chrome my language settings are:
screen shot 2016-02-19 at 4 05 40 pm
My current accept-language header is:

zh-CN,zh;q=0.8,zh-TW;q=0.6,en;q=0.4,en-US;q=0.2

After the following code:

locales = new locale.Locales(req.headers["accept-language"]);
bestLocale = (locales.best(supportedLocales) || "").toString();

bestLocale is "zh-hant", rather than "zh-hans", and traditional chinese is what's shown to the user. In the meantime I'm manually returning "zh-hans" when the first language in the header is zh-CN.

@stuartf
Copy link
Collaborator

stuartf commented Mar 23, 2016

I suspect this is because the code has no way of mapping zh-CN and zh-TW to zh-hant and zh-hans so it's actually matching zh from your browser and giving the first zh-* from your supported list.

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

2 participants