ASP.NET MVC 3的本地化验证消息我的机器上工作,但不能在服务器 [英] ASP.NET MVC 3 localized validation messages work on my machine, but not on server
问题描述
我在ASP.NET MVC 3的形式使用本地化的验证消息。它正确生成HTML一样
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=""
/>
这工作正常的我的机器上当我我CurrentThread设置为英语,德语或意大利语的CultureInfo。
This works fine on my machine when I set my CurrentThread to an English, German or Italian CultureInfo.
但它的不另外两个开发机器和一个Windows Server 2008 R2的测试机(同一个项目,同样的设置工作:我甚至安装了ASP.NET MVC 3工具更新语言包),但是我还是只有英文验证消息:
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?
推荐答案
您可能必须安装.NET framewok语言包。例如,我的机器上验证消息将不会在德国出现,直到我安装德语语言包一>
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.
要求
属性不是asp.net MVC的,但更普遍的DataAnnotations的一部分,所以语言包应该有所帮助。
Required
attribute is not part of asp.net-mvc but more general DataAnnotations, so language pack should help.
这篇关于ASP.NET MVC 3的本地化验证消息我的机器上工作,但不能在服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!