问题
I cannot find a way to translate the error messages that are displayed in the alert box when a set a max size validation.
回答1:
All messages and text in Fine Uploader are overridable. See the messages option in FineUploaderBasic mode, the messages option in FineUploader mode to override error and other related messages.
To override any other text, see the text option in FineUploaderBasic mode and the text option in FineUploader mode.
For example, if you want to customize the message that is display when a submitted item is too large, you would need to override the sizeError
property of the messages
option and your code may look something like this:
var uploader = new qq.FineUploader({
request: {
endpoint: 'my/endpoint'
},
validation: {
sizeLimit: 5000000
},
messages: {
sizeError: '{file} is far too big! Your files must be restricted to {sizeLimit} or smaller.'
}
});
The {file}
text will be replaced by Fine Uploader with the file name, and the {sizeLimit}
text will be replaced with the size limit you specified. If you have further questions about validation or customizing messages, please refer to the documentation.
来源:https://stackoverflow.com/questions/16965907/how-to-translate-the-alert-message-displayed-for-validations