-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
isLocale does invalidate a lot of valid language tags #2100
Comments
|
Can I work on this one? I am pretty new to this |
I suppose the only comprehensive way to cover all valid language tags is to implement an RFC5646 compliant regex |
@sosafe-jochen-wikenhauser you make a good point about whether there is a difference between a "locale" and "language tag". w3.org describe a language tag as:
and a locales as:
Thus your interpretation is not wrong in my opinion. |
Describe the bug
isLocale
does not validate language tags correctly. There are a lot of valid language tags that are not valid forisLocale
. But could be that I do not understand correctly if there is a difference between "locale" and "language tag".Examples
i.e.
zh-CHS
is not correctly validated byisLocale
. In fact every locale with a 3 letter subtag is invalidated. According to the Wikipedia page (I know, but primary sources are hard to come by) there are a lot of other valid codes not covered by the regex ofisLocale
.Additional context
Validator.js version: Master & all since
isLocale
is introducedNode.js version: not relevant
OS platform: not relevant
The text was updated successfully, but these errors were encountered: