2

I use jQuery File Upload Basic Plus Ui for a multiple upload files. I need to display error messages in multiples languages (English, French and Spanish) but I don’t know how to create

messages: {
      maxNumberOfFiles: 'Maximum number of files exceeded',
      acceptFileTypes: 'File type not allowed'
      maxFileSize: 'File is too large',
      minFileSize: 'File is too smal
}

in multiple languages and how to declare the language for

file.error = settings.i18n('acceptFileTypes');

With the demo version, the errors messages are displayed ok.

Thanks

1 Answer 1

6

Here is how to instanciate fileupload plugin :

$(document).ready(function() {
  $('#fileupload').fileupload({
     url: 'yoururl',
     acceptFileTypes: exttensionsRegex, 
     maxFileSize: yourmaxsize ,
     maxTotalFileSize: totalsize, 
     maxNumberOfFiles: numberoffiles , 
     messages: {
        maxNumberOfFiles: 'yourText',   
        acceptFileTypes: 'yourText' ,   
        maxFileSize:  'yourText',
        minFileSize:  'yourText'
     }
  });
});

If this javascript is generated by your server side code, then you can use the internationalization API to get the right messages and put them in place of yourText

As for :

file.error = settings.i18n('acceptFileTypes');

Actually you don't need to do anything, let it how it is and it would work.

I hope it can help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.