-
-
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
chore(README): add the supported locales for various validators #1266
Comments
@profnandaa i was thinking about fixing it the other day and i had a little concern, should we rename |
@tux-tn -- sure, standardization will be great. However, we will have backward compatibility to deal with. |
@profnandaa can i work on a PR where we can accept a string and an array as a parameter and rename it to locale in the documentation? |
@tux-tn -- can give an example? |
@profnandaa: It looks like the documentation side of things has already been handled from looking at the README, so is this issue now for removing instances of From doing a quick search through the code base, it looks like we could rename the remaining parameters without causing backwards compatibility issues, and I'll be happy to submit a PR if this is true |
@jmartin4563 -- sure, the issue will be mainly dealing with backward compatibility. I'm more of the idea that we go for CC for stuff that's territorial, and I know this contradicts with what we've done already with stuff like PostalCode, PhoneNumber, etc... what would be your suggestion? |
@profnandaa Started work on adding 'DE' locale for |
I realised that you use a combination of ISO 639-1 + ISO 3166-1 alpha-2 to identify locale. And I think it's weird because in the majority of validators you do not need to identify language + country. Country code is enough imo. So, yes, it would be good to use just a For example in a My suggestion is to use ISO 3166-1 alpha-2. And one more thing... e.g. export default {
CA: 'CA',
PL: 'PL',
UA: 'UA',
US: 'US',
TS: 'TS',
}; Later, the enumeration can be reused in each validator, which depends on the country code. Like below: import isTaxID from 'validator/lib/isTaxID';
import COUNTRIES from 'validator/lib/COUNTRIES';
isTaxID('value to validate', COUNTRIES.CA) I could start to work on PoC to show a vision |
Would like to pick up on that topic. Would be great to have it set for all countries in major economic regions. Would be especially great to have EU set complete. Would start with adding Germany to |
I would like to see any thoughts on my comment above. |
I agree that we should choose either ISO 639-1 or ISO 3166-1 alpha-2 to be consistent throughout the project. I would however say that because some validators benefit from having language + country defined I would use ISO 639-1. What we could add is a helper function that parses the country for the validators that do not need the language. So in short; prefer ISO 639-1 but also allow ISO 3166-1 alpha-2 as fallback and make a helper function to parse ISO 639-1 to ISO 3166-1 alpha-2 to make validators shorter that do not require the language I do not really have any opinions on the enum like object but a PoC would be nice. Did you start on that already? |
No I didn't. I want to know opinions on that to not work on something that is not needed |
Is the subject still in progress? or is it closed? |
As far as I know no work on this has been done since my previous comment. I still agree with what I said there |
e.g.
isPassportNumber
, etc.The text was updated successfully, but these errors were encountered: