You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to display some custom errors from my API.
I made a name space called formErrors that contains these generic errors, and when an error occurs I then check if formErrors has an translation for it and if so, I translate it with i18next.
However, some erorrs needs more context (parms), like my custom TOO_SHORT_PASSWORD that is a Zod type like string().min(8, "TOO_SHORT_PASSWORD"), which in my formErrors hans a translated string `The password should be at least {{ minimum }} characters long".
This works, I think I have misunderstood something, or done it wrong. With my implementation I miss out of some of the functionality of this package like exact, inclusive and not_inclusive.
Is there a way I can have custom error messages, with interpolation, that doesn't require the refine/params method?
The text was updated successfully, but these errors were encountered:
Hi,
I wanted to display some custom errors from my API.
I made a
name space
calledformErrors
that contains these generic errors, and when an error occurs I then check ifformErrors
has an translation for it and if so, I translate it withi18next
.However, some erorrs needs more context (parms), like my custom
TOO_SHORT_PASSWORD
that is a Zod type likestring().min(8, "TOO_SHORT_PASSWORD")
, which in myformErrors
hans a translated string `The password should be at least {{ minimum }} characters long".This works, I think I have misunderstood something, or done it wrong. With my implementation I miss out of some of the functionality of this package like
exact
,inclusive
andnot_inclusive
.Is there a way I can have custom error messages, with interpolation, that doesn't require the refine/params method?
The text was updated successfully, but these errors were encountered: