Skip to content

Commit

Permalink
Re-add translations for ValidationException (#50546)
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints authored Mar 14, 2024
1 parent 5e2f7cd commit 695f761
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Illuminate/Validation/ValidationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 695f761

Please sign in to comment.