The machine’s settings should be in English, so it would. If you cannot do this at least the language needs to be installed, and you need to configure 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."
If you still want to customize the message have some paths, one of them:
[DataType(DataType.Date, ErrorMessage = "O campo \"Data\" deve ser uma data")]
A more complete and programmatic solution can be found in a microsoft blog.
Other article.
It is possible to do via library on client, maybe using jQuery if that’s the case you are using. you will need isntsalr components for this:
PM> Install-Package jQuery.Validation.Globalize
PM> Install-Package jquery-globalize
There’s a boy who answered this here, see if you can figure out what you want.
I put in the Github for future reference.
@Matheusmiranda I edited.
– Maniero
I made it myself :), what I want is just rename warning.
– Matheus Miranda