I can localize most of data annotations in asp.net mvc. But, for some of them I can't. For example look at this one:
public class TestModel {
[Required(ErrorMessageResourceName="MyFloat",ErrorMessageResourceType=typeof(MyResource))]
[Display(Name = "MyFloat", ResourceType = typeof(MyResource))]
public float MyFloat { get; set; }
}
As you can see, I can localize Required
and Display
attributes. But, if end-user type a string in field, the validator throws an error with this message:
The field MyFloat must be a number.
I searched all attributes to find an attribute to change this message, but I couldn't. Have you any idea please? Thanks in advance.