Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit 5cd2801

Browse files
fix #28 - notempty validator i18n
1 parent 61d5ddc commit 5cd2801

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/Input.php

+10-3
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,17 @@ protected function injectNotEmptyValidator()
491491
*/
492492
protected function prepareRequiredValidationFailureMessage()
493493
{
494-
$notEmpty = new NotEmpty();
495-
$templates = $notEmpty->getOption('messageTemplates');
494+
$notEmpty = new NotEmpty();
495+
$templates = $notEmpty->getOption('messageTemplates');
496+
$message = $templates[NotEmpty::IS_EMPTY];
497+
$translator = $notEmpty->getTranslator();
498+
499+
if ($translator) {
500+
$message = $translator->translate($message, $notEmpty->getTranslatorTextDomain());
501+
}
502+
496503
return [
497-
NotEmpty::IS_EMPTY => $templates[NotEmpty::IS_EMPTY],
504+
NotEmpty::IS_EMPTY => $message,
498505
];
499506
}
500507
}

0 commit comments

Comments
 (0)