Feature #102326
Updated by Torben Hansen 7 months ago
Extbase validators do currently use hardcoded translation keys to output possible validation messages. Those translation keys can globally be overwritten using a custom localization file, but it is not possible to provide individual translation keys for validation errors in a given context (e.g. property or dedicated validator call). There is a workaround (https://stackoverflow.com/a/40400270/1744743) out there, which uses useses fluid and the given error codes of the extbase validators. This works fine, but I think extbase Extbase should provide something similar out of the box in order to define translation keys in code as shown below: <pre> #[Validate([ 'validator' => 'NotEmpty', 'options' => [ 'nullTranslateKey' => 'validation.title.notNull', 'emptyTranslateKey' => 'validation.title.notEmpty', 'extensionName' => 'my_extension' ], ])] protected string $title = ''; </pre>