I also needed an answer to this question. kbwood.au's gave me the right idea although his code didn't work for me (I don't think a JS variable can be called "delete"). I use jquery-ui-1.8.2. Here exactly how I did it.
In my HTML, I dumped the strings (in my code, it's not constants like I did here but code that finds the strings in the localization system):
<script>
var txtDelete = "supprimer";
var txtCancel = "annuler";
</script>
Then, in my JS file, I do this to launch the dialog:
var l10nButtons = {};
l10nButtons[txtDelete] = function() { $(this).dialog('close'); };
l10nButtons[txtCancel] = function() { $(this).dialog('close'); };
var deltxt = 'Delete texte';
$("#dialog-confirm").dialog({
resizable: false,
height:220,
width:500,
modal: true,
buttons: l10nButtons
});
Once the button array is created, I don't understand why you would use the "option" parameter. In fact, I'm not quite sure what "option" is for. But regardless, this works and my text is controllable from my HTML output, therefor, from my PHP code.