-
I have been trying to figure out how to localize validation error messages, without luck. I have tried various versions of this but I think this is close to what I should be doing. The razor code <Validation Validator="@ValidateName" MessageLocalizer="@Localize">
<TextEdit @bind-Text="@MyModel.Name">
</TextEdit>
</Validation> the validation logic
The localize message
The property on MyModel
What I´m I doing wrong? I have tried to skip the attributes/ErrorMessage on the property etc. etc. Hope you can assist :-) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
MessageLocalizer
localization works only with data annotations. You need to removeValidator="@ValidateName"
. Or if you still want to useValidator
then set the message bye.ErrorMessage = "something";
inside of ValidateName.