I use validation attributes and I want to localize my error messages. I found this:
[RegularExpression(
"^[a-zA-Z0-9_]*$",
ErrorMessageResourceType=typeof(Resources.RegistrationModel),
ErrorMessageResourceName= "UsernameError"
)]
You can even do it with a resource string like this:
"{0} is in an invalid format."
And it will fill in the property name. Almost what I want, however instead of the property name I want to pass a specific string like "User name"
or "Phone number"
(actually I want to get those strings from the resource file as well).
Is this possible? Or do I have to have a lot of very similar strings in my resource file?