//validation.tsx
export const zCreateTaskInputSchema = (t: TFunction<'tasks'>) =>
z.object({
title: z.string().min(1, t("title"))
});
//form.tsx
const { t } = useTranslation("tasks");
const form = useAppForm({
validators: {
onChange: zCreateTaskInputSchema(t),
},
defaultValues: {
title: "",
}
});
console.log(t('title')) //<-- text changes when locale changes
console.log(form.getAllErrors()); //<--- error text stays the same when locale changes, I need to retrigger validation for it to take effect
//validation.tsx
export const zCreateTaskInputSchema = (t: TFunction<'tasks'>) =>
z.object({
title: z.string().min(1, t("title"))
});
//form.tsx
const { t } = useTranslation("tasks");
const form = useAppForm({
validators: {
onChange: zCreateTaskInputSchema(t),
},
defaultValues: {
title: "",
}
});
console.log(t('title')) //<-- text changes when locale changes
console.log(form.getAllErrors()); //<--- error text stays the same when locale changes, I need to retrigger validation for it to take effect