如何翻译显示的警报消息以进行验证 [英] How to translate the alert message displayed for validations

查看:113
本文介绍了如何翻译显示的警报消息以进行验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设置最大大小验证时,我找不到转换警报框中显示的错误消息的方法.

I cannot find a way to translate the error messages that are displayed in the alert box when a set a max size validation.

推荐答案

Fine Uploader中的所有消息和文本都是可覆盖的.请参阅FineUploaderBasic模式下的 messages选项,在FineUploader模式下, messages选项可覆盖错误并其他相关消息.

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.

要覆盖其他任何文本,请参见 text选项在FineUploaderBasic模式下和FineUploader中的 text选项模式.

To override any other text, see the text option in FineUploaderBasic mode and the text option in FineUploader mode.

例如,如果要自定义提交的项目太大时显示的消息,则需要覆盖messages选项的sizeError属性,您的代码可能如下所示:

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.'
    }
});

{file}文本将被文件名Fine Uploader替换,而{sizeLimit}文本将被替换为您指定的大小限制.如果您对验证或自定义消息还有其他疑问,请参阅文档.

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.

这篇关于如何翻译显示的警报消息以进行验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆