Skip to content

fix: expose locale support for isAlpha and IsAlphanumeric decorator #266

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

Closed
TheNoim opened this issue Oct 12, 2018 · 6 comments
Closed

fix: expose locale support for isAlpha and IsAlphanumeric decorator #266

TheNoim opened this issue Oct 12, 2018 · 6 comments
Labels
type: fix Issues describing a broken feature.
Milestone

Comments

@TheNoim
Copy link

TheNoim commented Oct 12, 2018

isAlpha and isAlphanumeric are not useful in an non english country if they don't support the locals argument like validator.js does.
This package is based on validator.js, so why are locals not supported?

import { IsAlphanumeric } from 'class-validator';

export class Target {
    @IsAlphanumeric('de-DE')
    name: string;
}

This needs to be possible.

@NoNameProvided NoNameProvided added type: fix Issues describing a broken feature. flag: accepting PRs labels Nov 4, 2018
@NoNameProvided NoNameProvided changed the title No local support?! fix: expose locale support for isAlpha and IsAlphanumeric decorator Nov 4, 2018
@vlapo vlapo added this to the 0.10.1 milestone Jul 26, 2019
@rubiin
Copy link
Contributor

rubiin commented Aug 19, 2019

Looking at the validator source code. It has a set of regex for all locales which it compares it with to determine a valid alpha and alphanumeric while in case of here, it is just comparing using instanceof. I would be happy to code this feature

@vlapo
Copy link
Contributor

vlapo commented Aug 19, 2019

It is simple fix. Feel free create PR. Check e.g. isMobilePhone validator. Its a same principe.

@rubiin
Copy link
Contributor

rubiin commented Aug 20, 2019

sure. I will work on it at my free time and create a pr

@rubiin
Copy link
Contributor

rubiin commented Aug 20, 2019

added that on pr #406

@rubiin
Copy link
Contributor

rubiin commented Sep 4, 2019

@vlapo @NoNameProvided I have added the fix

@vlapo vlapo closed this as completed Sep 25, 2019
@lock
Copy link

lock bot commented Oct 2, 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 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: fix Issues describing a broken feature.
Development

No branches or pull requests

4 participants