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

Add test language. #9

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

BondarenkoAlex
Copy link

No description provided.

@DanFMoore
Copy link
Owner

DanFMoore commented Dec 22, 2016

Right, I think I see what's happened. On validatorjs 2.0.5, my method in the docs worked for setting the language worked. This kind of thing:

function (validator) {
	validator.lang = 'ru';
}

Because of the update to 3.9 in master now, that no longer works. But because this is a change to API of validatorjs, I don't think the way you've done it to support the old method is the right way. If users check the documentation of validatorjs to see what methods or attributes to set in the callback, they won't see the lang attribute listed.

Instead it looks like the proper way to do it in validatorjs is this way:

Validator.useLang('es');

It doesn't look like you can set the language on a specific validator instance anymore as it's a static method so I might just update the documentation to reflect that although that is going slightly into documenting validatorjs which I don't really want to do. The language example for the callback was only ever intended as an example to show how the instance could be manipulated after creation.

It actually looks like there are no instance methods / attributes in validatorjs now (apart from passes() and fails()) so I'm not even sure if the callback is needed anymore.

@BondarenkoAlex
Copy link
Author

BondarenkoAlex commented Mar 16, 2017

Yes, I agree that to call the prototype method in instance is wrong.
This leads to a mess in the procedure .

But it is important to give a chance to change the language from English to any other language.

My question is what is the best way to do it? Maybe we can do it like this: strategy.setDefaultLang('ru'); ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants