How to translate the alert message displayed for validations

半腔热情 提交于 2019-12-12 04:47:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!