-
Notifications
You must be signed in to change notification settings - Fork 819
Validation for Locale probably with a decorator IsLocale() ? #408
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
Comments
Feel free add any functionality. But please be sure what do you mean under term of "locale". It could be language code or geographic/country code. And of course I am pretty sure there is not only one standard like "ISO 639", "ISO_3166", RFC 4646, ... |
IETF locale tags like en-US or en-GB |
we can include the other standards for future enhancement |
@rubiin console.log(LocaleCode.validate('en-US')); // true
console.log(LocaleCode.validate('en_US')); // false
console.log(LocaleCode.validate('bb-XX')); // false NB: hyphen-separated locales are standard (fr-BE) while the ones with underscore are not (fr_BE), see http://tools.ietf.org/html/rfc5646 |
I will be using more like a set of already available locales instead of a lib. I found a list at a lib https://github.com/expandjs/expandjs/blob/master/lib/languages.js |
Be careful. New lib could increase |
@vlapo I am just going to use the list of locales in the lib not the actual lib so nothing to worry |
Duplicate of #425 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This validation that comes with IsLocale() decorator will be used to determine if a value is a valid locale or not . If accepted I can do it and send a PR
The text was updated successfully, but these errors were encountered: