The machine's settings should be in Portuguese, so it would solve. If you can not do this at least the language needs to be installed, and you need to configure it to use our messages:
Thread.CurrentThread.CurrentUICulture = new CultureInfo("pt-BR");
Or even configure:
<system.web>
<globalization responseEncoding="UTF-8"
requestEncoding="UTF-8"
culture="pt-BR"
uiCulture ="pt-BR"
enableClientBasedCulture="true" />
.....
</system.web>
You can still use a new resource file by configuring the Global.asax
section Application_start
:
ClientDataTypeModelValidatorProvider.ResourceClassKey = "PtbrResources";
2
DefaultModelBinder.ResourceClassKey="PtbrResources";
Then create a PtbrResources.resx
with the error messages you want. look in the default file for 'FieldMustBeDate The field {0} must be a date.'
Ifyoustillwanttocustomizethemessageyouhavesomepaths,oneofthem:
[DataType(DataType.Date,ErrorMessage="O campo \"Data\" deve ser uma data")]
A more complete and programmatic solution can be found in a blog from Microsoft .
Another article .
It is possible to do via library on the client, maybe using jQuery if it is the case that is using. you'll need to list the components for this:
PM> Install-Package jQuery.Validation.Globalize
PM> Install-Package jquery-globalize
There is a guy who has answered this here , see if he solves what he wants.