Externalized import/export errors strings + french translation

This commit is contained in:
Jérémy Gaulin 2016-03-20 22:22:36 +01:00
parent fd27a3df91
commit 8debdf023a
3 changed files with 28 additions and 8 deletions

View File

@ -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;

View File

@ -371,5 +371,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',
],
];

View File

@ -358,5 +358,13 @@ return [
'column_preview' => 'Prévisualisation des colonnes',
'file_not_found_error' => 'Fichier non trouvé',
'empty_error' => 'Il ny a aucune donnée à exporter',
'empty_import_columns_error' => 'Veuillez indiquer quelques colonnes à importer.',
'match_some_column_error' => 'Veuillez dabord 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 loption dexport "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',
],
];