我在我的 asp.net core 应用程序中使用了 Orchard Localization。
启动.cs
services.AddPortableObjectLocalization(options => options.ResourcesPath = "Resources");
services
.AddMvc()
.AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix)
.AddDataAnnotationsLocalization();
model.cs
[Display(Name = "First Name")]
[Required(ErrorMessage = "Customer first name required")]
public string CustomerFirstName { get; set; }
en.po(包含英文翻译)
msgid "Customer first name required"
msgstr "Customer first name required"
no.po(包含挪威语翻译)
msgid "Customer first name required"
msgstr "Fornavn mangler"
请求英文地址
Home/HomeRequest/?cid=40&culture=en
请求挪威语的网址
Home/HomeRequest/?cid=11&culture=no
我首先输入英文网址并检查所需的验证,英文本地化验证完美触发。然后我将 cid 和文化的值更改为挪威语,并使用英语本地化而不是挪威语检查验证验证火灾。
如何根据语言环境获取数据注释验证?
问题是一个错误OrchardCore.Localization.Core
nuget 包现在已经修复了。将您的包更新到版本1.0.0-beta3-71025
或以上来解决此问题。
你可以找到问题线索here https://github.com/OrchardCMS/OrchardCore/issues/2974
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)