Basically need to generate custom(some different then yes no) messeges(alert) in JS , how to deal with translation in it?
+5
A:
Plese take a look at jQuery-i18n translation plugin
var my_dictionary = {
"some text" : "a translation",
"some more text" : "another translation"
}
$.i18n.setDictionary(my_dictionary);
$('div#example').text($.i18n._('some text'));
$.localise('js/greeting');
$('#greeting').val(greeting);
$('#languages').val($.localise.defaultLanguage);
$('#changeLocale').change(function() {
var newLang = $(this).val();
$.localise('js/greeting', {language: newLang, loadBase: true});
$('#greeting').val(greeting);
$('#languages').val(newLang);
});
Or, If you really want more translation than looking up data, try google translate api
google.language.translate("Hello world", "en", "es", function(result) {
if (!result.error) {
var container = document.getElementById("translation");
container.innerHTML = result.translation;
}
});
S.Mark
2010-03-04 06:44:36
+1 wow 3 answers in 1!
gWiz
2010-03-04 07:32:03