This project is read-only.

Validation and localized error messages

May 2, 2011 at 7:39 PM


I was able to get the validation library to work based on the sample code however I couldn't figure out how can i provide localized error messages, or, custom error messages to it.
Hope somebody can help me with that.

Thanks in advance;

May 3, 2011 at 2:56 PM

Can't the validation/error messages used by the validation library be loaded from a resource file? Perhaps after the user selects a language or the program automatically determines it from the system locale.

May 3, 2011 at 6:09 PM

you mean, change the source code? I'm pretty sure it will work. thanks.

May 3, 2011 at 6:30 PM

Oops, my bad. Now I do see your point!

You may obviously change the source code or create another validator class using the classes and interfaces already present in ComLib. I see, however, how that could be a bit...not exactly counterproductive but actually tedious. Give us a couple of days to discuss this internally and see if we can add this as a work item for a consequent release.

May 6, 2011 at 9:16 PM

We'll code a way to allow us to keep the default error messages present in the ValidationExtensions.cs and ValidationsExtensionsAssertive.cs but you'll be able to override those and provide custom error messages. I'll post back when the code is uploaded.

May 6, 2011 at 9:25 PM

that's great, thanks.

May 7, 2011 at 6:54 AM
Edited May 7, 2011 at 6:54 AM

Added in changset 66239. You can provide localized messages by using the SetCustomMessages() method of the Validation namespace. Please let us know if that's satisfactory.

May 15, 2011 at 11:26 AM

that will do it. thanks a lot.