Flask-Babel 0.11+ compatibility. Fixes #1496

This commit is contained in:
Dave Page
2016-07-25 17:23:10 +01:00
parent 875360d1c8
commit 790b28fb61
11 changed files with 41 additions and 41 deletions

View File

@@ -159,7 +159,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
return false;
alertify.confirm(
S('{{ _('Are you sure you want to truncate table - %%s ?') }}').sprintf(d.label).value(),
S('{{ _('Are you sure you want to truncate table %s?') }}').sprintf(d.label).value(),
function (e) {
if (e) {
var data = d;
@@ -208,7 +208,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
return false;
alertify.confirm(
S('{{ _('Are you sure you want to reset table statistics - %%s ?') }}').sprintf(d.label).value(),
S('{{ _('Are you sure you want to reset table statistics for %s?') }}').sprintf(d.label).value(),
function (e) {
if (e) {
var data = d;

View File

@@ -110,7 +110,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
Alertify.confirm(
'{{ _('Disconnect the database') }}',
S('{{ _('Are you sure you want to disconnect the database - %%s ?') }}').sprintf(d.label).value(),
S('{{ _('Are you sure you want to disconnect the database - %s?') }}').sprintf(d.label).value(),
function(evt) {
var data = d;
$.ajax({

View File

@@ -181,8 +181,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
return false;
alertify.confirm(
'{{ _('Disconnect the server') }}',
S('{{ _('Are you sure you want to disconnect the server - %%s ?') }}').sprintf(d.label).value(),
'{{ _('Disconnect server') }}',
S('{{ _('Are you sure you want to disconnect the server %s?') }}').sprintf(d.label).value(),
function(evt) {
$.ajax({
url: obj.generate_url(i, 'connect', d, true),
@@ -260,7 +260,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
alertify.confirm(
'{{ _('Reload server configuration') }}',
S('{{ _('Are you sure you want to reload the server configuration on %%s?') }}').sprintf(d.label).value(),
S('{{ _('Are you sure you want to reload the server configuration on %s?') }}').sprintf(d.label).value(),
function(evt) {
$.ajax({
url: obj.generate_url(i, 'reload', d, true),

View File

@@ -117,7 +117,7 @@ function($, _, S, pgAdmin, Backbone, Alertify, Backform) {
Alertify.pgNotifier(
error, jqxhr,
S(
"{{ _("Error retrieving the properties - %%s.") }}"
"{{ _("Error retrieving properties: %s.") }}"
).sprintf(message).value()
);
});

View File

@@ -14,10 +14,10 @@ function(_, S, pgAdmin) {
'SQL_TAB': '{{ _('SQL') }}',
'SQL_INCOMPLETE': '{{ _('Incomplete definition') }}',
'SQL_NO_CHANGE': '-- ' + '{{ _('Nothing changed')|safe }}',
'MUST_BE_INT' : "{{ _("'%%s' must be an integer.")|safe }}",
'MUST_BE_NUM' : "{{ _("'%%s' must be a numeric.")|safe }}",
'MUST_GR_EQ' : "{{ _("'%%s' must be greater than or equal to %%d.")|safe }}",
'MUST_LESS_EQ' : "{{ _("'%%s' must be less than or equal to %%d.")|safe }}",
'MUST_BE_INT' : "{{ _("'%s' must be an integer.")|safe }}",
'MUST_BE_NUM' : "{{ _("'%s' must be a numeric.")|safe }}",
'MUST_GR_EQ' : "{{ _("'%s' must be greater than or equal to %d.")|safe }}",
'MUST_LESS_EQ' : "{{ _("'%s' must be less than or equal to %d.")|safe }}",
'STATISTICS_LABEL': "{{ _("Statistics") }}",
'STATISTICS_VALUE_LABEL': "{{ _("Value") }}",
'NODE_HAS_NO_SQL': "{{ _("No SQL could be generated for the selected object.") }}",

View File

@@ -126,7 +126,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
_.each(self.hasScriptTypes, function(stype) {
var type_label = S(
"{{ _("%%s Script") }}"
"{{ _("%s Script") }}"
).sprintf(stype.toUpperCase()).value(),
stype = stype.toLowerCase();
@@ -284,7 +284,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
Alertify.pgNotifier(
error, jqxhr,
S(
"{{ _("Error retrieving the properties - %%s.") }}"
"{{ _("Error retrieving properties: %s.") }}"
).sprintf(message).value()
);
});
@@ -437,7 +437,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
if (!d)
return;
l = S('{{ _("Create - %%s") }}').sprintf(
l = S('{{ _("Create - %s") }}').sprintf(
[this.label]).value();
p = addPanel();
@@ -454,14 +454,14 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
**/
var mode = p.$container.attr('action-mode');
if (mode) {
var msg = '{{ _('Are you sure want to stop editing the properties of the %%s - "%%s"?') }}';
var msg = '{{ _('Are you sure want to stop editing the properties of %s "%s"?') }}';
if (args.action == 'edit') {
msg = '{{ _('Are you sure want to reset the current changes and re-open the panel for %%s - "%%s"?') }}';
msg = '{{ _('Are you sure want to reset the current changes and re-open the panel for %s "%s"?') }}';
}
Alertify.confirm(
'{{ _('Edit in progress?') }}',
S(msg).sprintf(o.label, d.label).value(),
S(msg).sprintf(o.label.toLowerCase(), d.label).value(),
function() {
setTimeout(function() {
o.showProperties(i, d, p, args.action);
@@ -509,9 +509,9 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
var msg, title;
if (input.url == 'delete') {
msg = S('{{ _('Are you sure you want to drop %%s "%%s" and all the objects that depend on it?') }}')
.sprintf(obj.label, d.label).value();
title = S('{{ _('DROP CASCADE %%s?') }}').sprintf(obj.label).value();
msg = S('{{ _('Are you sure you want to drop %s "%s" and all the objects that depend on it?') }}')
.sprintf(obj.label.toLowerCase(), d.label).value();
title = S('{{ _('DROP CASCADE %s?') }}').sprintf(obj.label).value();
if (!(_.isFunction(obj.canDropCascade) ?
obj.canDropCascade.apply(obj, [d, i]) : obj.canDropCascade)) {
@@ -524,9 +524,9 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
return;
}
} else {
msg = S('{{ _('Are you sure you want to drop %%s "%%s"?') }}')
.sprintf(obj.label, d.label).value();
title = S('{{ _('DROP %%s?') }}').sprintf(obj.label).value();
msg = S('{{ _('Are you sure you want to drop %s "%s"?') }}')
.sprintf(obj.label.toLowerCase(), d.label).value();
title = S('{{ _('DROP %s?') }}').sprintf(obj.label).value();
if (!(_.isFunction(obj.canDrop) ?
obj.canDrop.apply(obj, [d, i]) : obj.canDrop)) {
@@ -572,7 +572,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
} catch (e) {}
}
pgBrowser.report_error(
S('{{ _('Error dropping %%s: "%%s"') }}')
S('{{ _('Error dropping %s: "%s"') }}')
.sprintf(obj.label, objName)
.value(), msg);
}
@@ -1057,7 +1057,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
Alertify.pgNotifier(
"error", jqxhr,
S(
"{{ _("Error saving properties: %%s") }}"
"{{ _("Error saving properties: %s") }}"
).sprintf(jqxhr.statusText).value()
);
}

View File

@@ -55,7 +55,7 @@ class BGProcessModule(PgAdminModule):
'EXECUTION_TIME': _('Execution time'),
'running': _('Running...'),
'successfully_finished': _("Successfully completed."),
'failed_with_exit_code': _("Failed (exit code: %%s).")
'failed_with_exit_code': _("Failed (exit code: %s).")
}

View File

@@ -249,7 +249,7 @@ msg = data.errormsg;
} catch (e) {}
}
pgBrowser.report_error(
S('{{ _('Error fetching sql for script: "%%s"') }}')
S('{{ _('Error fetching SQL for script: "%s"') }}')
.sprintf(msg)
.value(), msg);
}

View File

@@ -1076,7 +1076,7 @@ define([
alertify.pgNotifier(
"error", jqxhr,
S(
"{{ _('Error saving properties: %%s') }}"
"{{ _('Error saving properties: %s') }}"
).sprintf(jqxhr.statusText).value()
);

View File

@@ -482,7 +482,7 @@ define(
// Open the Alertify dialog for the import/export module
Alertify.ImportDialog(
S(
"{{ _("Import/Export data - table '%%s'") }}"
"{{ _("Import/Export data - table '%s'") }}"
).sprintf(treeInfo.table.label).value(), node, i, d
).set('resizable',true).resizeTo('70%','80%');
}

View File

@@ -167,14 +167,14 @@ define([
return errmsg;
} else if (!!this.get('email') && !email_filter.test(this.get('email'))) {
errmsg = S("{{ _("Invalid Email id: %%s")}}").sprintf(
errmsg = S("{{ _("Invalid email address: %s.")}}").sprintf(
this.get('email')
).value();
this.errorModel.set('email', errmsg);
return errmsg;
} else if (!!this.get('email') && this.collection.where({"email":this.get('email')}).length > 1) {
errmsg = S("{{ _("This email id %%s already exist.")}}").sprintf(
errmsg = S("{{ _("The email address %s already exists.")}}").sprintf(
this.get('email')
).value();
@@ -188,7 +188,7 @@ define([
_.isNull(this.get('role')) ||
String(this.get('role')).replace(/^\s+|\s+$/g, '') == '')) {
errmsg = S("{{ _("Role cannot be empty for user %%s")}}").sprintf(
errmsg = S("{{ _("Role cannot be empty for user %s.")}}").sprintf(
(this.get('email') || '')
).value();
@@ -204,7 +204,7 @@ define([
_.isNull(this.get('newPassword')) ||
this.get('newPassword') == '')) {
errmsg = S("{{ _("Password cannot be empty for user %%s")}}").sprintf(
errmsg = S("{{ _("Password cannot be empty for user %s.")}}").sprintf(
(this.get('email') || '')
).value();
@@ -214,7 +214,7 @@ define([
!_.isNull(this.get('newPassword')) &&
this.get('newPassword').length < 6) {
errmsg = S("{{ _("Password must be at least 6 characters for user %%s")}}").sprintf(
errmsg = S("{{ _("Password must be at least 6 characters for user %s.")}}").sprintf(
(this.get('email') || '')
).value();
@@ -228,7 +228,7 @@ define([
_.isNull(this.get('confirmPassword')) ||
this.get('confirmPassword') == '')) {
errmsg = S("{{ _("Confirm Password cannot be empty for user %%s")}}").sprintf(
errmsg = S("{{ _("Confirm Password cannot be empty for user %s.")}}").sprintf(
(this.get('email') || '')
).value();
@@ -241,7 +241,7 @@ define([
if(!!this.get('newPassword') && !!this.get('confirmPassword') &&
this.get('newPassword') != this.get('confirmPassword')) {
errmsg = S("{{ _("Passwords do not match for user %%s")}}").sprintf(
errmsg = S("{{ _("Passwords do not match for user %s.")}}").sprintf(
(this.get('email') || '')
).value();
@@ -271,7 +271,7 @@ define([
!this.get('newPassword') == '' &&
this.get('newPassword').length < 6) {
errmsg = S("{{ _("Password must be at least 6 characters for user %%s")}}").sprintf(
errmsg = S("{{ _("Password must be at least 6 characters for user %s.")}}").sprintf(
(this.get('email') || '')
).value();
@@ -281,7 +281,7 @@ define([
_.isNull(this.get('confirmPassword')) ||
this.get('confirmPassword') == '') {
errmsg = S("{{ _("Confirm password cannot be empty for user %%s")}}").sprintf(
errmsg = S("{{ _("Confirm Password cannot be empty for user %s.")}}").sprintf(
(this.get('email') || '')
).value();
@@ -290,7 +290,7 @@ define([
} else if (!!this.get('newPassword') && !!this.get('confirmPassword') &&
this.get('newPassword') != this.get('confirmPassword')) {
errmsg = S("{{ _("Passwords do not match for user %%s")}}").sprintf(
errmsg = S("{{ _("Passwords do not match for user %s.")}}").sprintf(
(this.get('email') || '')
).value();
@@ -513,14 +513,14 @@ define([
'confirmPassword':undefined});
m.startNewSession();
alertify.success(S("{{_("User '%%s' saved.")|safe }}").sprintf(
alertify.success(S("{{_("User '%s' saved.")|safe }}").sprintf(
m.get('email')
).value());
},
error: function(res, jqxhr) {
m.startNewSession();
alertify.error(
S("{{_("Error during saving user: '%%s'")|safe }}").sprintf(
S("{{_("Error saving user: '%s'")|safe }}").sprintf(
jqxhr.responseJSON.errormsg
).value()
);