MVC 验证:同一项目,不同语言:为什么?
当我启动 MVC 应用程序并尝试提交带有空字段的表单时,会触发验证并显示以下消息(德语):
Das Feld "Telefon" ist erforderlich.
如果我在老板的计算机上执行相同操作,则消息是
The Telefon field is required.
我检查了区域的 Windows 设置和语言不同,但它们是相同的吗?还有什么原因呢?
编辑
解决方案是安装“Microsoft .NET Framework 4 Extended DEU Language Pack”(或您首选的语言),并在<系统中的Views/web.config中添加区域性信息。 web>
-部分:
<globalization culture="de-DE" uiCulture="de-DE"/>
When I start my MVC application and try to sumbit a form with an empty field than validation is fired and the following message appears (german):
Das Feld "Telefon" ist erforderlich.
If i do the same on my bosses computer, the message is
The Telefon field is required.
I checked if out windows settings for region and language are different, but they are the same? What else could be the reason?
EDIT
Solution is to install 'Microsoft .NET Framework 4 Extended DEU Language Pack' (or your perferred language) and to add the culture information in Views/web.config in the <system.web>
-Part:
<globalization culture="de-DE" uiCulture="de-DE"/>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的计算机上可能安装了 .NET Framework 的德语本地化版本,因此所有错误消息都来自本地化附属程序集。 Phil Haack 在博客中介绍了本地化验证消息。
On your computer you probably installed the German localized version of the .NET Framework so all error messages are coming from the localized satellite assemblies. Phil Haack blogged about localizing validation messages.
在大多数浏览器中,您可以指定您的首选语言。这些可能与您的 Windows 设置不同。
In most browsers you can specify your preferred languages. These can be different from your windows settings.
检查
Accepted-language
请求标头。Check the
Accepted-language
request header.