views:

27

answers:

0

Using a resx file in the App_GlobalResources directory, I've been able to change the default message for the PropertyValueInvalid string of the model validators.

But it doesn't work to translate the message when a value is required (PropertyValueRequired.)

In the Global.asax.cs Application_Start() I've changed the resource class key, like this:

DefaultModelBinder.ResourceClassKey = "Messages";

And in the Messages.resx files I've put two entries:

  • "PropertyValueInvalid" => "O valor '{0}' é inválido para o campo {1}."
  • "PropertyValueRequired" = > "É necessário digitar o {0}."

Thanks.