Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

i18n for Custom Validation Error Messages?

default discord avatar
zed0547last year
1

Hey

@415764121280184330



Good question - yes I believe this is possible by leveraging the

ctx

argument passed to your validate function.

https://payloadcms.com/docs/fields/overview#validation-context

You can do this by using

req

via

ctx.req.i18n.t

which lets you use the

t()

function

  • default discord avatar
    hristo6004last year

    Thanks, that's very helpful!

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.