1

When I test my web app locally on my laptop, the validation messages are in French (which is what I expect). The problem is that when I publish on our server or the client's server, the validation messages are in English.

Just to be 100% clear, the kind of validation messages I mean are the default ones like

The field "Foo" is required

What does this depend on? How can I ensure that the default language is French everywhere?

Csharp
  • 2,916
  • 16
  • 50
  • 77
Mathieu
  • 4,449
  • 7
  • 41
  • 60
  • What have you tried? Your question is answered in [ASP.NET MVC 3 localized validation messages work on my machine, but not on server](http://stackoverflow.com/questions/9636332/asp-net-mvc-3-localized-validation-messages-work-on-my-machine-but-not-on-serve) and [MVC validation messages - localization?](http://stackoverflow.com/questions/17123674/mvc-validation-messages-localization). – CodeCaster Jul 11 '13 at 15:26
  • Purely looking at the doc, can you add `Required(ErrorMessage="message in french...")]` and see if that works? The 2nd link by @CodeCaster should help. – shahkalpesh Jul 11 '13 at 15:30
  • @shahkalpesh That solution works, but doing this for all models and properties is repetetive and unoptimized for sure. – Mathieu Jul 11 '13 at 15:47
  • 1
    @CodeCaster Ah! I found many answers, but didn't get on that first link you provided. Thanks! – Mathieu Jul 11 '13 at 15:47
  • 1
    @Mathieu: Check the 2nd link. Effectively, the validation message is loaded from resource depending upon `Accept-Language` header. The setting in web.config overrides that for you to show message in what you specify. – shahkalpesh Jul 11 '13 at 15:49
  • @shahkalpesh you're right, that answers the question!! – Mathieu Jul 11 '13 at 17:21

0 Answers0