我在最新版本的 VS 2019 中使用 blazor 3.1。
到目前为止,我能够本地化页面标签(标题、表格字段等)。
在ListEmployee.razor页面上,我能够本地化表格标题等。在AddEmplyeeValidation.razor页面上,我能够本地化表单标签,但我在本地化验证消息时遇到了问题。
对于Employee.cs文件的验证消息,验证消息Resources/Data在 files的文件夹中定义Data.Employee.resx,Data.Employee.ar.resx但这似乎不起作用。
using System.ComponentModel.DataAnnotations;
namespace BlazorSPA1.Data
{
public class Employee
{
[MaxLength(50)]
public string Id { get; set; }
[Required (ErrorMessage ="Name is RRRequired")]
[StringLength(20, ErrorMessage = "Name is too long.")]
public string Name { get; set; }
[Required]
[StringLength(20)]
public string Department { get; set; }
[MaxLength(100)]
public string Designation { get; set; }
[MaxLength(100)]
public string Company { …Run Code Online (Sandbox Code Playgroud) c# asp.net-core asp.net-core-localization blazor blazor-server-side