Display standard razor / mvc 3 check messages displayed in another language

What do I need to set the mvc inline verification messages to display in the current request user interface culture? Are resource files separate downloads?

eg. You must confirm the "Email field" message. Must be displayed in German if the culture is set to de-DE.

EDIT: You need to be a little clearer. I have fully localized custom validation messages, already using attributes with custom messages. Those that I still need to translate are those that are.

eg.

[Required] public string Email {get;set;} 

displays a confirmation message. The Email field is required. I would like to have it in German and Italian, without having to go through each property. (I expect there is a language pack or something similar, Google could not create anything, though ..)

+1
source share
4 answers

I would recommend you check out the following guide .

0
source

Try adding the following to your Web.config file.

 <system.web> <globalization enableClientBasedCulture="true" uiCulture="auto" culture="auto"></globalization> </system.web> 

I think this is what you are looking for.

+2
source

I came up with a better way to localize models and validation messages. You no longer need to use attributes. Instead, I created localized metadata providers.

http://blog.gauffin.org/2011/09/easy-model-and-validation-localization-in-asp-net-mvc3/

+1
source

Just install the full dot net 4 language pack in your preferred language and you will receive the localization of DataAnnotations data validation messages.

0
source

Source: https://habr.com/ru/post/888186/


All Articles