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.

How to translate validation error messages

default discord avatar
Deleted User3 years ago
2

I tried following the documentation

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

Validation function has translation function as an optional param, but when I use the same translation function, the error message still does not translate.


I have not extended i18 configuration. I am just using the

t

function and expecting payload to translate according to the language chosen by the user. Is there anything that I am missing.



validate: (value, { t }) => { if (condition) return true; return t( "The URL must start with xyz" ); }
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.