开发者

Do Input Builder attributes in MVC Contrib support localization?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜