在我的.NET Core类库项目中,当资源文件名中包含一个点时,资源文件不会更新.例如,当我在.NET Core项目中添加Resources.en.resx或Resources.es.resx文件时,自定义工具无法生成或更新C#资源文件.这是错误消息:
自定义工具ResXFileCodeGenerator无法为输入文件"Resources.en.resx"生成输出,但未记录特定错误.
如果您知道任何解决方法或任何修复方法,请指出正确的方向
Asp.net core 服务器端本地化有很好的文档记录并且对我有用。但是,如何在 Blazor WebAssembly 客户端上本地化 DTO 模型上的 DataAnnotations?
在服务器端,我添加了下面的代码,并且 DataAnnotations 已本地化。一切都按预期进行。
...
services
.AddRazorPages() .AddViewLocalization(Microsoft.AspNetCore.Mvc.Razor.LanguageViewLocationExpanderFormat.Suffix)
.AddDataAnnotationsLocalization(
options =>
{
options.DataAnnotationLocalizerProvider = (type, factory) =>
{
return factory.Create(typeof(CommonStrings));
};
});
...
Run Code Online (Sandbox Code Playgroud)
但是我如何在 Blazor 客户端(WebAssembly)上做同样的事情呢?例如,我有一个位于客户端的模型:
public class ApplicationUserDTO
{
public string Id { get; set; }
[Required(ErrorMessage ="Field {0} is required")]
[Display(Name ="First name")]
public string FirstName { get; set; }
[Required]
[Display(Name = "Last name")]
public string LastName { get; set; }
[Required]
[Display(Name = "Email")]
public string Email { …Run Code Online (Sandbox Code Playgroud)