-
Notifications
You must be signed in to change notification settings - Fork 41
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
Adding new rules with custom i18n error message #7
Comments
I'm thinking about using final localeData = <String, String>{
'min_length': 'Must be at least {min} characters',
};
FormValidator.addLocale('en', localeData);
FormValidator.addLocale('en', {
'custom_validation': 'lorem ipsum dolor ...',
}); What do you think about that? Some other methods would be added too, for example FormValidator.addMessage('custom_validation', {
'en': '...',
'fr': '...',
...
}); |
I think it would be a great solution for this problem 👍 |
Fixed in v0.1.6-next. I published as prerelease since there's some breaking changes. |
Hello ! I've just tried this new version but i'm getting this error :
I couldn't found where this come from but maybe the Localdata is only accessible via "get" only somewhere. |
Thanks for reporting. I think |
As far as i'm aware, there is no way to add both a new custom validation rule and localized error message associated.
It would be great if we could extend both
ValidationBuilder
andFormValidatorLocale
derived classes (eg:LocaleEn
) or rethink a bit the way to handle it to enable this feature.For now the solution is to copy all the localized files and handle the loading according to user's language, which is not very practical.
The text was updated successfully, but these errors were encountered: