MVC 验证:同一项目,不同语言:为什么?

发布于 2024-12-19 02:38:37 字数 509 浏览 2 评论 0原文

当我启动 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

妄司 2024-12-26 02:38:37

您的计算机上可能安装了 .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.

橘寄 2024-12-26 02:38:37

在大多数浏览器中,您可以指定您的首选语言。这些可能与您的 Windows 设置不同。

In most browsers you can specify your preferred languages. These can be different from your windows settings.

嗼ふ静 2024-12-26 02:38:37

检查 Accepted-language 请求标头。

Check the Accepted-language request header.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文