Skip to content

Using translations 'outside' of React #28

Answered by DoneDeal0
PointSingularity asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @PointSingularity , thanks for your message!

I don't know Zod, but you could simply write the translation key in the message field:

    const layoutEditSchema = z.object({
                title: z.string().min(1, { message: "form.required" }),
                id: z.string().min(1, { message: "form.required" ) }),
            })

then loop over the errors and write:

<p>{T(error.message)}</p>

This way, you can keep your schemas out of your components. Let me know if it works.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@PointSingularity
Comment options

Answer selected by PointSingularity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
help wanted Extra attention is needed
2 participants