Don't try to use the template engine's gettext on Javascript variables, as it won't work as the templates are evaluated before any JS is executed.

This commit is contained in:
Neel Patel 2016-04-18 08:39:25 -04:00 committed by Dave Page
parent 4f8b018b39
commit 37699a9820
3 changed files with 17 additions and 8 deletions

View File

@ -211,8 +211,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
try {
var err = $.parseJSON(xhr.responseText);
if (err.success == 0) {
msg = S('{{ _(' + err.errormsg + ')}}').value();
alertify.error("{{ _('" + err.errormsg + "') }}");
alertify.error(err.errormsg);
}
} catch (e) {}
}

View File

@ -151,13 +151,18 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
t.unload(i);
t.setInode(i);
}
else {
try {
Alertify.error(res.errormsg);
} catch (e) {}
t.unload(i);
}
},
error: function(xhr, status, error) {
try {
var err = $.parseJSON(xhr.responseText);
if (err.success == 0) {
msg = S('{{ _(' + err.errormsg + ')}}').value();
Alertify.error("{{ _('" + err.errormsg + "') }}");
Alertify.error(err.errormsg);
}
} catch (e) {}
t.unload(i);

View File

@ -87,7 +87,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
type:'DELETE',
success: function(res) {
if (res.success == 1) {
alertify.success("{{ _('" + res.info + "') }}");
alertify.success(res.info);
d = t.itemData(i);
t.removeIcon(i);
d.connected = false;
@ -99,13 +99,18 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
}
obj.trigger('server-disconnected', obj, i, d);
}
else {
try {
alertify.error(res.errormsg);
} catch (e) {}
t.unload(i);
}
},
error: function(xhr, status, error) {
try {
var err = $.parseJSON(xhr.responseText);
if (err.success == 0) {
msg = S('{{ _(' + err.errormsg + ')}}').value();
alertify.error("{{ _('" + err.errormsg + "') }}");
alertify.error(err.errormsg);
}
} catch (e) {}
t.unload(i);