How to Localizing Default Error Messages The field XXX must be a number in Asp.net core?


#1

I want to change the error message “The field XXX must be a number.” into chinese.
But I can’t find any attrbute or function.
Please help me.
Thx.


#2

OK,I found I can set data-val-number myself like this.
<input asp-for="Price" data-val-number="字段 {0} 必须是一个数字。" class="form-control" />
But,I think we need a better way to change it as default,like using resources.
And I also found that,the file xxx.cshtml saved by ansi.So ,the word shown in browser ,<( ̄3 ̄)> …


.NET Foundation Website | Blog | Projects | Code of Conduct