views:

17

answers:

2

Hi all:

Our legacy system use http://abeautifulsite.net/blog/2008/12/jquery-alert-dialogs/ as alert dialogs.

I want to localize the text of button on $.prompt(...), which is "Close" by default.

How can I do that? Thanks.

A: 

Assuming that you mean the "cancel" button,

$('#popup_cancel').val('Schliessen');
Alexander Gyoshev
A: 

Untested, Example

var Language = function()
{
    var _locale = 'en_US';
    var _langs = {}

    var SetLocale = function(locale){_locale = locale}

    var Add = function(k,v,locale)
    {
        //Add to _langs
    }
    var Get = function(key)
    {
        //Return the key out of _langs
    }
}

$.locale = new Language();
$.locale.SetLocale(navigator.language || navigator.userLanguage);

$.Add('cancel','Cancel','en_US');
$.Add('cancel','GermanCancel','es_GR');

$.prompt($.locale.Get('cancel'));

Some Resources:

http://plugins.jquery.com/project/jquery-localize

http://keith-wood.name/localisation.html

RobertPitt