开发者

Do Input Builder attributes in MVC Contrib support localization?

开发者 https://www.devze.com 2022-12-12 07:48 出处:网络
With Data Annotations for example, besides decorating members like this: [Required( ErrorMessage = \"You must enter your first name.\"

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:

[Require开发者_如何转开发d(
    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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消