Data annotation localization problem
Abdul Najeeb Anwari
21
Reputation points
I am using Asp.net Core Blazor and I want to localize validation messages. I am also using Portable Object Localization. The validation message localization does not work. I think Blazor does not support data annotation localization. So is there any solution to localize the validation messages?
Sample of my po file code:
msgid "The {0} field is required"
msgstr[0] "موجودیت {0} لازمی میباشد"
Sample model code:
[Display(Name = "Location")]
[Required(ErrorMessage = "The {0} field is required")]
public string Location{ get; set; }
I also want to know if it is possible to pass a parameter to the localization string like:
msgid "Please Enter {0}"
msgstr[0] "لطفا {0} را وارد نمایید"
In my Blazor view I want something like this:
@Localize["Please Enter {0}","Employee Name"]
// Please Enter Employee Name
// لطفا اسم کارمند را وارد نمایید
Developer technologies .NET Blazor
1,673 questions
Sign in to answer