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

Validation for Locale probably with a decorator IsLocale() ? #408

Closed
rubiin opened this issue Aug 21, 2019 · 10 comments
Closed

Validation for Locale probably with a decorator IsLocale() ? #408

rubiin opened this issue Aug 21, 2019 · 10 comments
Labels
type: feature Issues related to new features.

Comments

@rubiin
Copy link
Contributor

rubiin commented Aug 21, 2019

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

@vlapo vlapo added flag: accepting PRs type: feature Issues related to new features. labels Aug 23, 2019
@vlapo
Copy link
Contributor

vlapo commented Aug 23, 2019

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, ...

@rubiin
Copy link
Contributor Author

rubiin commented Aug 23, 2019

IETF locale tags like en-US or en-GB

@rubiin
Copy link
Contributor Author

rubiin commented Aug 23, 2019

we can include the other standards for future enhancement

@rubiin
Copy link
Contributor Author

rubiin commented Sep 4, 2019

@vlapo

@daweedm
Copy link

daweedm commented Sep 16, 2019

@rubiin
This library could be useful for your PR : https://www.npmjs.com/package/locale-code

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

@rubiin
Copy link
Contributor Author

rubiin commented Sep 29, 2019

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
@vlapo @NoNameProvided . Also can we put hacktoberfest label to the issue

@vlapo
Copy link
Contributor

vlapo commented Oct 1, 2019

Be careful. New lib could increase class-validator package size (we have already problem with this).

@rubiin
Copy link
Contributor Author

rubiin commented Oct 1, 2019

@vlapo I am just going to use the list of locales in the lib not the actual lib so nothing to worry

@vlapo
Copy link
Contributor

vlapo commented Oct 16, 2019

Duplicate of #425

@vlapo vlapo marked this as a duplicate of #425 Oct 16, 2019
@vlapo vlapo closed this as completed Oct 16, 2019
@lock
Copy link

lock bot commented Oct 23, 2019

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.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature Issues related to new features.
Development

No branches or pull requests

3 participants