我正在try 本地化数据注释属性的错误消息.我创建了两个resx文件:
DataAnnotationsLocalization.resx
> DataAnnotationsLocalization.Designer.cs
DataAnnotationsLocalization.uk.resx
我正在Program.cs
中调用AddDataAnnotationsLocalization
,现在try 在我的页面模型中使用它:
[MinLength(10, ErrorMessage = "LocationAddressFormatError")]
public string Address { get; set; }
但因此,我只看到我的英语资源显示,而对于其他本地化字符串,我根据当前文化(CultureInfo.CurrentUICulture
)查看它们.
我已经在Designer.cs
中添加了断点,但它从未被击中.似乎框架直接进入DataAnnotationsLocalization.resx
并且不考虑其他语言版本.
如何显示当前文化的正确语言版本?