From 695f7619272b0df41b342a7c39b64aebe971d55d Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Thu, 14 Mar 2024 16:43:39 +0100 Subject: [PATCH] Re-add translations for ValidationException (#50546) --- src/Illuminate/Validation/ValidationException.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Validation/ValidationException.php b/src/Illuminate/Validation/ValidationException.php index 053f65b20694..31f6f1fa9924 100644 --- a/src/Illuminate/Validation/ValidationException.php +++ b/src/Illuminate/Validation/ValidationException.php @@ -88,15 +88,15 @@ protected static function summarize($validator) $messages = $validator->errors()->all(); if (! count($messages) || ! is_string($messages[0])) { - return 'The given data was invalid.'; + return $validator->getTranslator()->get('The given data was invalid.'); } $message = array_shift($messages); - if ($additional = count($messages)) { - $pluralized = $additional === 1 ? 'error' : 'errors'; + if ($count = count($messages)) { + $pluralized = $count === 1 ? 'error' : 'errors'; - $message .= " (and {$additional} more {$pluralized})"; + $message .= ' '.$validator->getTranslator()->get("(and :count more $pluralized)", compact('count')); } return $message;