Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC 3 localized validation messages work on my machine, but not on server

I'm using localized validation messages in a ASP.NET MVC 3 form. It correctly generates HTML like

<input class="inputlong" data-val="true" 
   data-val-length="Das Feld &amp;quot;Adresse&amp;quot; muss eine Zeichenfolge mit
                  einer maximalen L&amp;#228;nge von 100 sein." 
   data-val-length-max="100" 
   data-val-required="Das Feld &amp;quot;Adresse&amp;quot; ist erforderlich." 
   id="Address" name="Address" type="text" value="" 
/>

This works fine on my machine when I set my CurrentThread to an English, German or Italian CultureInfo.

But it doesn't work on two other developer machines and a Windows Server 2008 R2 test machine (same project, same setup: I've even installed the ASP.NET MVC 3 Tools Update Language Packs), but I still get only the English validation messages:

 <input class="inputnormal input-validation-error" data-val="true" 
     data-val-length="The field Adresse must be a string with a maximum length of 100." 
     data-val-length-max="100" data-val-required="The Adresse field is required." 
     id="Address" name="Adresse" type="text" value=""
 />

Are there settings or some missing assemblies on the other computers I am not aware of?

like image 889
splattne Avatar asked Mar 09 '12 15:03

splattne


1 Answers

You may have to install .net framewok language pack. For example, on my machine validation messages would not show up in German until I installed German language pack.

Required attribute is not part of asp.net-mvc but more general DataAnnotations, so language pack should help.

like image 173
archil Avatar answered Sep 21 '22 12:09

archil