Like what we’re doing? Star us on GitHub!

How to translate validation error messages

Akt771
4 weeks 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" ); }
Open the post
Continue the discussion in Discord
Can't find what you're looking for?
Get help straight from the Payload team with an Enterprise License.Learn More