Making the response message translatable

parent e7a5effc
......@@ -44,8 +44,21 @@ class MoveMediaController extends Controller
return response()->json([
'errors' => $failedMoves > 0,
'message' => $failedMoves > 0 ? 'Some files were not moved' : 'Files moved successfully',
'message' => $this->getResponseMessage($failedMoves),
'folder_id' => $destination->id,
]);
}
/**
* @param int $failedMoves
* @return string
*/
protected function getResponseMessage(int $failedMoves) : string
{
if ($failedMoves > 0) {
return trans('media::media.some files not moved');
}
return trans('media::media.files moved successfully');
}
}
......@@ -39,4 +39,6 @@ return [
'edit resource' => 'Edit media',
'destroy resource' => 'Delete media',
'file too large' => 'File is too large. Must be below :size MB.',
'some files not moved' => 'Some files were not moved',
'files moved successfully' => 'Files moved successfully',
];
......@@ -34,4 +34,6 @@ return [
'Browse' => 'Parcourir...',
'upload file' => 'Uploadez un fichier',
'remove media' => 'Supprimez le fichier',
'some files not moved' => 'Certains fichiers n\'ont pas été déplacés',
'files moved successfully' => 'Fichiers déplacés avec succès',
];
......@@ -34,4 +34,6 @@ return [
'Browse' => 'Bladeren ...',
'upload file' => 'File uploaded',
'remove media' => 'File verwijderen',
'some files not moved' => 'Sommige bestanden zijn niet verplaatst',
'files moved successfully' => 'Bestanden zijn succesvol verplaatst',
];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment