Usage
Error interpolation
Learn how to overload translation from zodI18n.
At first see how interpolation work with Vue I18n.
You need to use refinements function from Zod to send custom values to your final translation key.
website.schema.ts
import { z } from 'zod'
// here refine always return false to directly show the error message
export const colorSchema = z.object(color: z.string().refine(() => false, {
params: {
i18n: {
key: 'myCustomErrorWithInterpolation',
values: { first: 'colors.red', second: 'colors.green' }
}
}
})
export type Color= z.input<typeof colorSchema>;