Commit 7ea45e0a authored by Guillaume Perréal's avatar Guillaume Perréal

Correction du problème d'affichage des messages d'errreurs.

parent 801faf16
......@@ -49,6 +49,7 @@ class IrsteaFileUploadExtension extends Extension implements PrependExtensionInt
"$pluginDir/js/jquery.fileupload-ui.js",
"@BazingaJsTranslationBundle/Resources/js/translator.js",
'js/translations/file_upload/*.js',
'js/translations/validators/*.js',
'@IrsteaFileUploadBundle/Resources/js/widget/file_upload.js'
],
],
......
......@@ -143,7 +143,7 @@ class FileUploadType extends AbstractType
}
if ($options['max_number_of_files']) {
$range['max'] = $options['max_number_of_files'];
$range['maxMessage'] = 'file_upload.max_number_of_files';
$range['maxMessage'] = 'file_upload.maxNumberOfFiles';
}
if (!empty($range)) {
$constraints[] = new Count($range);
......
......@@ -60,13 +60,13 @@
error = '';
if (counts.upload > 0) {
error = Translator.trans('file_upload.running_upload');
error = Translator.trans('file_upload.runningUpload', null, 'validators');
} else if (counts.error > 0) {
error = Translator.trans('file_upload.upload_error');
error = Translator.trans('file_upload.uploadError', null, 'validators');
} else if (options.required && counts.download < 1) {
error = Translator.trans('file_upload.required_file');
error = Translator.trans('file_upload.required', null, 'validators');
}
input.setCustomValidity(error);
......@@ -111,7 +111,11 @@
downloadTemplateId: null,
filesContainer: $this.find('.fileinput-entries'),
dropZone: $this,
i18n: Translator.trans,
i18n: function(key, values, domain) {
return Translator.trans(key, values, domain || 'file_upload')
|| Translator.trans('file_upload.'+ key, values, 'validators')
|| Translator.trans(key, values, 'messages');
},
uploadTemplate: function (data) {
var rows = $();
$.each(data.files, function (index, file) {
......
'file_size(%size%,%unit%)': '%size% %unit%o'
unknownError: 'Erreur inconnue'
maxNumberOfFiles: 'Nombre maximum de fichiers dépassé'
acceptFileTypes: 'Type de fichier non autorisé'
maxFileSize: 'Le fichier est trop grand'
minFileSize: 'Le fichier est trop petit'
'Invalid CSRF Token': 'Token CSRF invalide, veuillez recharger la page.'
'Internal server error': 'Erreur interne du serveur'
form.description.placeholder: 'Description facultative'
form.max_number_of_files(%num%): '%num% fichiers maximum'
form.min_file_size: 'Taille minimale'
form.max_file_size: 'Taille maximale'
form:
description.placeholder: 'Description facultative'
max_number_of_files(%num%): '%num% fichiers maximum'
min_file_size: 'Taille minimale'
max_file_size: 'Taille maximale'
button.upload: 'Ajouter un fichier'
file_upload.required: Fichier requis
UploadedFile:
index:
title: Liste des fichiers
......
file_upload:
required: 'Fichier requis'
unknownError: 'Erreur inconnue'
maxNumberOfFiles: 'Nombre maximum de fichiers dépassé'
acceptFileTypes: 'Type de fichier non autorisé'
maxFileSize: 'Le fichier est trop grand'
minFileSize: 'Le fichier est trop petit'
runningUpload: 'Un téléchargement est en cours.'
uploadError: 'Un téléchargement a échoué.'
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