Translate "Buttons" in jQuery UI Dialogs
Create the buttons object like this:
var myButtons = {};
myButtons[CLOSE] = function() { $(this).dialog('close'); };
if (data.status == 'success') {
options = {
buttons: myButtons
};
}
Edit: Updated to use the CLOSE variable.
There are two ways to specify buttons in a dialog (since 1.8.5). Only one of them is useful for internationalization. Define your options like this:
if (data.status == 'success') {
options = {
buttons: [{
text: CLOSE,
click: function() {
$(this).dialog('close');
}
}]
}
}
@dioslaska's solution works as well, but I think this way is prettier.