Translation #763
Unanswered
fabbaumgartner
asked this question in
Q&A
Translation
#763
Replies: 1 comment
-
For now I've used approach from zod docs: const customErrorMap: zod.ZodErrorMap = (error, ctx) => {
switch (error.code) {
case zod.ZodIssueCode.invalid_type:
case zod.ZodIssueCode.too_small:
return { message: ERRORS.required };
case zod.ZodIssueCode.invalid_string:
if (error.validation === "email") {
return { message: ERRORS.invalidEmail };
}
case zod.ZodIssueCode.invalid_enum_value:
return { message: ERRORS.invalidType };
default:
return { message: ERRORS.default };
}
};
zod.setErrorMap(customErrorMap);
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everybody :)
Is there a way to translate all errors to german or is there a list of all different error keys?
Beta Was this translation helpful? Give feedback.
All reactions