Skip to content

isLocale does invalidate a lot of valid language tags #2100

@sosafe-jochen-wikenhauser

Description

Describe the bug
isLocale does not validate language tags correctly. There are a lot of valid language tags that are not valid for isLocale. 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 by isLocale. 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 of isLocale.

Additional context
Validator.js version: Master & all since isLocale is introduced
Node.js version: not relevant
OS platform: not relevant

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions