I've a fully localized website, which is in mostly in french/english/german.

For now, all was going fine, but I did notice a problem with some error message of asp.net MVC.

I've one property in my model:

[Required]
[LocalizedDisplayName("PublicationDate", NameResourceType = typeof(LocalizationResources.Views.Composer.BaseInfoForm))]
public DateTime PublicationDate { get; set; }

LocalizedDisplayname is an extension of the DisplayNameAttribute, which goes in the Resx file to get the correct translation

The thread CurrentCulture and the CurrentCultureUI are in fr-FR, so the message should be displayed in french(like it does with my [Required] Attribute, display automatically "Le champ Publication est requis".

But in the case of a DateTime, if I enter something which isn't a date, the validator just returns me a "The value 'asdfasdf' is not valid for Publication." So:

  • Why MVC returns me sometimes error message in french, and sometimes in english, in the same form(and I precise, it's the default error message)
  • How to replace this message genericly, by indicating a text like "La valeur {0} n'est pas une date valide pour le champ {1}"

Thank you very much

Edit
Report