Question

With Data Annotations for example, besides decorating members like this:

[Required(
    ErrorMessage = "You must enter your first name."
)]
public int FirstName { get; set; }

I can also do it like this to accommodate multiple cultures:

[Required(
    ErrorMessageResourceType = typeof(Resources.Customer),
    ErrorMessageResourceName = "NameRequired"
)]
public int FirstName { get; set; }

Does anybody know if the input builders in MVC Contrib support something like this for setting labels?

Thank you.

Was it helpful?

Solution

In MVC 2 do you have an attribute called DisplayName. DisplayNameAttribute doesn't support localization out of the box, but you can derived it and implement it yourself.

Here is an example how to do that: http://adamyan.blogspot.com/2010/02/aspnet-mvc-2-localization-complete.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top