diff --git a/modules/backend/behaviors/ImportExportController.php b/modules/backend/behaviors/ImportExportController.php index 1663fadf0..8e0b9a9e2 100644 --- a/modules/backend/behaviors/ImportExportController.php +++ b/modules/backend/behaviors/ImportExportController.php @@ -209,12 +209,12 @@ class ImportExportController extends ControllerBehavior public function onImportLoadColumnSampleForm() { if (($columnId = post('file_column_id', false)) === false) { - throw new ApplicationException('Missing column identifier'); + throw new ApplicationException(Lang::get('backend::lang.import_export.missing_column_id_error')); } $columns = $this->getImportFileColumns(); if (!array_key_exists($columnId, $columns)) { - throw new ApplicationException('Unknown column'); + throw new ApplicationException(Lang::get('backend::lang.import_export.unknown_column_error')); } $path = $this->getImportFilePath(); @@ -281,7 +281,7 @@ class ImportExportController extends ControllerBehavior $columns = $this->makeListColumns($columnConfig); if (empty($columns)) { - throw new ApplicationException('Please specify some columns to import.'); + throw new ApplicationException(Lang::get('backend::lang.import_export.empty_import_columns_error')); } return $this->importColumns = $columns; @@ -352,7 +352,7 @@ class ImportExportController extends ControllerBehavior protected function checkRequiredImportColumns() { if (!$matches = post('column_match', [])) { - throw new ApplicationException('Please match some columns first.'); + throw new ApplicationException(Lang::get('backend::lang.import_export.match_some_column_error')); } $dbColumns = $this->getImportDbColumns(); @@ -368,7 +368,9 @@ class ImportExportController extends ControllerBehavior } if (!$found) { - throw new ApplicationException('Please specify a match for the required field '.$label.'.'); + throw new ApplicationException(Lang::get('backend::lang.import_export.required_match_column_error', [ + 'label' => Lang::get($label) + ])); } } } @@ -455,7 +457,7 @@ class ImportExportController extends ControllerBehavior $columns = $this->makeListColumns($columnConfig); if (empty($columns)) { - throw new ApplicationException('Please specify some columns to export.'); + throw new ApplicationException(Lang::get('backend::lang.import_export.empty_export_columns_error')); } return $this->exportColumns = $columns; @@ -524,7 +526,7 @@ class ImportExportController extends ControllerBehavior } if (!$this->controller->isClassExtendedWith('Backend.Behaviors.ListController')) { - throw new ApplicationException('You must implement the controller behavior ListController with the export "useList" option enabled.'); + throw new ApplicationException(Lang::get('backend::lang.import_export.behavior_missing_uselist_error')); } $this->exportFromList($listDefinition); @@ -656,7 +658,9 @@ class ImportExportController extends ControllerBehavior $modelClass = $this->getConfig($type.'[modelClass]'); if (!$modelClass) { - throw new ApplicationException('Please specify the modelClass property for '.$type); + throw new ApplicationException(Lang::get('backend::lang.import_export.missing_model_class_error', [ + 'type' => $type + ])); } return $this->{$cacheProperty} = new $modelClass; diff --git a/modules/backend/lang/en/lang.php b/modules/backend/lang/en/lang.php index 80fea9b74..ced813160 100644 --- a/modules/backend/lang/en/lang.php +++ b/modules/backend/lang/en/lang.php @@ -372,5 +372,13 @@ return [ 'column_preview' => 'Column preview', 'file_not_found_error' => 'File not found', 'empty_error' => 'There was no data supplied to export', + 'empty_import_columns_error' => 'Please specify some columns to import.', + 'match_some_column_error' => 'Please match some columns first.', + 'required_match_column_error' => 'Please specify a match for the required field :label.', + 'empty_export_columns_error' => 'Please specify some columns to export.', + 'behavior_missing_uselist_error' => 'You must implement the controller behavior ListController with the export "useList" option enabled.', + 'missing_model_class_error' => 'Please specify the modelClass property for :type', + 'missing_column_id_error' => 'Missing column identifier', + 'unknown_column_error' => 'Unknown column', ], ]; diff --git a/modules/backend/lang/fr/lang.php b/modules/backend/lang/fr/lang.php index 94b3c770b..e86a0ae84 100644 --- a/modules/backend/lang/fr/lang.php +++ b/modules/backend/lang/fr/lang.php @@ -358,5 +358,13 @@ return [ 'column_preview' => 'Prévisualisation des colonnes', 'file_not_found_error' => 'Fichier non trouvé', 'empty_error' => 'Il n‘y a aucune donnée à exporter', + 'empty_import_columns_error' => 'Veuillez indiquer quelques colonnes à importer.', + 'match_some_column_error' => 'Veuillez d’abord faire correspondre quelques colonnes.', + 'required_match_column_error' => 'Veuillez faire correspondre la colonne obligatoire :label.', + 'empty_export_columns_error' => 'Veuillez indiquer quelques colonnes à exporter.', + 'behavior_missing_uselist_error' => 'Vous devez implémenter le behavior ListController avec l’option d’export "useList" activée.', + 'missing_model_class_error' => 'Veuillez préciser la propriété modelClass pour :type', + 'missing_column_id_error' => 'Identifiant de colonne manquant', + 'unknown_column_error' => 'Colonne inconnue', ], ];