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

Accept-Language header parsing ignores region tags? #21

Closed
aseemk opened this issue Aug 1, 2013 · 1 comment
Closed

Accept-Language header parsing ignores region tags? #21

aseemk opened this issue Aug 1, 2013 · 1 comment

Comments

@aseemk
Copy link

aseemk commented Aug 1, 2013

Currently line 224:

(accept.match(/(^|,\s*)([a-z]+)/g) || []).forEach(function(locale) {

https://github.com/jeresig/i18n-node-2/blob/master/i18n.js#L224

This only grabs the language tag, not the region tag, so it doesn't differentiate between e.g. simplified Chinese (zh-CN) and traditional (zh-TW).

@jed's locale and @mozilla's i18n-abide both have parsing code that takes region tags and even score into account.

E.g. https://github.com/mozilla/i18n-abide/blob/master/lib/i18n.js#L269-L295

Hope that helps!

@jeresig
Copy link
Owner

jeresig commented Feb 1, 2014

Just landed a pull request that fixes this.

@jeresig jeresig closed this as completed Feb 1, 2014
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