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 &quot;Adresse&quot; muss eine Zeichenfolge mit
einer maximalen L&#228;nge von 100 sein."
data-val-length-max="100"
data-val-required="Das Feld &quot;Adresse&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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With