Reputation: 9685
What do I need to install to get the built-in validation messages of mvc be displayed in the current UI culture of the request? Are the resource files maybe a separate download?
e.g. The validation message "The Email field is required." Should be displayed in german when the culture is set to de-DE.
EDIT: Need to be a bit clearer. I've done the complete localisation of custom validation messages allready using attributes with custom messages. The ones I still need to get translated are the out-of-the box ones.
e.g.
[Required]
public string Email {get;set;}
produces the validation message The Email field is required. I'd like to have this in german and italian also, without having to go through every single property. (I am expecting there is language pack or something similar; Google wasn't able to produce anything though..)
Upvotes: 1
Views: 2729
Reputation: 21
Try to add the following in your Web.config file.
<system.web>
<globalization enableClientBasedCulture="true" uiCulture="auto" culture="auto"></globalization>
</system.web>
I think that is what you are looking for.
Upvotes: 2
Reputation: 101166
I've come up with a better way to localize models and validation messages. You do not have to use the attributes anymore. Instead I've created localized metadata providers.
http://blog.gauffin.org/2011/09/easy-model-and-validation-localization-in-asp-net-mvc3/
Upvotes: 1
Reputation: 2722
Just install the the dot net 4 full language pack in the desired language and you will get the localization of the DataAnnotations validation messages.
Upvotes: 0