Jquery ui 具有多种语言的Jqueryui对话框

Jquery ui 具有多种语言的Jqueryui对话框,jquery-ui,jquery-ui-dialog,multilingual,Jquery Ui,Jquery Ui Dialog,Multilingual,例如,我使用jqueryui对话框插件 $( "#showUser-form" ).dialog( { buttons: { "OK": function() { $( this ).dialog( "close" );

例如,我使用jqueryui对话框插件

$( "#showUser-form" ).dialog(
                    {
                        buttons: {
                            "OK": function()
                            {
                                    $( this ).dialog( "close" );
                            },
                            cancel: function()
                            {
                                $( this ).dialog( "close" );
                            }
                        },
                        close: function() {}
                    });
我如何才能更改按钮“取消”的文本(例如多语言网站)

问候


Hugo

您必须创建一个包含按钮的新对象,并将其传递给
按钮
参数。然后可以动态设置按钮的文本

像这样:

//You can dynamically change button text here
var buttons = [,];
buttons['OK'] = 'OK :)';
buttons['Cancel'] = 'Cancel :(';

var buttonArray = {};
buttonArray[buttons['OK']] = function() {
    //Set OK function here
    $(this).dialog('close');
};
buttonArray[buttons['Cancel']] = function() {
    //Set Cancel function here
    $(this).dialog('close');
};


$(function () {
    $('#dialog').dialog({
        buttons: buttonArray
    });
});

谢谢你的帮助。我会尽快给你我的结果。