问题描述
我使用jQuery File Upload Basic Plus Ui来上传多个文件.我需要以多种语言(英语,法语和西班牙语)显示错误消息,但我不知道如何创建
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
}
多种语言以及如何声明
file.error = settings.i18n('acceptFileTypes');
在演示版本中,错误消息显示为正常.
With the demo version, the errors messages are displayed ok.
谢谢
推荐答案
以下是实例化文件上传插件的方法:
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'
}
});
});
如果此javascript是由服务器端代码生成的,则可以使用国际化API来获取正确的消息并将其替换为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
至:
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
这篇关于jQuery File Upload Basic Plus Ui和i18n的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!