diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index 11725286e1..8e3615d7bb 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -1230,7 +1230,7 @@ class AssetsController extends Controller // Validate that asset tags were provided in the request if (!$request->filled('asset_tags')) { return response()->json(Helper::formatStandardApiResponse('error', null, - 'No assets selected.'), 400); + trans('admin/hardware/message.no_assets_selected')), 400); } // Convert asset tags from request into collection and fetch matching assets @@ -1240,7 +1240,7 @@ class AssetsController extends Controller // Return error if no assets were found for the provided tags if ($assets->isEmpty()) { return response()->json(Helper::formatStandardApiResponse('error', null, - 'Asset does not exist.'), 404); + trans('admin/hardware/message.does_not_exist')), 404); } try { @@ -1287,14 +1287,14 @@ class AssetsController extends Controller return response()->json(Helper::formatStandardApiResponse('success', [ 'pdf' => $encoded_content - ], 'Labels were successfully generated.')); + ], trans('admin/hardware/message.labels_generated'))); } catch (\Exception $e) { return response()->json(Helper::formatStandardApiResponse('error', [ 'error_message' => $e->getMessage(), 'error_line' => $e->getLine(), 'error_file' => $e->getFile() - ], 'Error while generating labels.'), 500); + ], trans('admin/hardware/message.error_generating_labels')), 500); } } catch (\Exception $e) { return response()->json(Helper::formatStandardApiResponse('error', [ diff --git a/resources/lang/en-US/admin/hardware/message.php b/resources/lang/en-US/admin/hardware/message.php index df68f28395..222cbc439e 100644 --- a/resources/lang/en-US/admin/hardware/message.php +++ b/resources/lang/en-US/admin/hardware/message.php @@ -2,13 +2,16 @@ return [ - 'undeployable' => 'Warning: This asset has been marked as currently undeployable. If this status has changed, please update the asset status.', - 'does_not_exist' => 'Asset does not exist.', - 'does_not_exist_var'=> 'Asset with tag :asset_tag not found.', - 'no_tag' => 'No asset tag provided.', + 'undeployable' => 'Warning: This asset has been marked as currently undeployable. If this status has changed, please update the asset status.', + 'does_not_exist' => 'Asset does not exist.', + 'does_not_exist_var' => 'Asset with tag :asset_tag not found.', + 'no_tag' => 'No asset tag provided.', 'does_not_exist_or_not_requestable' => 'That asset does not exist or is not requestable.', - 'assoc_users' => 'This asset is currently checked out to a user and cannot be deleted. Please check the asset in first, and then try deleting again. ', + 'assoc_users' => 'This asset is currently checked out to a user and cannot be deleted. Please check the asset in first, and then try deleting again. ', 'warning_audit_date_mismatch' => 'This asset\'s next audit date (:next_audit_date) is before the last audit date (:last_audit_date). Please update the next audit date.', + 'labels_generated' => 'Labels were successfully generated.', + 'error_generating_labels' => 'Error while generating labels.', + 'no_assets_selected' => 'No assets selected.', 'create' => [ 'error' => 'Asset was not created, please try again. :(',