开发者

Translation with resource files, Internationalization asp.net

开发者 https://www.devze.com 2022-12-10 19:39 出处:网络
i have an asp.net mvc application, and i use data annotations for data validations something like this:

i have an asp.net mvc application, and i use data annotations for data validations something like this:

 public class Booking
 {
    [Required(ErrorMessage = "Please enter your name")]
    public string Name { get; set; }
     ...

so this is in my DomainModel and i need to translate the ErrorMessage, and to use the translation in my views

i would like to have just one resource file for each language

anybody knows so开发者_如何学编程me solutionus ?


Put your error messages in resource files, and apply ErrorMessageResourceName and ErrorMessageResourceType instead of ErrorMessage on the Required attribute. See here: http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.requiredattribute_members.aspx

0

精彩评论

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

关注公众号