public inbox for [email protected]
help / color / mirror / Atom feedpgAdmin 4 - gettext usage fixes
5+ messages / 3 participants
[nested] [flat]
* pgAdmin 4 - gettext usage fixes
@ 2020-03-22 10:55 Libor M. <[email protected]>
0 siblings, 1 reply; 5+ messages in thread
From: Libor M. @ 2020-03-22 10:55 UTC (permalink / raw)
To: pgadmin-hackers
Hello,
I fixed using gettext function and add more usages for translations,
specifically:
- fixed usage gettext('') instead of _('') in javascript files
- fixed usage gettext('') instead of `${gettext('')}` in javascript
files, because "pybabel extract" not support extracting from this
syntax
- added a lot of gettext for support translations
Diff file is attached.
Best regards,
Libor M.
E-mail: [email protected]
GitHub: https://github.com/liborm85
Attachments:
[application/octet-stream] pgadmin4_gettext_fixes.diff (56.6K, 2-pgadmin4_gettext_fixes.diff)
download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py
index beaa65eb6..3c96c1051 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -1266,13 +1266,14 @@ class ServerNode(PGChildNodeView):
data={
'status': 1,
'result': gettext(
- 'Named restore point created: {0}'.format(
- restore_point_name))
+ 'Named restore point created: {0}').format(
+ restore_point_name)
})
except Exception as e:
- current_app.logger.error(
- 'Named restore point creation failed ({0})'.format(str(e))
+ current_app.logger.error(gettext(
+ 'Named restore point creation failed ({0})').format(
+ str(e))
)
return internal_server_error(errormsg=str(e))
diff --git a/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
index c012b9586..41cb0d0ac 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
@@ -50,7 +50,7 @@ class CastModule(CollectionNodeModule):
"""
NODE_TYPE = 'cast'
- COLLECTION_LABEL = 'Casts'
+ COLLECTION_LABEL = gettext('Casts')
def __init__(self, *args, **kwargs):
super(CastModule, self).__init__(*args, **kwargs)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger.js b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger.js
index 983389df6..add08f08a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger.js
@@ -111,10 +111,10 @@ define('pgadmin.node.event_trigger', [
id: 'enabled', label: gettext('Trigger enabled?'),
group: gettext('Definition'), mode: ['properties', 'edit','create'],
options: [
- {label: 'Enable', value: 'O'},
- {label: 'Disable', value: 'D'},
- {label: 'Replica', value: 'R'},
- {label: 'Always', value: 'A'},
+ {label: gettext('Enable'), value: 'O'},
+ {label: gettext('Disable'), value: 'D'},
+ {label: gettext('Replica'), value: 'R'},
+ {label: gettext('Always'), value: 'A'},
],
control: 'select2', select2: { allowClear: false, width: '100%' },
},{
@@ -125,9 +125,9 @@ define('pgadmin.node.event_trigger', [
id: 'eventname', label: gettext('Event'),
group: gettext('Definition'), cell: 'string',
options: [
- {label: 'DDL COMMAND START', value: 'DDL_COMMAND_START'},
- {label: 'DDL COMMAND END', value: 'DDL_COMMAND_END'},
- {label: 'SQL DROP', value: 'SQL_DROP'},
+ {label: gettext('DDL COMMAND START'), value: 'DDL_COMMAND_START'},
+ {label: gettext('DDL COMMAND END'), value: 'DDL_COMMAND_END'},
+ {label: gettext('SQL DROP'), value: 'SQL_DROP'},
],
control: 'select2', select2: { allowClear: false, width: '100%' },
},{
diff --git a/web/pgadmin/browser/server_groups/servers/databases/external_tables/properties.py b/web/pgadmin/browser/server_groups/servers/databases/external_tables/properties.py
index 88f20a15d..da1b2c5fc 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/external_tables/properties.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/external_tables/properties.py
@@ -52,8 +52,8 @@ class Properties:
execute_on_text = self.translate_execute_on_text(execute_on)
response = dict(
name=table_information_result['name'],
- type=gettext('readable' if not table_information_result[
- 'writable'] else 'writable'),
+ type=gettext('readable') if not table_information_result[
+ 'writable'] else gettext('writable'),
format_type=table_information_result['pg_encoding_to_char'],
format_options=table_information_result['fmtopts'],
external_options=table_information_result['options'],
@@ -65,14 +65,14 @@ class Properties:
@staticmethod
def translate_execute_on_text(execute_on):
if execute_on['type'] == 'host':
- return 'host %s' % execute_on['value']
+ return gettext('host %s') % execute_on['value']
elif execute_on['type'] == 'per_host':
- return 'per host'
+ return gettext('per host')
elif execute_on['type'] == 'master_only':
- return 'master segment'
+ return gettext('master segment')
elif execute_on['type'] == 'all_segments':
- return 'all segments'
+ return gettext('all segments')
elif execute_on['type'] == 'segment':
- return '%s segment' % execute_on['value']
+ return gettext('%s segment') % execute_on['value']
elif execute_on['type'] == 'segments':
- return '%d segments' % execute_on['value']
+ return gettext('%d segments') % execute_on['value']
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.js
index fd7e06cff..3c5c091ba 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.js
@@ -450,7 +450,7 @@ define('pgadmin.node.exclusion_constraint', [
titleTmpl = _.template([
'<div class="subnode-header">',
' <label class="control-label pg-el-sm-10"><%-label%></label>',
- ' <button class="btn btn-sm-sq btn-secondary add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%> title="' + _('Add new row') + '"></button>',
+ ' <button class="btn btn-sm-sq btn-secondary add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%> title="' + gettext('Add new row') + '"></button>',
'</div>'].join('\n')),
$gridBody =
$('<div class=\'pgadmin-control-group backgrid form-group col-12 object subnode\'></div>').append(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js
index 8695f8bd1..66083151f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js
@@ -378,7 +378,7 @@ define('pgadmin.node.foreign_key', [
titleTmpl = _.template([
'<div class="subnode-header">',
' <label class="control-label pg-el-sm-10"><%-label%></label>',
- ' <button class="btn btn-sm-sq btn-secondary add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%> title="' + _('Add new row') + '"></button>',
+ ' <button class="btn btn-sm-sq btn-secondary add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%> title="' + gettext('Add new row') + '"></button>',
'</div>'].join('\n')),
$gridBody =
$('<div class=\'pgadmin-control-group backgrid form-group col-12 object subnode\'></div>').append(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js
index 005242a4a..928342895 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js
@@ -71,12 +71,12 @@ function(
// To enable/disable all triggers for the table
name: 'enable_all_triggers', node: 'partition', module: this,
applies: ['object', 'context'], callback: 'enable_triggers_on_table',
- category: 'Trigger(s)', priority: 4, label: gettext('Enable All'),
+ category: gettext('Trigger(s)'), priority: 4, label: gettext('Enable All'),
icon: 'fa fa-check', enable : 'canCreate_with_trigger_enable',
},{
name: 'disable_all_triggers', node: 'partition', module: this,
applies: ['object', 'context'], callback: 'disable_triggers_on_table',
- category: 'Trigger(s)', priority: 4, label: gettext('Disable All'),
+ category: gettext('Trigger(s)'), priority: 4, label: gettext('Disable All'),
icon: 'fa fa-times', enable : 'canCreate_with_trigger_disable',
},{
name: 'reset_table_stats', node: 'partition', module: this,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js
index f197b6546..61761794f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js
@@ -82,23 +82,23 @@ define('pgadmin.node.table', [
},{
name: 'truncate_table', node: 'table', module: this,
applies: ['object', 'context'], callback: 'truncate_table',
- category: 'Truncate', priority: 3, label: gettext('Truncate'),
+ category: gettext('Truncate'), priority: 3, label: gettext('Truncate'),
icon: 'fa fa-eraser', enable : 'canCreate',
},{
name: 'truncate_table_cascade', node: 'table', module: this,
applies: ['object', 'context'], callback: 'truncate_table_cascade',
- category: 'Truncate', priority: 3, label: gettext('Truncate Cascade'),
+ category: gettext('Truncate'), priority: 3, label: gettext('Truncate Cascade'),
icon: 'fa fa-eraser', enable : 'canCreate',
},{
// To enable/disable all triggers for the table
name: 'enable_all_triggers', node: 'table', module: this,
applies: ['object', 'context'], callback: 'enable_triggers_on_table',
- category: 'Trigger(s)', priority: 4, label: gettext('Enable All'),
+ category: gettext('Trigger(s)'), priority: 4, label: gettext('Enable All'),
icon: 'fa fa-check', enable : 'canCreate_with_trigger_enable',
},{
name: 'disable_all_triggers', node: 'table', module: this,
applies: ['object', 'context'], callback: 'disable_triggers_on_table',
- category: 'Trigger(s)', priority: 4, label: gettext('Disable All'),
+ category: gettext('Trigger(s)'), priority: 4, label: gettext('Disable All'),
icon: 'fa fa-times', enable : 'canCreate_with_trigger_disable',
},{
name: 'reset_table_stats', node: 'table', module: this,
diff --git a/web/pgadmin/browser/server_groups/servers/static/js/variable.js b/web/pgadmin/browser/server_groups/servers/static/js/variable.js
index 329967e08..981582945 100644
--- a/web/pgadmin/browser/server_groups/servers/static/js/variable.js
+++ b/web/pgadmin/browser/server_groups/servers/static/js/variable.js
@@ -338,7 +338,7 @@ function(gettext, _, $, Backbone, Backform, Backgrid, Alertify, pgAdmin, pgNode)
titleTmpl = _.template([
'<div class=\'subnode-header\'>',
'<span class=\'control-label\'><%-label%></span>',
- '<button class=\'btn btn-sm-sq btn-secondary add fa fa-plus\' title=\'' + _('Add new row') + '\' <%=canAdd ? \'\' : \'disabled="disabled"\'%>><span class="sr-only">Add new row</span></button>',
+ '<button class=\'btn btn-sm-sq btn-secondary add fa fa-plus\' title=\'' + gettext('Add new row') + '\' <%=canAdd ? \'\' : \'disabled="disabled"\'%>><span class="sr-only">' + gettext('Add new row') + '</span></button>',
'</div>'].join('\n')),
$gridBody =
$('<div class=\'pgadmin-control-group backgrid form-group col-12 object subnode\'></div>').append(
diff --git a/web/pgadmin/browser/server_groups/servers/templates/servers/password.html b/web/pgadmin/browser/server_groups/servers/templates/servers/password.html
index afdfbfe96..9fc0b3945 100644
--- a/web/pgadmin/browser/server_groups/servers/templates/servers/password.html
+++ b/web/pgadmin/browser/server_groups/servers/templates/servers/password.html
@@ -15,7 +15,7 @@
<input class="custom-control-input" id="save_password" name="save_password" type="checkbox"
{% if not config.ALLOW_SAVE_PASSWORD %}disabled{% endif %}
>
- <label class="custom-control-label" for="save_password">Save Password</label>
+ <label class="custom-control-label" for="save_password">{{ _('Save Password') }}</label>
</div>
</div>
</div>
diff --git a/web/pgadmin/browser/server_groups/servers/templates/servers/tunnel_password.html b/web/pgadmin/browser/server_groups/servers/templates/servers/tunnel_password.html
index 5ae7d2fde..8724c8035 100644
--- a/web/pgadmin/browser/server_groups/servers/templates/servers/tunnel_password.html
+++ b/web/pgadmin/browser/server_groups/servers/templates/servers/tunnel_password.html
@@ -35,7 +35,7 @@
<input class="custom-control-input" id="save_password" name="save_password" type="checkbox"
{% if not config.ALLOW_SAVE_PASSWORD %}disabled{% endif %}
>
- <label class="custom-control-label" for="save_password" class="ml-1">Save Password</label>
+ <label class="custom-control-label" for="save_password" class="ml-1">{{ _('Save Password') }}</label>
</div>
</div>
</div>
diff --git a/web/pgadmin/browser/static/js/collection.js b/web/pgadmin/browser/static/js/collection.js
index e2e9c462e..2ec4fe1b5 100644
--- a/web/pgadmin/browser/static/js/collection.js
+++ b/web/pgadmin/browser/static/js/collection.js
@@ -183,7 +183,7 @@ define([
}
// Initialize a new Grid instance
that.grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: gridSchema.columns,
collection: that.collection,
className: 'backgrid table presentation table-bordered table-noouter-border table-hover',
diff --git a/web/pgadmin/browser/static/js/node.js b/web/pgadmin/browser/static/js/node.js
index 224caa33b..029a29817 100644
--- a/web/pgadmin/browser/static/js/node.js
+++ b/web/pgadmin/browser/static/js/node.js
@@ -216,7 +216,7 @@ define('pgadmin.browser.node', [
callback: 'show_script',
priority: 4,
label: type_label,
- category: 'Scripts',
+ category: gettext('Scripts'),
data: {
'script': stype,
},
diff --git a/web/pgadmin/browser/static/js/node.ui.js b/web/pgadmin/browser/static/js/node.ui.js
index 878497165..d81d8548b 100644
--- a/web/pgadmin/browser/static/js/node.ui.js
+++ b/web/pgadmin/browser/static/js/node.ui.js
@@ -113,7 +113,7 @@ define([
url_with_id: false,
select2: {
allowClear: true,
- placeholder: 'Select an item...',
+ placeholder: gettext('Select an item...'),
width: 'style',
},
}),
@@ -256,7 +256,7 @@ define([
},
select2: {
allowClear: true,
- placeholder: 'Select an item...',
+ placeholder: gettext('Select an item...'),
width: 'style',
templateResult: formatNode,
templateSelection: formatNode,
@@ -375,7 +375,7 @@ define([
url_with_id: false,
select2: {
allowClear: true,
- placeholder: 'Select an item...',
+ placeholder: gettext('Select an item...'),
width: 'style',
},
opt: {
@@ -510,7 +510,7 @@ define([
return res;
},
select2: {
- placeholder: 'Select an item...',
+ placeholder: gettext('Select an item...'),
width: 'style',
templateResult: formatNode,
templateSelection: formatNode,
@@ -555,7 +555,7 @@ define([
return res;
},
select2: {
- placeholder: 'Select an item...',
+ placeholder: gettext('Select an item...'),
width: 'style',
templateResult: formatNode,
templateSelection: formatNode,
@@ -570,7 +570,7 @@ define([
url_with_id: false,
select2: {
allowClear: true,
- placeholder: 'Select an item...',
+ placeholder: gettext('Select an item...'),
width: 'style',
multiple: true,
},
diff --git a/web/pgadmin/browser/templates/browser/master_password.html b/web/pgadmin/browser/templates/browser/master_password.html
index e1b95b1e2..763a9bcb1 100644
--- a/web/pgadmin/browser/templates/browser/master_password.html
+++ b/web/pgadmin/browser/templates/browser/master_password.html
@@ -2,7 +2,7 @@
<div>
<div><b>{{ content_text|safe }}</b></div>
<div class="input-group row py-2">
- <label for="password" class="col-sm-2 col-form-label">Password</label>
+ <label for="password" class="col-sm-2 col-form-label">{{ _('Password') }}</label>
<div class="col-sm-10">
<input type="password" class="form-control" id="password" name="password">
</div>
diff --git a/web/pgadmin/dashboard/static/js/dashboard.js b/web/pgadmin/dashboard/static/js/dashboard.js
index 61e71f076..6fc82546c 100644
--- a/web/pgadmin/dashboard/static/js/dashboard.js
+++ b/web/pgadmin/dashboard/static/js/dashboard.js
@@ -673,7 +673,7 @@ define('pgadmin.dashboard', [
// Set up the grid
var grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: columns,
collection: data,
className: 'backgrid presentation table table-bordered table-noouter-border table-hover',
diff --git a/web/pgadmin/dashboard/templates/dashboard/server_dashboard.html b/web/pgadmin/dashboard/templates/dashboard/server_dashboard.html
index 437b01ea0..2cceb4d86 100644
--- a/web/pgadmin/dashboard/templates/dashboard/server_dashboard.html
+++ b/web/pgadmin/dashboard/templates/dashboard/server_dashboard.html
@@ -87,7 +87,7 @@
<div class="input-group-prepend">
<span class="input-group-text fa fa-search" id="labelSearch"></span>
</div>
- <input type="search" class="form-control" id="txtGridSearch" placeholder="Search" aria-label="Search" aria-describedby="labelSearch">
+ <input type="search" class="form-control" id="txtGridSearch" placeholder="{{ _('Search') }}" aria-label="Search" aria-describedby="labelSearch">
</div>
<button id="btn_refresh" type="button" class="btn btn-secondary btn-navtab-inline" title="{{ _('Refresh') }}" aria-label="{{ _('Refresh') }}">
<span class="fa fa-refresh" aria-hidden="true"></span>
diff --git a/web/pgadmin/misc/bgprocess/static/js/bgprocess.js b/web/pgadmin/misc/bgprocess/static/js/bgprocess.js
index e63466a0e..f80a42599 100644
--- a/web/pgadmin/misc/bgprocess/static/js/bgprocess.js
+++ b/web/pgadmin/misc/bgprocess/static/js/bgprocess.js
@@ -311,8 +311,8 @@ define('misc.bgprocess', [
</div>
<div class="pg-bg-etime my-auto mr-2"></div>
<div class="ml-auto">
- <button class="btn btn-secondary pg-bg-more-details"><span class="fa fa-info-circle" role="img"></span> ${gettext('More details...')}</button>
- <button class="btn btn-danger bg-process-stop"><span class="fa fa-times-circle" role="img"></span> ${gettext('Stop Process')}</button>
+ <button class="btn btn-secondary pg-bg-more-details"><span class="fa fa-info-circle" role="img"></span> ` + gettext('More details...') + `</button>
+ <button class="btn btn-danger bg-process-stop"><span class="fa fa-times-circle" role="img"></span> ` + gettext('Stop Process') + `</button>
</div>
</div>
<div class="pg-bg-status py-1">
@@ -393,7 +393,7 @@ define('misc.bgprocess', [
is_new = true;
panel = this.panel =
pgBrowser.BackgroundProcessObsorver.create_panel();
- panel.title('Process Watcher - ' + self.type_desc);
+ panel.title(gettext('Process Watcher - %s', self.type_desc));
panel.focus();
}
@@ -419,7 +419,7 @@ define('misc.bgprocess', [
setTimeout(function() {
self.logs[0].scrollTop = self.logs[0].scrollHeight;
});
- self.logs_loading = $(`<li class="pg-bg-res-out loading-logs">${gettext('Loading process logs...')}</li>`);
+ self.logs_loading = $('<li class="pg-bg-res-out loading-logs">' + gettext('Loading process logs...') + '</li>');
self.logs.append(self.logs_loading);
// set bgprocess detailed description
$header.find('.bg-detailed-desc').html(self.detailed_desc);
diff --git a/web/pgadmin/misc/dependencies/static/js/dependencies.js b/web/pgadmin/misc/dependencies/static/js/dependencies.js
index f59c2c565..bab26019f 100644
--- a/web/pgadmin/misc/dependencies/static/js/dependencies.js
+++ b/web/pgadmin/misc/dependencies/static/js/dependencies.js
@@ -75,7 +75,7 @@ define('misc.dependencies', [
var $container = this.dependenciesPanel.layout().scene().find('.pg-panel-content'),
$gridContainer = $container.find('.pg-panel-dependencies-container'),
grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: [{
name: 'type',
label: gettext('Type'),
diff --git a/web/pgadmin/misc/dependents/static/js/dependents.js b/web/pgadmin/misc/dependents/static/js/dependents.js
index 357198084..5f6007f1d 100644
--- a/web/pgadmin/misc/dependents/static/js/dependents.js
+++ b/web/pgadmin/misc/dependents/static/js/dependents.js
@@ -76,7 +76,7 @@ define('misc.dependents', [
var $container = this.dependentsPanel.layout().scene().find('.pg-panel-content'),
$gridContainer = $container.find('.pg-panel-dependents-container'),
grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: [{
name: 'type',
label: gettext('Type'),
diff --git a/web/pgadmin/misc/file_manager/static/js/utility.js b/web/pgadmin/misc/file_manager/static/js/utility.js
index 2cc1aba87..04060b77d 100644
--- a/web/pgadmin/misc/file_manager/static/js/utility.js
+++ b/web/pgadmin/misc/file_manager/static/js/utility.js
@@ -1258,12 +1258,12 @@ define([
}
select_box = `<div class='change_file_types d-flex align-items-center p-1'>
- <div>
- ${gettext('Show hidden files and folders')}?
- <input type='checkbox' id='show_hidden' onclick='pgAdmin.FileUtils.handleClick(this)' tabindex='0'>
+ <div>` +
+ gettext('Show hidden files and folders?') +
+ `<input type='checkbox' id='show_hidden' onclick='pgAdmin.FileUtils.handleClick(this)' tabindex='0'>
</div>
<div class="ml-auto">
- <label class="my-auto">${gettext('Format')}</label>
+ <label class="my-auto">` + gettext('Format') + `</label>
<select name='type' tabindex='0'>${fileFormats}</select>
<div>`;
}
diff --git a/web/pgadmin/misc/statistics/static/js/statistics.js b/web/pgadmin/misc/statistics/static/js/statistics.js
index 657d47463..ebce79265 100644
--- a/web/pgadmin/misc/statistics/static/js/statistics.js
+++ b/web/pgadmin/misc/statistics/static/js/statistics.js
@@ -282,7 +282,7 @@ define('misc.statistics', [
}
self.grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: self.columns,
collection: self.collection,
className: GRID_CLASSES,
diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js
index a44d1a83a..a57f70ebc 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -609,11 +609,11 @@ define([
if(this.$el.find('.toggle.btn').hasClass('off')) {
this.$el.find('.sr-value').text(`
- ${label}, ${offText}, ${gettext('Toggle button')}
+ ${label}, ${offText}, ` + gettext('Toggle button') + `
`);
} else {
this.$el.find('.sr-value').text(`
- ${label}, ${onText}, ${gettext('Toggle button')}
+ ${label}, ${onText}, ` + gettext('Toggle button') + `
`);
}
},
@@ -1295,7 +1295,7 @@ define([
gridHeader = _.template([
'<div class="subnode-header">',
' <span class="control-label pg-el-sm-10" id="<%=cId%>"><%-label%></span>',
- ' <button aria-label="' + _('Add new row') + '" class="btn btn-sm-sq btn-secondary add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%> title="' + _('Add new row') + '"><%-add_label%></button>',
+ ' <button aria-label="' + gettext('Add new row') + '" class="btn btn-sm-sq btn-secondary add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%> title="' + gettext('Add new row') + '"><%-add_label%></button>',
'</div>',
].join('\n')),
gridBody = $('<div class="pgadmin-control-group backgrid form-group pg-el-12 object subnode "></div>').append(
@@ -1582,7 +1582,7 @@ define([
var self = this,
gridHeader = ['<div class=\'subnode-header\'>',
' <span class=\'control-label pg-el-sm-10\'>' + data.label + '</span>',
- ' <button aria-label="' + _('Add') + '" class=\'btn btn-sm-sq btn-secondary add fa fa-plus\' title=\'' + _('Add new row') + '\'></button>',
+ ' <button aria-label="' + gettext('Add') + '" class=\'btn btn-sm-sq btn-secondary add fa fa-plus\' title=\'' + gettext('Add new row') + '\'></button>',
'</div>',
].join('\n'),
gridBody = $('<div class=\'pgadmin-control-group backgrid form-group pg-el-12 object subnode\'></div>').append(gridHeader);
diff --git a/web/pgadmin/static/js/backgrid.pgadmin.js b/web/pgadmin/static/js/backgrid.pgadmin.js
index a64897b20..230d7ce56 100644
--- a/web/pgadmin/static/js/backgrid.pgadmin.js
+++ b/web/pgadmin/static/js/backgrid.pgadmin.js
@@ -432,7 +432,7 @@ define([
if (editable) {
this.$el.html(
- '<i class=\'fa fa-pencil-square subnode-edit-in-process\' title=\'' + _('Edit row') + '\' aria-label=\'' + _('Edit row') + '\'></i>'
+ '<i class=\'fa fa-pencil-square subnode-edit-in-process\' title=\'' + gettext('Edit row') + '\' aria-label=\'' + gettext('Edit row') + '\'></i>'
);
let body = $(this.$el).parents()[1],
container = $(body).find('.tab-content:first > .tab-pane.active:first');
@@ -451,7 +451,7 @@ define([
},
render: function() {
this.$el.empty();
- this.$el.html('<i class=\'fa fa-pencil-square-o\' title=\'' + _('Edit row') + '\' aria-label=\'' + _('Edit row') + '\'></i>');
+ this.$el.html('<i class=\'fa fa-pencil-square-o\' title=\'' + gettext('Edit row') + '\' aria-label=\'' + gettext('Edit row') + '\'></i>');
this.delegateEvents();
if (this.grabFocus)
this.$el.trigger('focus');
@@ -555,7 +555,7 @@ define([
var self = this;
this.$el.empty();
$(this.$el).attr('tabindex', 0);
- this.$el.html('<i aria-label="' + _('Delete row') + '" class=\'fa fa-trash\' title=\'' + _('Delete row') + '\'></i>');
+ this.$el.html('<i aria-label="' + gettext('Delete row') + '" class=\'fa fa-trash\' title=\'' + gettext('Delete row') + '\'></i>');
// Listen for Tab/Shift-Tab key
this.$el.on('keydown', function(e) {
// with keyboard navigation on space key, mark row for deletion
diff --git a/web/pgadmin/static/js/keyboard_shortcuts.js b/web/pgadmin/static/js/keyboard_shortcuts.js
index 5ba9b271a..fba3c9fb8 100644
--- a/web/pgadmin/static/js/keyboard_shortcuts.js
+++ b/web/pgadmin/static/js/keyboard_shortcuts.js
@@ -87,7 +87,7 @@ function shortcut_title(title, shortcut) {
* shortcut object is browser.get_preference().value
*/
function shortcut_accesskey_title(title, shortcut) {
- return `${title} (${gettext('accesskey')} + ${shortcut_key(shortcut)})`;
+ return `${title} (` + gettext('accesskey') + ` + ${shortcut_key(shortcut)})`;
}
diff --git a/web/pgadmin/static/js/sqleditor/calculate_query_run_time.js b/web/pgadmin/static/js/sqleditor/calculate_query_run_time.js
index f66629e55..5c7474339 100644
--- a/web/pgadmin/static/js/sqleditor/calculate_query_run_time.js
+++ b/web/pgadmin/static/js/sqleditor/calculate_query_run_time.js
@@ -8,6 +8,7 @@
//////////////////////////////////////////////////////////////
import moment from 'moment';
+import gettext from 'sources/gettext';
export function calculateQueryRunTime(startTime, endTime) {
let total_ms = moment(endTime).diff(startTime);
@@ -26,9 +27,9 @@ export function calculateQueryRunTime(startTime, endTime) {
hrs = parseInt(mins/60);
mins = mins%60;
- result = (hrs>0 ? hrs + ' hr ': '')
- + (mins>0 ? mins + ' min ': '')
- + (hrs<=0 && secs>0 ? secs + ' secs ': '')
- + (hrs<=0 && mins<=0 ? total_ms + ' msec ':'');
+ result = (hrs>0 ? hrs + ' ' + gettext('hr') + ' ': '')
+ + (mins>0 ? mins + ' ' + gettext('min') + ' ': '')
+ + (hrs<=0 && secs>0 ? secs + ' ' + gettext('secs') + ' ': '')
+ + (hrs<=0 && mins<=0 ? total_ms + ' ' + gettext('msec') + ' ':'');
return result.trim();
}
diff --git a/web/pgadmin/static/js/sqleditor/filter_dialog.js b/web/pgadmin/static/js/sqleditor/filter_dialog.js
index a060ce487..0ca1fed66 100644
--- a/web/pgadmin/static/js/sqleditor/filter_dialog.js
+++ b/web/pgadmin/static/js/sqleditor/filter_dialog.js
@@ -139,7 +139,7 @@ let FilterDialog = {
`<div id="show_filter_progress" class="pg-sp-container sql-editor-busy-fetching d-none">
<div class="pg-sp-content">
<div class="row"><div class="col-12 pg-sp-icon sql-editor-busy-icon"></div></div>
- <div class="row"><div class="col-12 pg-sp-text sql-editor-busy-text">${gettext('Loading data...')}</div></div>
+ <div class="row"><div class="col-12 pg-sp-text sql-editor-busy-text">` + gettext('Loading data...') + `</div></div>
</div>
</div>`
).appendTo($container);
diff --git a/web/pgadmin/static/js/sqleditor/history/query_history.js b/web/pgadmin/static/js/sqleditor/history/query_history.js
index 2e4228058..c171f7fbe 100644
--- a/web/pgadmin/static/js/sqleditor/history/query_history.js
+++ b/web/pgadmin/static/js/sqleditor/history/query_history.js
@@ -59,9 +59,9 @@ export default class QueryHistory {
this.parentNode.empty()
.removeClass('d-flex')
.append(
- `<div role="status" class='pg-panel-message'>${gettext(
- 'No history found'
- )}</div>`
+ '<div role="status" class="pg-panel-message">' +
+ gettext('No history found') +
+ '</div>'
);
} else {
this.parentNode.empty().addClass('d-flex');
diff --git a/web/pgadmin/static/js/sqleditor/history/query_history_details.js b/web/pgadmin/static/js/sqleditor/history/query_history_details.js
index 626e89b5a..8a884da00 100644
--- a/web/pgadmin/static/js/sqleditor/history/query_history_details.js
+++ b/web/pgadmin/static/js/sqleditor/history/query_history_details.js
@@ -87,10 +87,10 @@ export default class QueryHistoryDetails {
updateCopyButton(copied) {
if (copied) {
this.$copyBtn.addClass('was-copied').removeClass('copy-all');
- this.$copyBtn.text('Copied!');
+ this.$copyBtn.text(gettext('Copied!'));
} else {
this.$copyBtn.addClass('copy-all').removeClass('was-copied');
- this.$copyBtn.text('Copy');
+ this.$copyBtn.text(gettext('Copy'));
}
}
@@ -106,14 +106,14 @@ export default class QueryHistoryDetails {
};
this.$metaData.empty().append(
- `<div class='metadata'>
- ${itemTemplate(this.formatDate(this.entry.start_time), 'Date')}
- ${itemTemplate(
- this.entry.row_affected.toLocaleString(),
- 'Rows Affected'
- )}
- ${itemTemplate(this.entry.total_time, 'Duration')}
- </div>`
+ '<div class="metadata">' +
+ itemTemplate(this.formatDate(this.entry.start_time), gettext('Date')) +
+ itemTemplate(
+ this.entry.row_affected.toLocaleString(),
+ gettext('Rows Affected')
+ ) +
+ itemTemplate(this.entry.total_time, gettext('Duration')) +
+ '</div>'
);
}
@@ -179,7 +179,7 @@ export default class QueryHistoryDetails {
</div>
<div class='message-block'>
<div class='message'>
- <div class='message-header'>Messages</div>
+ <div class='message-header'>` + gettext('Messages') + `</div>
<div class='content'></div>
</div>
</div>
diff --git a/web/pgadmin/static/js/sqleditor/history/query_history_entries.js b/web/pgadmin/static/js/sqleditor/history/query_history_entries.js
index fcc20812e..8e58dc5aa 100644
--- a/web/pgadmin/static/js/sqleditor/history/query_history_entries.js
+++ b/web/pgadmin/static/js/sqleditor/history/query_history_entries.js
@@ -252,11 +252,11 @@ export class QueryHistoryEntries {
<div class="toggle-and-history-container">
<div class="query-history-toggle">
<label class="control-label">
- ${gettext('Show queries generated internally by pgAdmin')}?
+ ` + gettext('Show queries generated internally by pgAdmin?') + `
</label>
<input id="generated-queries-toggle" type="checkbox"
class="pgadmin-controls" data-style="quick"
- data-size="mini" data-on="${gettext('Yes')}" data-off="${gettext('No')}"
+ data-size="mini" data-on="` + gettext('Yes') + '" data-off="' + gettext('No') + `"
data-onstyle="success" data-offstyle="ternary" checked>
</div>
<div id='query_list' class='query-history' tabindex='0'></div>
diff --git a/web/pgadmin/static/js/sqleditor/query_tool_notifications.js b/web/pgadmin/static/js/sqleditor/query_tool_notifications.js
index cc01aa17a..aec3b6690 100644
--- a/web/pgadmin/static/js/sqleditor/query_tool_notifications.js
+++ b/web/pgadmin/static/js/sqleditor/query_tool_notifications.js
@@ -97,7 +97,7 @@ let queryToolNotifications = {
// Set up the grid
let notifications_grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: gridCols,
collection: queryToolNotifications.collection,
className: 'backgrid presentation table table-bordered table-hover table-noouter-border table-bottom-border',
diff --git a/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js b/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js
index ba87a3130..d59256205 100644
--- a/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js
+++ b/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js
@@ -10,6 +10,7 @@
import {getTreeNodeHierarchyFromElement} from '../../../../static/js/tree/pgadmin_tree_node';
import axios from 'axios/index';
import gettext from '../../../../static/js/gettext';
+import {sprintf} from 'sources/utils';
import url_for from '../../../../static/js/url_for';
import _ from 'underscore';
import {DialogWrapper} from '../../../../static/js/alertify/dialog_wrapper';
@@ -98,7 +99,7 @@ export class BackupDialogWrapper extends DialogWrapper {
const node = this.pgBrowser.Nodes[selectedTreeNodeData._type];
if (this.dialogTitle === null) {
- const title = `Backup (${node.label}: ${selectedTreeNodeData.label})`;
+ let title = sprintf(gettext('Backup (%s: %s)'), node.label, selectedTreeNodeData.label);
this.main(title);
}
diff --git a/web/pgadmin/tools/debugger/static/js/direct.js b/web/pgadmin/tools/debugger/static/js/direct.js
index 90493f357..179ded6c9 100644
--- a/web/pgadmin/tools/debugger/static/js/direct.js
+++ b/web/pgadmin/tools/debugger/static/js/direct.js
@@ -1047,7 +1047,7 @@ define([
// Initialize a new Grid instance
var stack_grid = this.stack_grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: stackGridCols,
row: Backgrid.Row.extend({
events: {
@@ -1112,7 +1112,7 @@ define([
// Initialize a new Grid instance
var result_grid = this.result_grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: resultGridCols,
collection: new ResultsCollection(result),
className: 'backgrid table table-bordered table-noouter-border table-bottom-border',
@@ -1190,7 +1190,7 @@ define([
// Initialize a new Grid instance
var variable_grid = this.variable_grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: gridCols,
collection: new VariablesCollection(my_obj),
className: 'backgrid table table-bordered table-noouter-border table-bottom-border',
@@ -1276,7 +1276,7 @@ define([
// Initialize a new Grid instance
var param_grid = this.param_grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: paramGridCols,
collection: new ParametersCollection(param_obj),
className: 'backgrid table table-bordered table-noouter-border table-bottom-border',
diff --git a/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js b/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js
index e5f50fc7d..763edef57 100644
--- a/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js
+++ b/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js
@@ -251,7 +251,7 @@ define([
DbObjectFilter: function(coll) {
var clientSideFilter = this.clientSideFilter = new Backgrid.Extension.ClientSideFilter({
collection: coll,
- placeholder: _('Search by object type or name'),
+ placeholder: gettext('Search by object type or name'),
// The model fields to search for matches
fields: ['object_type', 'name'],
@@ -697,11 +697,11 @@ define([
*/
var dbObjectTypePage = self.dbObjectTypePage = new pgBrowser.WizardPage({
id: 1,
- page_title: _('Object Selection (step 1 of 3)'),
+ page_title: gettext('Object Selection (step 1 of 3)'),
disable_prev: true,
disable_next: true,
show_description: '',
- show_progress_bar: _('Please wait while fetching records...'),
+ show_progress_bar: gettext('Please wait while fetching records...'),
model: newModel,
view: new(function() {
@@ -735,13 +735,13 @@ define([
$(`
<div class="db_objects_container pg-el-xs-12">
<div class="db_objects_header d-flex py-1">
- <div>${_('Please select the objects to grant privileges to from the list below.')}</div>
+ <div>` + gettext('Please select the objects to grant privileges to from the list below.') + `</div>
<div class="db_objects_filter ml-auto">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text fa fa-search" id="labelSearch"></span>
</div>
- <input type="search" class="form-control" id="txtGridSearch" placeholder="Search" aria-label="Search" aria-describedby="labelSearch">
+ <input type="search" class="form-control" id="txtGridSearch" placeholder="` + gettext('Search') + `" aria-label="Search" aria-describedby="labelSearch">
</div>
</div>
</div>
@@ -822,8 +822,8 @@ define([
// Wizard for Privelege control
var privilegePage = self.privilegePage = new pgBrowser.WizardPage({
id: 2,
- page_title: _('Privilege Selection (step 2 of 3)'),
- show_description: _('Please add the required privileges for the selected objects.'),
+ page_title: gettext('Privilege Selection (step 2 of 3)'),
+ show_description: gettext('Please add the required privileges for the selected objects.'),
disable_next: true,
model: newModel,
@@ -1021,7 +1021,7 @@ define([
//Create SqlField Object
var sqlField = new Backform.Field({
id: 'sqltab',
- label: _('Sql Tab'),
+ label: gettext('Sql Tab'),
/**
Extend 'SqlTabControl' to define new
@@ -1091,8 +1091,8 @@ define([
// Wizard for SQL tab control
var reviewSQLPage = self.reviewSQLPage = new pgBrowser.WizardPage({
id: 3,
- page_title: _('Final (Review Selection) (step 3 of 3)'),
- show_description: _('The SQL below will be executed on the ' +
+ page_title: gettext('Final (Review Selection) (step 3 of 3)'),
+ show_description: gettext('The SQL below will be executed on the ' +
'database server to grant the selected privileges. ' +
'Please click on <b>Finish</b> to complete the process.'),
model: newModel,
@@ -1151,7 +1151,7 @@ define([
*/
self.wizard = new(pgBrowser.Wizard.extend({
options: {
- title: _('Grant Wizard'),
+ title: gettext('Grant Wizard'),
/* Main Wizard Title */
width: '',
height: '',
diff --git a/web/pgadmin/tools/maintenance/__init__.py b/web/pgadmin/tools/maintenance/__init__.py
index 3b3651e9e..d19e32d30 100644
--- a/web/pgadmin/tools/maintenance/__init__.py
+++ b/web/pgadmin/tools/maintenance/__init__.py
@@ -266,7 +266,7 @@ def create_maintenance_job(sid, did):
# Return response
return make_json_response(
data={'job_id': jid, 'status': True,
- 'info': 'Maintenance job created.'}
+ 'info': _('Maintenance job created.')}
)
diff --git a/web/pgadmin/tools/schema_diff/__init__.py b/web/pgadmin/tools/schema_diff/__init__.py
index 23e190ce0..e170deb03 100644
--- a/web/pgadmin/tools/schema_diff/__init__.py
+++ b/web/pgadmin/tools/schema_diff/__init__.py
@@ -36,7 +36,7 @@ class SchemaDiffModule(PgAdminModule):
A module class for Schema Diff derived from PgAdminModule.
"""
- LABEL = "Schema Diff"
+ LABEL = gettext("Schema Diff")
def get_own_menuitems(self):
return {}
@@ -439,7 +439,7 @@ def compare(trans_id, source_sid, source_did, source_scid,
comparison_result = []
- diff_model_obj.set_comparison_info("Comparing objects...", 0)
+ diff_model_obj.set_comparison_info(gettext("Comparing objects..."), 0)
update_session_diff_transaction(trans_id, session_obj,
diff_model_obj)
@@ -451,7 +451,7 @@ def compare(trans_id, source_sid, source_did, source_scid,
for node_name, node_view in all_registered_nodes.items():
view = SchemaDiffRegistry.get_node_view(node_name)
if hasattr(view, 'compare'):
- msg = "Comparing " + view.blueprint.COLLECTION_LABEL
+ msg = gettext('Comparing {0}').format(gettext(view.blueprint.COLLECTION_LABEL))
diff_model_obj.set_comparison_info(msg, total_percent)
# Update the message and total percentage in session object
update_session_diff_transaction(trans_id, session_obj,
@@ -468,7 +468,7 @@ def compare(trans_id, source_sid, source_did, source_scid,
comparison_result = comparison_result + res
total_percent = total_percent + node_percent
- msg = "Successfully compare the specified schemas."
+ msg = gettext("Successfully compare the specified schemas.")
total_percent = 100
diff_model_obj.set_comparison_info(msg, total_percent)
# Update the message and total percentage done in session object
@@ -501,7 +501,7 @@ def poll(trans_id):
msg, diff_percentage = diff_model_obj.get_comparison_info()
if diff_percentage == 100:
- diff_model_obj.set_comparison_info("Comparing objects...", 0)
+ diff_model_obj.set_comparison_info(gettext("Comparing objects..."), 0)
update_session_diff_transaction(trans_id, session_obj,
diff_model_obj)
diff --git a/web/pgadmin/tools/schema_diff/compare.py b/web/pgadmin/tools/schema_diff/compare.py
index 40d4382bb..7459b849b 100644
--- a/web/pgadmin/tools/schema_diff/compare.py
+++ b/web/pgadmin/tools/schema_diff/compare.py
@@ -12,6 +12,7 @@
import copy
from flask import render_template
+from flask_babelex import gettext
from pgadmin.utils.driver import get_driver
from config import PG_DEFAULT_DRIVER
from pgadmin.utils.ajax import internal_server_error
@@ -86,7 +87,7 @@ class SchemaDiffObjectCompare:
return compare_dictionaries(self, source_params, target_params,
target_schema, source, target,
self.node_type,
- self.blueprint.COLLECTION_LABEL,
+ gettext(self.blueprint.COLLECTION_LABEL),
self.keys_to_ignore)
def ddl_compare(self, **kwargs):
diff --git a/web/pgadmin/tools/schema_diff/model.py b/web/pgadmin/tools/schema_diff/model.py
index 499ecca15..7ab3318e0 100644
--- a/web/pgadmin/tools/schema_diff/model.py
+++ b/web/pgadmin/tools/schema_diff/model.py
@@ -7,6 +7,7 @@
#
##########################################################################
+from flask_babelex import gettext
class SchemaDiffModel(object):
"""
@@ -30,7 +31,7 @@ class SchemaDiffModel(object):
**kwargs : N number of parameters
"""
self._comparison_result = dict()
- self._comparison_msg = 'Comparision started...'
+ self._comparison_msg = gettext('Comparision started...')
self._comparison_percentage = 0
def clear_data(self):
diff --git a/web/pgadmin/tools/schema_diff/static/js/schema_diff.backform.js b/web/pgadmin/tools/schema_diff/static/js/schema_diff.backform.js
index ae3a7eebb..4af8857b2 100644
--- a/web/pgadmin/tools/schema_diff/static/js/schema_diff.backform.js
+++ b/web/pgadmin/tools/schema_diff/static/js/schema_diff.backform.js
@@ -289,11 +289,11 @@ let SchemaDiffHeaderView = Backform.Form.extend({
},
template: _.template(`
<div class="row pgadmin-control-group">
- <div class="col-1 control-label">Select Source</div>
+ <div class="col-1 control-label">` + gettext('Select Source') + `</div>
<div class="col-6 source row"></div>
</div>
<div class="row pgadmin-control-group">
- <div class="col-1 control-label">Select Target</div>
+ <div class="col-1 control-label">` + gettext('Select Target') + `</div>
<div class="col-6 target row"></div>
<div class="col-5 target-buttons">
<div class="action-btns d-flex">
@@ -421,9 +421,9 @@ let SchemaDiffFooterView = Backform.Form.extend({
template: {
'content': _.template(`
<div class="pg-el-sm-12 row <%=contentClass%>">
- <div class="pg-el-sm-4 ddl-source">Source</div>
- <div class="pg-el-sm-4 ddl-target">Target</div>
- <div class="pg-el-sm-4 ddl-diff">Difference
+ <div class="pg-el-sm-4 ddl-source">` + gettext('Source') + `</div>
+ <div class="pg-el-sm-4 ddl-target">` + gettext('Target') + `</div>
+ <div class="pg-el-sm-4 ddl-diff">` + gettext('Difference') + `
</div>
</div>
</div>
diff --git a/web/pgadmin/tools/schema_diff/static/js/schema_diff.js b/web/pgadmin/tools/schema_diff/static/js/schema_diff.js
index eb7719859..f0c75f224 100644
--- a/web/pgadmin/tools/schema_diff/static/js/schema_diff.js
+++ b/web/pgadmin/tools/schema_diff/static/js/schema_diff.js
@@ -85,7 +85,7 @@ define('pgadmin.schemadiff', [
})
.done(function(res) {
self.trans_id = res.data.schemaDiffTransId;
- res.data.panel_title = 'Schema Diff (Beta)'; //TODO: Set the panel title
+ res.data.panel_title = gettext('Schema Diff (Beta)'); //TODO: Set the panel title
// TODO: Following function is used to test the fetching of the
// databases this should be moved to server selection event later.
self.launch_schema_diff(res.data);
diff --git a/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js b/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js
index a5008db08..6bde4a846 100644
--- a/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js
+++ b/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js
@@ -302,11 +302,11 @@ export default class SchemaDiffUI {
var grid_width = (self.grid_width - 47) / 2 ;
var columns = [
checkboxSelector.getColumnDefinition(),
- {id: 'title', name: 'Schema Objects', field: 'title', minWidth: grid_width, formatter: formatColumnTitle},
- {id: 'status', name: 'Comparison Result', field: 'status', minWidth: grid_width},
- {id: 'label', name: 'Schema Objects', field: 'label', width: 0, minWidth: 0, maxWidth: 0,
+ {id: 'title', name: gettext('Schema Objects'), field: 'title', minWidth: grid_width, formatter: formatColumnTitle},
+ {id: 'status', name: gettext('Comparison Result'), field: 'status', minWidth: grid_width},
+ {id: 'label', name: gettext('Schema Objects'), field: 'label', width: 0, minWidth: 0, maxWidth: 0,
cssClass: 'really-hidden', headerCssClass: 'really-hidden'},
- {id: 'type', name: 'Schema Objects', field: 'type', width: 0, minWidth: 0, maxWidth: 0,
+ {id: 'type', name: gettext('Schema Objects'), field: 'type', width: 0, minWidth: 0, maxWidth: 0,
cssClass: 'really-hidden', headerCssClass: 'really-hidden'},
{id: 'id', name: 'id', field: 'id', width: 0, minWidth: 0, maxWidth: 0,
cssClass: 'really-hidden', headerCssClass: 'really-hidden' },
@@ -462,10 +462,10 @@ export default class SchemaDiffUI {
.done(function (res) {
let msg = res.data.compare_msg;
if (res.data.diff_percentage != 100) {
- msg = msg + ' (this may take a few minutes)...';
+ msg = msg + gettext(' (this may take a few minutes)...');
}
- msg = msg + '<br>'+ res.data.diff_percentage + '% completed.';
+ msg = msg + '<br>' + gettext('%s completed.', res.data.diff_percentage + '%');
$('#diff_fetching_data').find('.schema-diff-busy-text').html(msg);
})
.fail(function (xhr) {
diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
index 274fcb87d..4fc4f329b 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
@@ -2237,7 +2237,7 @@ define('tools.querytool', [
self.trigger('pgadmin-sqleditor:loading-icon:hide');
- self.gridView.set_editor_title(`(${gettext('Obtaining connection...')} ${_.unescape(url_params.title)}`);
+ self.gridView.set_editor_title('(' + gettext('Obtaining connection...') + ` ${_.unescape(url_params.title)}`);
let afterConn = function() {
let enableBtns = [];
diff --git a/web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py b/web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py
index 114046f6c..a4d74e860 100644
--- a/web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py
+++ b/web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py
@@ -212,9 +212,9 @@ def RegisterQueryToolPreferences(self):
'CSV_output', 'csv_quoting',
gettext("CSV quoting"), 'options', 'strings',
category_label=gettext('CSV Output'),
- options=[{'label': 'None', 'value': 'none'},
- {'label': 'All', 'value': 'all'},
- {'label': 'Strings', 'value': 'strings'}],
+ options=[{'label': gettext('None'), 'value': 'none'},
+ {'label': gettext('All'), 'value': 'all'},
+ {'label': gettext('Strings'), 'value': 'strings'}],
select2={
'allowClear': False,
'tags': False
@@ -240,7 +240,7 @@ def RegisterQueryToolPreferences(self):
options=[{'label': ';', 'value': ';'},
{'label': ',', 'value': ','},
{'label': '|', 'value': '|'},
- {'label': 'Tab', 'value': '\t'}],
+ {'label': gettext('Tab'), 'value': '\t'}],
select2={
'allowClear': False,
'tags': True
@@ -262,9 +262,9 @@ def RegisterQueryToolPreferences(self):
'Results_grid', 'results_grid_quoting',
gettext("Result copy quoting"), 'options', 'strings',
category_label=gettext('Results grid'),
- options=[{'label': 'None', 'value': 'none'},
- {'label': 'All', 'value': 'all'},
- {'label': 'Strings', 'value': 'strings'}],
+ options=[{'label': gettext('None'), 'value': 'none'},
+ {'label': gettext('All'), 'value': 'all'},
+ {'label': gettext('Strings'), 'value': 'strings'}],
select2={
'allowClear': False,
'tags': False
@@ -290,7 +290,7 @@ def RegisterQueryToolPreferences(self):
options=[{'label': ';', 'value': ';'},
{'label': ',', 'value': ','},
{'label': '|', 'value': '|'},
- {'label': 'Tab', 'value': '\t'}],
+ {'label': gettext('Tab'), 'value': '\t'}],
select2={
'allowClear': False,
'tags': True
diff --git a/web/pgadmin/tools/user_management/static/js/user_management.js b/web/pgadmin/tools/user_management/static/js/user_management.js
index 64014863f..2b1ed1727 100644
--- a/web/pgadmin/tools/user_management/static/js/user_management.js
+++ b/web/pgadmin/tools/user_management/static/js/user_management.js
@@ -27,7 +27,7 @@ define([
userFilter = function(collection) {
return (new Backgrid.Extension.ClientSideFilter({
collection: collection,
- placeholder: _('Filter by email'),
+ placeholder: gettext('Filter by email'),
// How long to wait after typing has stopped before searching can start
wait: 150,
}));
@@ -763,7 +763,7 @@ define([
<div class="input-group-prepend">
<span class="input-group-text fa fa-search" id="labelSearch"></span>
</div>
- <input type="search" class="form-control" id="txtGridSearch" placeholder="Search" aria-label="Search" aria-describedby="labelSearch" />
+ <input type="search" class="form-control" id="txtGridSearch" placeholder="` + gettext('Search') + `" aria-label="Search" aria-describedby="labelSearch" />
</div>
<button id="btn_refresh" type="button" class="btn btn-secondary btn-navtab-inline add" title="Add">
<span class="fa fa-plus "></span>
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgAdmin 4 - gettext usage fixes
@ 2020-03-23 10:30 Akshay Joshi <[email protected]>
parent: Libor M. <[email protected]>
0 siblings, 1 reply; 5+ messages in thread
From: Akshay Joshi @ 2020-03-23 10:30 UTC (permalink / raw)
To: Aditya Toshniwal <[email protected]>; +Cc: pgadmin-hackers; Libor M. <[email protected]>
Hi Aditya
Can you please review this?
On Mon, Mar 23, 2020 at 5:00 AM Libor M. <[email protected]> wrote:
> Hello,
> I fixed using gettext function and add more usages for translations,
> specifically:
>
> - fixed usage gettext('') instead of _('') in javascript files
> - fixed usage gettext('') instead of `${gettext('')}` in javascript
> files, because "pybabel extract" not support extracting from this
> syntax
> - added a lot of gettext for support translations
>
> Diff file is attached.
>
> Best regards,
>
> Libor M.
>
> E-mail: [email protected]
> GitHub: https://github.com/liborm85
>
--
*Thanks & Regards*
*Akshay Joshi*
*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgAdmin 4 - gettext usage fixes
@ 2020-03-23 15:01 Aditya Toshniwal <[email protected]>
parent: Akshay Joshi <[email protected]>
0 siblings, 1 reply; 5+ messages in thread
From: Aditya Toshniwal @ 2020-03-23 15:01 UTC (permalink / raw)
To: Libor M. <[email protected]>; +Cc: pgadmin-hackers; Akshay Joshi <[email protected]>
Hi Libor,
Thank you for the patch. It is good clean up patch.
I've made a few changes in the patch. You've imported sprintf which was not
required since gettext also works as sprintf directly.
I've also created a housekeeping redmine ticket to track it -
https://redmine.postgresql.org/issues/5284
The messages compile fine. The patch can be committed.
Please find the attached updated patch.
On Mon, Mar 23, 2020 at 4:00 PM Akshay Joshi <[email protected]>
wrote:
> Hi Aditya
>
> Can you please review this?
>
> On Mon, Mar 23, 2020 at 5:00 AM Libor M. <[email protected]> wrote:
>
>> Hello,
>> I fixed using gettext function and add more usages for translations,
>> specifically:
>>
>> - fixed usage gettext('') instead of _('') in javascript files
>> - fixed usage gettext('') instead of `${gettext('')}` in javascript
>> files, because "pybabel extract" not support extracting from this
>> syntax
>> - added a lot of gettext for support translations
>>
>> Diff file is attached.
>>
>> Best regards,
>>
>> Libor M.
>>
>> E-mail: [email protected]
>> GitHub: https://github.com/liborm85
>>
>
>
> --
> *Thanks & Regards*
> *Akshay Joshi*
>
> *Sr. Software Architect*
> *EnterpriseDB Software India Private Limited*
> *Mobile: +91 976-788-8246*
>
--
Thanks and Regards,
Aditya Toshniwal
pgAdmin Hacker | Sr. Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"
Attachments:
[application/octet-stream] RM5284.patch (56.2K, 3-RM5284.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py
index beaa65eb6..3c96c1051 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -1266,13 +1266,14 @@ class ServerNode(PGChildNodeView):
data={
'status': 1,
'result': gettext(
- 'Named restore point created: {0}'.format(
- restore_point_name))
+ 'Named restore point created: {0}').format(
+ restore_point_name)
})
except Exception as e:
- current_app.logger.error(
- 'Named restore point creation failed ({0})'.format(str(e))
+ current_app.logger.error(gettext(
+ 'Named restore point creation failed ({0})').format(
+ str(e))
)
return internal_server_error(errormsg=str(e))
diff --git a/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
index c012b9586..41cb0d0ac 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
@@ -50,7 +50,7 @@ class CastModule(CollectionNodeModule):
"""
NODE_TYPE = 'cast'
- COLLECTION_LABEL = 'Casts'
+ COLLECTION_LABEL = gettext('Casts')
def __init__(self, *args, **kwargs):
super(CastModule, self).__init__(*args, **kwargs)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger.js b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger.js
index 983389df6..add08f08a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger.js
@@ -111,10 +111,10 @@ define('pgadmin.node.event_trigger', [
id: 'enabled', label: gettext('Trigger enabled?'),
group: gettext('Definition'), mode: ['properties', 'edit','create'],
options: [
- {label: 'Enable', value: 'O'},
- {label: 'Disable', value: 'D'},
- {label: 'Replica', value: 'R'},
- {label: 'Always', value: 'A'},
+ {label: gettext('Enable'), value: 'O'},
+ {label: gettext('Disable'), value: 'D'},
+ {label: gettext('Replica'), value: 'R'},
+ {label: gettext('Always'), value: 'A'},
],
control: 'select2', select2: { allowClear: false, width: '100%' },
},{
@@ -125,9 +125,9 @@ define('pgadmin.node.event_trigger', [
id: 'eventname', label: gettext('Event'),
group: gettext('Definition'), cell: 'string',
options: [
- {label: 'DDL COMMAND START', value: 'DDL_COMMAND_START'},
- {label: 'DDL COMMAND END', value: 'DDL_COMMAND_END'},
- {label: 'SQL DROP', value: 'SQL_DROP'},
+ {label: gettext('DDL COMMAND START'), value: 'DDL_COMMAND_START'},
+ {label: gettext('DDL COMMAND END'), value: 'DDL_COMMAND_END'},
+ {label: gettext('SQL DROP'), value: 'SQL_DROP'},
],
control: 'select2', select2: { allowClear: false, width: '100%' },
},{
diff --git a/web/pgadmin/browser/server_groups/servers/databases/external_tables/properties.py b/web/pgadmin/browser/server_groups/servers/databases/external_tables/properties.py
index 88f20a15d..da1b2c5fc 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/external_tables/properties.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/external_tables/properties.py
@@ -52,8 +52,8 @@ class Properties:
execute_on_text = self.translate_execute_on_text(execute_on)
response = dict(
name=table_information_result['name'],
- type=gettext('readable' if not table_information_result[
- 'writable'] else 'writable'),
+ type=gettext('readable') if not table_information_result[
+ 'writable'] else gettext('writable'),
format_type=table_information_result['pg_encoding_to_char'],
format_options=table_information_result['fmtopts'],
external_options=table_information_result['options'],
@@ -65,14 +65,14 @@ class Properties:
@staticmethod
def translate_execute_on_text(execute_on):
if execute_on['type'] == 'host':
- return 'host %s' % execute_on['value']
+ return gettext('host %s') % execute_on['value']
elif execute_on['type'] == 'per_host':
- return 'per host'
+ return gettext('per host')
elif execute_on['type'] == 'master_only':
- return 'master segment'
+ return gettext('master segment')
elif execute_on['type'] == 'all_segments':
- return 'all segments'
+ return gettext('all segments')
elif execute_on['type'] == 'segment':
- return '%s segment' % execute_on['value']
+ return gettext('%s segment') % execute_on['value']
elif execute_on['type'] == 'segments':
- return '%d segments' % execute_on['value']
+ return gettext('%d segments') % execute_on['value']
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.js
index fd7e06cff..3c5c091ba 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.js
@@ -450,7 +450,7 @@ define('pgadmin.node.exclusion_constraint', [
titleTmpl = _.template([
'<div class="subnode-header">',
' <label class="control-label pg-el-sm-10"><%-label%></label>',
- ' <button class="btn btn-sm-sq btn-secondary add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%> title="' + _('Add new row') + '"></button>',
+ ' <button class="btn btn-sm-sq btn-secondary add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%> title="' + gettext('Add new row') + '"></button>',
'</div>'].join('\n')),
$gridBody =
$('<div class=\'pgadmin-control-group backgrid form-group col-12 object subnode\'></div>').append(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js
index 8695f8bd1..66083151f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js
@@ -378,7 +378,7 @@ define('pgadmin.node.foreign_key', [
titleTmpl = _.template([
'<div class="subnode-header">',
' <label class="control-label pg-el-sm-10"><%-label%></label>',
- ' <button class="btn btn-sm-sq btn-secondary add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%> title="' + _('Add new row') + '"></button>',
+ ' <button class="btn btn-sm-sq btn-secondary add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%> title="' + gettext('Add new row') + '"></button>',
'</div>'].join('\n')),
$gridBody =
$('<div class=\'pgadmin-control-group backgrid form-group col-12 object subnode\'></div>').append(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js
index 005242a4a..928342895 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js
@@ -71,12 +71,12 @@ function(
// To enable/disable all triggers for the table
name: 'enable_all_triggers', node: 'partition', module: this,
applies: ['object', 'context'], callback: 'enable_triggers_on_table',
- category: 'Trigger(s)', priority: 4, label: gettext('Enable All'),
+ category: gettext('Trigger(s)'), priority: 4, label: gettext('Enable All'),
icon: 'fa fa-check', enable : 'canCreate_with_trigger_enable',
},{
name: 'disable_all_triggers', node: 'partition', module: this,
applies: ['object', 'context'], callback: 'disable_triggers_on_table',
- category: 'Trigger(s)', priority: 4, label: gettext('Disable All'),
+ category: gettext('Trigger(s)'), priority: 4, label: gettext('Disable All'),
icon: 'fa fa-times', enable : 'canCreate_with_trigger_disable',
},{
name: 'reset_table_stats', node: 'partition', module: this,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js
index f197b6546..61761794f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js
@@ -82,23 +82,23 @@ define('pgadmin.node.table', [
},{
name: 'truncate_table', node: 'table', module: this,
applies: ['object', 'context'], callback: 'truncate_table',
- category: 'Truncate', priority: 3, label: gettext('Truncate'),
+ category: gettext('Truncate'), priority: 3, label: gettext('Truncate'),
icon: 'fa fa-eraser', enable : 'canCreate',
},{
name: 'truncate_table_cascade', node: 'table', module: this,
applies: ['object', 'context'], callback: 'truncate_table_cascade',
- category: 'Truncate', priority: 3, label: gettext('Truncate Cascade'),
+ category: gettext('Truncate'), priority: 3, label: gettext('Truncate Cascade'),
icon: 'fa fa-eraser', enable : 'canCreate',
},{
// To enable/disable all triggers for the table
name: 'enable_all_triggers', node: 'table', module: this,
applies: ['object', 'context'], callback: 'enable_triggers_on_table',
- category: 'Trigger(s)', priority: 4, label: gettext('Enable All'),
+ category: gettext('Trigger(s)'), priority: 4, label: gettext('Enable All'),
icon: 'fa fa-check', enable : 'canCreate_with_trigger_enable',
},{
name: 'disable_all_triggers', node: 'table', module: this,
applies: ['object', 'context'], callback: 'disable_triggers_on_table',
- category: 'Trigger(s)', priority: 4, label: gettext('Disable All'),
+ category: gettext('Trigger(s)'), priority: 4, label: gettext('Disable All'),
icon: 'fa fa-times', enable : 'canCreate_with_trigger_disable',
},{
name: 'reset_table_stats', node: 'table', module: this,
diff --git a/web/pgadmin/browser/server_groups/servers/static/js/variable.js b/web/pgadmin/browser/server_groups/servers/static/js/variable.js
index 329967e08..981582945 100644
--- a/web/pgadmin/browser/server_groups/servers/static/js/variable.js
+++ b/web/pgadmin/browser/server_groups/servers/static/js/variable.js
@@ -338,7 +338,7 @@ function(gettext, _, $, Backbone, Backform, Backgrid, Alertify, pgAdmin, pgNode)
titleTmpl = _.template([
'<div class=\'subnode-header\'>',
'<span class=\'control-label\'><%-label%></span>',
- '<button class=\'btn btn-sm-sq btn-secondary add fa fa-plus\' title=\'' + _('Add new row') + '\' <%=canAdd ? \'\' : \'disabled="disabled"\'%>><span class="sr-only">Add new row</span></button>',
+ '<button class=\'btn btn-sm-sq btn-secondary add fa fa-plus\' title=\'' + gettext('Add new row') + '\' <%=canAdd ? \'\' : \'disabled="disabled"\'%>><span class="sr-only">' + gettext('Add new row') + '</span></button>',
'</div>'].join('\n')),
$gridBody =
$('<div class=\'pgadmin-control-group backgrid form-group col-12 object subnode\'></div>').append(
diff --git a/web/pgadmin/browser/server_groups/servers/templates/servers/password.html b/web/pgadmin/browser/server_groups/servers/templates/servers/password.html
index afdfbfe96..9fc0b3945 100644
--- a/web/pgadmin/browser/server_groups/servers/templates/servers/password.html
+++ b/web/pgadmin/browser/server_groups/servers/templates/servers/password.html
@@ -15,7 +15,7 @@
<input class="custom-control-input" id="save_password" name="save_password" type="checkbox"
{% if not config.ALLOW_SAVE_PASSWORD %}disabled{% endif %}
>
- <label class="custom-control-label" for="save_password">Save Password</label>
+ <label class="custom-control-label" for="save_password">{{ _('Save Password') }}</label>
</div>
</div>
</div>
diff --git a/web/pgadmin/browser/server_groups/servers/templates/servers/tunnel_password.html b/web/pgadmin/browser/server_groups/servers/templates/servers/tunnel_password.html
index 5ae7d2fde..8724c8035 100644
--- a/web/pgadmin/browser/server_groups/servers/templates/servers/tunnel_password.html
+++ b/web/pgadmin/browser/server_groups/servers/templates/servers/tunnel_password.html
@@ -35,7 +35,7 @@
<input class="custom-control-input" id="save_password" name="save_password" type="checkbox"
{% if not config.ALLOW_SAVE_PASSWORD %}disabled{% endif %}
>
- <label class="custom-control-label" for="save_password" class="ml-1">Save Password</label>
+ <label class="custom-control-label" for="save_password" class="ml-1">{{ _('Save Password') }}</label>
</div>
</div>
</div>
diff --git a/web/pgadmin/browser/static/js/collection.js b/web/pgadmin/browser/static/js/collection.js
index e2e9c462e..2ec4fe1b5 100644
--- a/web/pgadmin/browser/static/js/collection.js
+++ b/web/pgadmin/browser/static/js/collection.js
@@ -183,7 +183,7 @@ define([
}
// Initialize a new Grid instance
that.grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: gridSchema.columns,
collection: that.collection,
className: 'backgrid table presentation table-bordered table-noouter-border table-hover',
diff --git a/web/pgadmin/browser/static/js/node.js b/web/pgadmin/browser/static/js/node.js
index 224caa33b..029a29817 100644
--- a/web/pgadmin/browser/static/js/node.js
+++ b/web/pgadmin/browser/static/js/node.js
@@ -216,7 +216,7 @@ define('pgadmin.browser.node', [
callback: 'show_script',
priority: 4,
label: type_label,
- category: 'Scripts',
+ category: gettext('Scripts'),
data: {
'script': stype,
},
diff --git a/web/pgadmin/browser/static/js/node.ui.js b/web/pgadmin/browser/static/js/node.ui.js
index 878497165..d81d8548b 100644
--- a/web/pgadmin/browser/static/js/node.ui.js
+++ b/web/pgadmin/browser/static/js/node.ui.js
@@ -113,7 +113,7 @@ define([
url_with_id: false,
select2: {
allowClear: true,
- placeholder: 'Select an item...',
+ placeholder: gettext('Select an item...'),
width: 'style',
},
}),
@@ -256,7 +256,7 @@ define([
},
select2: {
allowClear: true,
- placeholder: 'Select an item...',
+ placeholder: gettext('Select an item...'),
width: 'style',
templateResult: formatNode,
templateSelection: formatNode,
@@ -375,7 +375,7 @@ define([
url_with_id: false,
select2: {
allowClear: true,
- placeholder: 'Select an item...',
+ placeholder: gettext('Select an item...'),
width: 'style',
},
opt: {
@@ -510,7 +510,7 @@ define([
return res;
},
select2: {
- placeholder: 'Select an item...',
+ placeholder: gettext('Select an item...'),
width: 'style',
templateResult: formatNode,
templateSelection: formatNode,
@@ -555,7 +555,7 @@ define([
return res;
},
select2: {
- placeholder: 'Select an item...',
+ placeholder: gettext('Select an item...'),
width: 'style',
templateResult: formatNode,
templateSelection: formatNode,
@@ -570,7 +570,7 @@ define([
url_with_id: false,
select2: {
allowClear: true,
- placeholder: 'Select an item...',
+ placeholder: gettext('Select an item...'),
width: 'style',
multiple: true,
},
diff --git a/web/pgadmin/browser/templates/browser/master_password.html b/web/pgadmin/browser/templates/browser/master_password.html
index e1b95b1e2..763a9bcb1 100644
--- a/web/pgadmin/browser/templates/browser/master_password.html
+++ b/web/pgadmin/browser/templates/browser/master_password.html
@@ -2,7 +2,7 @@
<div>
<div><b>{{ content_text|safe }}</b></div>
<div class="input-group row py-2">
- <label for="password" class="col-sm-2 col-form-label">Password</label>
+ <label for="password" class="col-sm-2 col-form-label">{{ _('Password') }}</label>
<div class="col-sm-10">
<input type="password" class="form-control" id="password" name="password">
</div>
diff --git a/web/pgadmin/dashboard/static/js/dashboard.js b/web/pgadmin/dashboard/static/js/dashboard.js
index 61e71f076..6fc82546c 100644
--- a/web/pgadmin/dashboard/static/js/dashboard.js
+++ b/web/pgadmin/dashboard/static/js/dashboard.js
@@ -673,7 +673,7 @@ define('pgadmin.dashboard', [
// Set up the grid
var grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: columns,
collection: data,
className: 'backgrid presentation table table-bordered table-noouter-border table-hover',
diff --git a/web/pgadmin/dashboard/templates/dashboard/server_dashboard.html b/web/pgadmin/dashboard/templates/dashboard/server_dashboard.html
index 437b01ea0..2cceb4d86 100644
--- a/web/pgadmin/dashboard/templates/dashboard/server_dashboard.html
+++ b/web/pgadmin/dashboard/templates/dashboard/server_dashboard.html
@@ -87,7 +87,7 @@
<div class="input-group-prepend">
<span class="input-group-text fa fa-search" id="labelSearch"></span>
</div>
- <input type="search" class="form-control" id="txtGridSearch" placeholder="Search" aria-label="Search" aria-describedby="labelSearch">
+ <input type="search" class="form-control" id="txtGridSearch" placeholder="{{ _('Search') }}" aria-label="Search" aria-describedby="labelSearch">
</div>
<button id="btn_refresh" type="button" class="btn btn-secondary btn-navtab-inline" title="{{ _('Refresh') }}" aria-label="{{ _('Refresh') }}">
<span class="fa fa-refresh" aria-hidden="true"></span>
diff --git a/web/pgadmin/misc/bgprocess/static/js/bgprocess.js b/web/pgadmin/misc/bgprocess/static/js/bgprocess.js
index e63466a0e..f80a42599 100644
--- a/web/pgadmin/misc/bgprocess/static/js/bgprocess.js
+++ b/web/pgadmin/misc/bgprocess/static/js/bgprocess.js
@@ -311,8 +311,8 @@ define('misc.bgprocess', [
</div>
<div class="pg-bg-etime my-auto mr-2"></div>
<div class="ml-auto">
- <button class="btn btn-secondary pg-bg-more-details"><span class="fa fa-info-circle" role="img"></span> ${gettext('More details...')}</button>
- <button class="btn btn-danger bg-process-stop"><span class="fa fa-times-circle" role="img"></span> ${gettext('Stop Process')}</button>
+ <button class="btn btn-secondary pg-bg-more-details"><span class="fa fa-info-circle" role="img"></span> ` + gettext('More details...') + `</button>
+ <button class="btn btn-danger bg-process-stop"><span class="fa fa-times-circle" role="img"></span> ` + gettext('Stop Process') + `</button>
</div>
</div>
<div class="pg-bg-status py-1">
@@ -393,7 +393,7 @@ define('misc.bgprocess', [
is_new = true;
panel = this.panel =
pgBrowser.BackgroundProcessObsorver.create_panel();
- panel.title('Process Watcher - ' + self.type_desc);
+ panel.title(gettext('Process Watcher - %s', self.type_desc));
panel.focus();
}
@@ -419,7 +419,7 @@ define('misc.bgprocess', [
setTimeout(function() {
self.logs[0].scrollTop = self.logs[0].scrollHeight;
});
- self.logs_loading = $(`<li class="pg-bg-res-out loading-logs">${gettext('Loading process logs...')}</li>`);
+ self.logs_loading = $('<li class="pg-bg-res-out loading-logs">' + gettext('Loading process logs...') + '</li>');
self.logs.append(self.logs_loading);
// set bgprocess detailed description
$header.find('.bg-detailed-desc').html(self.detailed_desc);
diff --git a/web/pgadmin/misc/dependencies/static/js/dependencies.js b/web/pgadmin/misc/dependencies/static/js/dependencies.js
index f59c2c565..bab26019f 100644
--- a/web/pgadmin/misc/dependencies/static/js/dependencies.js
+++ b/web/pgadmin/misc/dependencies/static/js/dependencies.js
@@ -75,7 +75,7 @@ define('misc.dependencies', [
var $container = this.dependenciesPanel.layout().scene().find('.pg-panel-content'),
$gridContainer = $container.find('.pg-panel-dependencies-container'),
grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: [{
name: 'type',
label: gettext('Type'),
diff --git a/web/pgadmin/misc/dependents/static/js/dependents.js b/web/pgadmin/misc/dependents/static/js/dependents.js
index 357198084..5f6007f1d 100644
--- a/web/pgadmin/misc/dependents/static/js/dependents.js
+++ b/web/pgadmin/misc/dependents/static/js/dependents.js
@@ -76,7 +76,7 @@ define('misc.dependents', [
var $container = this.dependentsPanel.layout().scene().find('.pg-panel-content'),
$gridContainer = $container.find('.pg-panel-dependents-container'),
grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: [{
name: 'type',
label: gettext('Type'),
diff --git a/web/pgadmin/misc/file_manager/static/js/utility.js b/web/pgadmin/misc/file_manager/static/js/utility.js
index 2cc1aba87..04060b77d 100644
--- a/web/pgadmin/misc/file_manager/static/js/utility.js
+++ b/web/pgadmin/misc/file_manager/static/js/utility.js
@@ -1258,12 +1258,12 @@ define([
}
select_box = `<div class='change_file_types d-flex align-items-center p-1'>
- <div>
- ${gettext('Show hidden files and folders')}?
- <input type='checkbox' id='show_hidden' onclick='pgAdmin.FileUtils.handleClick(this)' tabindex='0'>
+ <div>` +
+ gettext('Show hidden files and folders?') +
+ `<input type='checkbox' id='show_hidden' onclick='pgAdmin.FileUtils.handleClick(this)' tabindex='0'>
</div>
<div class="ml-auto">
- <label class="my-auto">${gettext('Format')}</label>
+ <label class="my-auto">` + gettext('Format') + `</label>
<select name='type' tabindex='0'>${fileFormats}</select>
<div>`;
}
diff --git a/web/pgadmin/misc/statistics/static/js/statistics.js b/web/pgadmin/misc/statistics/static/js/statistics.js
index 657d47463..ebce79265 100644
--- a/web/pgadmin/misc/statistics/static/js/statistics.js
+++ b/web/pgadmin/misc/statistics/static/js/statistics.js
@@ -282,7 +282,7 @@ define('misc.statistics', [
}
self.grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: self.columns,
collection: self.collection,
className: GRID_CLASSES,
diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js
index a44d1a83a..a57f70ebc 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -609,11 +609,11 @@ define([
if(this.$el.find('.toggle.btn').hasClass('off')) {
this.$el.find('.sr-value').text(`
- ${label}, ${offText}, ${gettext('Toggle button')}
+ ${label}, ${offText}, ` + gettext('Toggle button') + `
`);
} else {
this.$el.find('.sr-value').text(`
- ${label}, ${onText}, ${gettext('Toggle button')}
+ ${label}, ${onText}, ` + gettext('Toggle button') + `
`);
}
},
@@ -1295,7 +1295,7 @@ define([
gridHeader = _.template([
'<div class="subnode-header">',
' <span class="control-label pg-el-sm-10" id="<%=cId%>"><%-label%></span>',
- ' <button aria-label="' + _('Add new row') + '" class="btn btn-sm-sq btn-secondary add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%> title="' + _('Add new row') + '"><%-add_label%></button>',
+ ' <button aria-label="' + gettext('Add new row') + '" class="btn btn-sm-sq btn-secondary add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%> title="' + gettext('Add new row') + '"><%-add_label%></button>',
'</div>',
].join('\n')),
gridBody = $('<div class="pgadmin-control-group backgrid form-group pg-el-12 object subnode "></div>').append(
@@ -1582,7 +1582,7 @@ define([
var self = this,
gridHeader = ['<div class=\'subnode-header\'>',
' <span class=\'control-label pg-el-sm-10\'>' + data.label + '</span>',
- ' <button aria-label="' + _('Add') + '" class=\'btn btn-sm-sq btn-secondary add fa fa-plus\' title=\'' + _('Add new row') + '\'></button>',
+ ' <button aria-label="' + gettext('Add') + '" class=\'btn btn-sm-sq btn-secondary add fa fa-plus\' title=\'' + gettext('Add new row') + '\'></button>',
'</div>',
].join('\n'),
gridBody = $('<div class=\'pgadmin-control-group backgrid form-group pg-el-12 object subnode\'></div>').append(gridHeader);
diff --git a/web/pgadmin/static/js/backgrid.pgadmin.js b/web/pgadmin/static/js/backgrid.pgadmin.js
index a64897b20..230d7ce56 100644
--- a/web/pgadmin/static/js/backgrid.pgadmin.js
+++ b/web/pgadmin/static/js/backgrid.pgadmin.js
@@ -432,7 +432,7 @@ define([
if (editable) {
this.$el.html(
- '<i class=\'fa fa-pencil-square subnode-edit-in-process\' title=\'' + _('Edit row') + '\' aria-label=\'' + _('Edit row') + '\'></i>'
+ '<i class=\'fa fa-pencil-square subnode-edit-in-process\' title=\'' + gettext('Edit row') + '\' aria-label=\'' + gettext('Edit row') + '\'></i>'
);
let body = $(this.$el).parents()[1],
container = $(body).find('.tab-content:first > .tab-pane.active:first');
@@ -451,7 +451,7 @@ define([
},
render: function() {
this.$el.empty();
- this.$el.html('<i class=\'fa fa-pencil-square-o\' title=\'' + _('Edit row') + '\' aria-label=\'' + _('Edit row') + '\'></i>');
+ this.$el.html('<i class=\'fa fa-pencil-square-o\' title=\'' + gettext('Edit row') + '\' aria-label=\'' + gettext('Edit row') + '\'></i>');
this.delegateEvents();
if (this.grabFocus)
this.$el.trigger('focus');
@@ -555,7 +555,7 @@ define([
var self = this;
this.$el.empty();
$(this.$el).attr('tabindex', 0);
- this.$el.html('<i aria-label="' + _('Delete row') + '" class=\'fa fa-trash\' title=\'' + _('Delete row') + '\'></i>');
+ this.$el.html('<i aria-label="' + gettext('Delete row') + '" class=\'fa fa-trash\' title=\'' + gettext('Delete row') + '\'></i>');
// Listen for Tab/Shift-Tab key
this.$el.on('keydown', function(e) {
// with keyboard navigation on space key, mark row for deletion
diff --git a/web/pgadmin/static/js/keyboard_shortcuts.js b/web/pgadmin/static/js/keyboard_shortcuts.js
index 5ba9b271a..fba3c9fb8 100644
--- a/web/pgadmin/static/js/keyboard_shortcuts.js
+++ b/web/pgadmin/static/js/keyboard_shortcuts.js
@@ -87,7 +87,7 @@ function shortcut_title(title, shortcut) {
* shortcut object is browser.get_preference().value
*/
function shortcut_accesskey_title(title, shortcut) {
- return `${title} (${gettext('accesskey')} + ${shortcut_key(shortcut)})`;
+ return `${title} (` + gettext('accesskey') + ` + ${shortcut_key(shortcut)})`;
}
diff --git a/web/pgadmin/static/js/sqleditor/calculate_query_run_time.js b/web/pgadmin/static/js/sqleditor/calculate_query_run_time.js
index f66629e55..5c7474339 100644
--- a/web/pgadmin/static/js/sqleditor/calculate_query_run_time.js
+++ b/web/pgadmin/static/js/sqleditor/calculate_query_run_time.js
@@ -8,6 +8,7 @@
//////////////////////////////////////////////////////////////
import moment from 'moment';
+import gettext from 'sources/gettext';
export function calculateQueryRunTime(startTime, endTime) {
let total_ms = moment(endTime).diff(startTime);
@@ -26,9 +27,9 @@ export function calculateQueryRunTime(startTime, endTime) {
hrs = parseInt(mins/60);
mins = mins%60;
- result = (hrs>0 ? hrs + ' hr ': '')
- + (mins>0 ? mins + ' min ': '')
- + (hrs<=0 && secs>0 ? secs + ' secs ': '')
- + (hrs<=0 && mins<=0 ? total_ms + ' msec ':'');
+ result = (hrs>0 ? hrs + ' ' + gettext('hr') + ' ': '')
+ + (mins>0 ? mins + ' ' + gettext('min') + ' ': '')
+ + (hrs<=0 && secs>0 ? secs + ' ' + gettext('secs') + ' ': '')
+ + (hrs<=0 && mins<=0 ? total_ms + ' ' + gettext('msec') + ' ':'');
return result.trim();
}
diff --git a/web/pgadmin/static/js/sqleditor/filter_dialog.js b/web/pgadmin/static/js/sqleditor/filter_dialog.js
index a060ce487..0ca1fed66 100644
--- a/web/pgadmin/static/js/sqleditor/filter_dialog.js
+++ b/web/pgadmin/static/js/sqleditor/filter_dialog.js
@@ -139,7 +139,7 @@ let FilterDialog = {
`<div id="show_filter_progress" class="pg-sp-container sql-editor-busy-fetching d-none">
<div class="pg-sp-content">
<div class="row"><div class="col-12 pg-sp-icon sql-editor-busy-icon"></div></div>
- <div class="row"><div class="col-12 pg-sp-text sql-editor-busy-text">${gettext('Loading data...')}</div></div>
+ <div class="row"><div class="col-12 pg-sp-text sql-editor-busy-text">` + gettext('Loading data...') + `</div></div>
</div>
</div>`
).appendTo($container);
diff --git a/web/pgadmin/static/js/sqleditor/history/query_history.js b/web/pgadmin/static/js/sqleditor/history/query_history.js
index 2e4228058..c171f7fbe 100644
--- a/web/pgadmin/static/js/sqleditor/history/query_history.js
+++ b/web/pgadmin/static/js/sqleditor/history/query_history.js
@@ -59,9 +59,9 @@ export default class QueryHistory {
this.parentNode.empty()
.removeClass('d-flex')
.append(
- `<div role="status" class='pg-panel-message'>${gettext(
- 'No history found'
- )}</div>`
+ '<div role="status" class="pg-panel-message">' +
+ gettext('No history found') +
+ '</div>'
);
} else {
this.parentNode.empty().addClass('d-flex');
diff --git a/web/pgadmin/static/js/sqleditor/history/query_history_details.js b/web/pgadmin/static/js/sqleditor/history/query_history_details.js
index 626e89b5a..8a884da00 100644
--- a/web/pgadmin/static/js/sqleditor/history/query_history_details.js
+++ b/web/pgadmin/static/js/sqleditor/history/query_history_details.js
@@ -87,10 +87,10 @@ export default class QueryHistoryDetails {
updateCopyButton(copied) {
if (copied) {
this.$copyBtn.addClass('was-copied').removeClass('copy-all');
- this.$copyBtn.text('Copied!');
+ this.$copyBtn.text(gettext('Copied!'));
} else {
this.$copyBtn.addClass('copy-all').removeClass('was-copied');
- this.$copyBtn.text('Copy');
+ this.$copyBtn.text(gettext('Copy'));
}
}
@@ -106,14 +106,14 @@ export default class QueryHistoryDetails {
};
this.$metaData.empty().append(
- `<div class='metadata'>
- ${itemTemplate(this.formatDate(this.entry.start_time), 'Date')}
- ${itemTemplate(
- this.entry.row_affected.toLocaleString(),
- 'Rows Affected'
- )}
- ${itemTemplate(this.entry.total_time, 'Duration')}
- </div>`
+ '<div class="metadata">' +
+ itemTemplate(this.formatDate(this.entry.start_time), gettext('Date')) +
+ itemTemplate(
+ this.entry.row_affected.toLocaleString(),
+ gettext('Rows Affected')
+ ) +
+ itemTemplate(this.entry.total_time, gettext('Duration')) +
+ '</div>'
);
}
@@ -179,7 +179,7 @@ export default class QueryHistoryDetails {
</div>
<div class='message-block'>
<div class='message'>
- <div class='message-header'>Messages</div>
+ <div class='message-header'>` + gettext('Messages') + `</div>
<div class='content'></div>
</div>
</div>
diff --git a/web/pgadmin/static/js/sqleditor/history/query_history_entries.js b/web/pgadmin/static/js/sqleditor/history/query_history_entries.js
index fcc20812e..237231494 100644
--- a/web/pgadmin/static/js/sqleditor/history/query_history_entries.js
+++ b/web/pgadmin/static/js/sqleditor/history/query_history_entries.js
@@ -252,11 +252,11 @@ export class QueryHistoryEntries {
<div class="toggle-and-history-container">
<div class="query-history-toggle">
<label class="control-label">
- ${gettext('Show queries generated internally by pgAdmin')}?
+ ` + gettext('Show queries generated internally by pgAdmin?') + `
</label>
<input id="generated-queries-toggle" type="checkbox"
class="pgadmin-controls" data-style="quick"
- data-size="mini" data-on="${gettext('Yes')}" data-off="${gettext('No')}"
+ data-size="mini" data-on="` + gettext('Yes') + `" data-off="` + gettext('No') + `"
data-onstyle="success" data-offstyle="ternary" checked>
</div>
<div id='query_list' class='query-history' tabindex='0'></div>
diff --git a/web/pgadmin/static/js/sqleditor/query_tool_notifications.js b/web/pgadmin/static/js/sqleditor/query_tool_notifications.js
index cc01aa17a..aec3b6690 100644
--- a/web/pgadmin/static/js/sqleditor/query_tool_notifications.js
+++ b/web/pgadmin/static/js/sqleditor/query_tool_notifications.js
@@ -97,7 +97,7 @@ let queryToolNotifications = {
// Set up the grid
let notifications_grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: gridCols,
collection: queryToolNotifications.collection,
className: 'backgrid presentation table table-bordered table-hover table-noouter-border table-bottom-border',
diff --git a/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js b/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js
index ba87a3130..627ae3cdf 100644
--- a/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js
+++ b/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js
@@ -98,7 +98,7 @@ export class BackupDialogWrapper extends DialogWrapper {
const node = this.pgBrowser.Nodes[selectedTreeNodeData._type];
if (this.dialogTitle === null) {
- const title = `Backup (${node.label}: ${selectedTreeNodeData.label})`;
+ let title = gettext('Backup (%s: %s)', node.label, selectedTreeNodeData.label);
this.main(title);
}
diff --git a/web/pgadmin/tools/debugger/static/js/direct.js b/web/pgadmin/tools/debugger/static/js/direct.js
index 90493f357..179ded6c9 100644
--- a/web/pgadmin/tools/debugger/static/js/direct.js
+++ b/web/pgadmin/tools/debugger/static/js/direct.js
@@ -1047,7 +1047,7 @@ define([
// Initialize a new Grid instance
var stack_grid = this.stack_grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: stackGridCols,
row: Backgrid.Row.extend({
events: {
@@ -1112,7 +1112,7 @@ define([
// Initialize a new Grid instance
var result_grid = this.result_grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: resultGridCols,
collection: new ResultsCollection(result),
className: 'backgrid table table-bordered table-noouter-border table-bottom-border',
@@ -1190,7 +1190,7 @@ define([
// Initialize a new Grid instance
var variable_grid = this.variable_grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: gridCols,
collection: new VariablesCollection(my_obj),
className: 'backgrid table table-bordered table-noouter-border table-bottom-border',
@@ -1276,7 +1276,7 @@ define([
// Initialize a new Grid instance
var param_grid = this.param_grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: paramGridCols,
collection: new ParametersCollection(param_obj),
className: 'backgrid table table-bordered table-noouter-border table-bottom-border',
diff --git a/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js b/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js
index e5f50fc7d..763edef57 100644
--- a/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js
+++ b/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js
@@ -251,7 +251,7 @@ define([
DbObjectFilter: function(coll) {
var clientSideFilter = this.clientSideFilter = new Backgrid.Extension.ClientSideFilter({
collection: coll,
- placeholder: _('Search by object type or name'),
+ placeholder: gettext('Search by object type or name'),
// The model fields to search for matches
fields: ['object_type', 'name'],
@@ -697,11 +697,11 @@ define([
*/
var dbObjectTypePage = self.dbObjectTypePage = new pgBrowser.WizardPage({
id: 1,
- page_title: _('Object Selection (step 1 of 3)'),
+ page_title: gettext('Object Selection (step 1 of 3)'),
disable_prev: true,
disable_next: true,
show_description: '',
- show_progress_bar: _('Please wait while fetching records...'),
+ show_progress_bar: gettext('Please wait while fetching records...'),
model: newModel,
view: new(function() {
@@ -735,13 +735,13 @@ define([
$(`
<div class="db_objects_container pg-el-xs-12">
<div class="db_objects_header d-flex py-1">
- <div>${_('Please select the objects to grant privileges to from the list below.')}</div>
+ <div>` + gettext('Please select the objects to grant privileges to from the list below.') + `</div>
<div class="db_objects_filter ml-auto">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text fa fa-search" id="labelSearch"></span>
</div>
- <input type="search" class="form-control" id="txtGridSearch" placeholder="Search" aria-label="Search" aria-describedby="labelSearch">
+ <input type="search" class="form-control" id="txtGridSearch" placeholder="` + gettext('Search') + `" aria-label="Search" aria-describedby="labelSearch">
</div>
</div>
</div>
@@ -822,8 +822,8 @@ define([
// Wizard for Privelege control
var privilegePage = self.privilegePage = new pgBrowser.WizardPage({
id: 2,
- page_title: _('Privilege Selection (step 2 of 3)'),
- show_description: _('Please add the required privileges for the selected objects.'),
+ page_title: gettext('Privilege Selection (step 2 of 3)'),
+ show_description: gettext('Please add the required privileges for the selected objects.'),
disable_next: true,
model: newModel,
@@ -1021,7 +1021,7 @@ define([
//Create SqlField Object
var sqlField = new Backform.Field({
id: 'sqltab',
- label: _('Sql Tab'),
+ label: gettext('Sql Tab'),
/**
Extend 'SqlTabControl' to define new
@@ -1091,8 +1091,8 @@ define([
// Wizard for SQL tab control
var reviewSQLPage = self.reviewSQLPage = new pgBrowser.WizardPage({
id: 3,
- page_title: _('Final (Review Selection) (step 3 of 3)'),
- show_description: _('The SQL below will be executed on the ' +
+ page_title: gettext('Final (Review Selection) (step 3 of 3)'),
+ show_description: gettext('The SQL below will be executed on the ' +
'database server to grant the selected privileges. ' +
'Please click on <b>Finish</b> to complete the process.'),
model: newModel,
@@ -1151,7 +1151,7 @@ define([
*/
self.wizard = new(pgBrowser.Wizard.extend({
options: {
- title: _('Grant Wizard'),
+ title: gettext('Grant Wizard'),
/* Main Wizard Title */
width: '',
height: '',
diff --git a/web/pgadmin/tools/maintenance/__init__.py b/web/pgadmin/tools/maintenance/__init__.py
index 3b3651e9e..d19e32d30 100644
--- a/web/pgadmin/tools/maintenance/__init__.py
+++ b/web/pgadmin/tools/maintenance/__init__.py
@@ -266,7 +266,7 @@ def create_maintenance_job(sid, did):
# Return response
return make_json_response(
data={'job_id': jid, 'status': True,
- 'info': 'Maintenance job created.'}
+ 'info': _('Maintenance job created.')}
)
diff --git a/web/pgadmin/tools/schema_diff/__init__.py b/web/pgadmin/tools/schema_diff/__init__.py
index 23e190ce0..e170deb03 100644
--- a/web/pgadmin/tools/schema_diff/__init__.py
+++ b/web/pgadmin/tools/schema_diff/__init__.py
@@ -36,7 +36,7 @@ class SchemaDiffModule(PgAdminModule):
A module class for Schema Diff derived from PgAdminModule.
"""
- LABEL = "Schema Diff"
+ LABEL = gettext("Schema Diff")
def get_own_menuitems(self):
return {}
@@ -439,7 +439,7 @@ def compare(trans_id, source_sid, source_did, source_scid,
comparison_result = []
- diff_model_obj.set_comparison_info("Comparing objects...", 0)
+ diff_model_obj.set_comparison_info(gettext("Comparing objects..."), 0)
update_session_diff_transaction(trans_id, session_obj,
diff_model_obj)
@@ -451,7 +451,7 @@ def compare(trans_id, source_sid, source_did, source_scid,
for node_name, node_view in all_registered_nodes.items():
view = SchemaDiffRegistry.get_node_view(node_name)
if hasattr(view, 'compare'):
- msg = "Comparing " + view.blueprint.COLLECTION_LABEL
+ msg = gettext('Comparing {0}').format(gettext(view.blueprint.COLLECTION_LABEL))
diff_model_obj.set_comparison_info(msg, total_percent)
# Update the message and total percentage in session object
update_session_diff_transaction(trans_id, session_obj,
@@ -468,7 +468,7 @@ def compare(trans_id, source_sid, source_did, source_scid,
comparison_result = comparison_result + res
total_percent = total_percent + node_percent
- msg = "Successfully compare the specified schemas."
+ msg = gettext("Successfully compare the specified schemas.")
total_percent = 100
diff_model_obj.set_comparison_info(msg, total_percent)
# Update the message and total percentage done in session object
@@ -501,7 +501,7 @@ def poll(trans_id):
msg, diff_percentage = diff_model_obj.get_comparison_info()
if diff_percentage == 100:
- diff_model_obj.set_comparison_info("Comparing objects...", 0)
+ diff_model_obj.set_comparison_info(gettext("Comparing objects..."), 0)
update_session_diff_transaction(trans_id, session_obj,
diff_model_obj)
diff --git a/web/pgadmin/tools/schema_diff/compare.py b/web/pgadmin/tools/schema_diff/compare.py
index 40d4382bb..7459b849b 100644
--- a/web/pgadmin/tools/schema_diff/compare.py
+++ b/web/pgadmin/tools/schema_diff/compare.py
@@ -12,6 +12,7 @@
import copy
from flask import render_template
+from flask_babelex import gettext
from pgadmin.utils.driver import get_driver
from config import PG_DEFAULT_DRIVER
from pgadmin.utils.ajax import internal_server_error
@@ -86,7 +87,7 @@ class SchemaDiffObjectCompare:
return compare_dictionaries(self, source_params, target_params,
target_schema, source, target,
self.node_type,
- self.blueprint.COLLECTION_LABEL,
+ gettext(self.blueprint.COLLECTION_LABEL),
self.keys_to_ignore)
def ddl_compare(self, **kwargs):
diff --git a/web/pgadmin/tools/schema_diff/model.py b/web/pgadmin/tools/schema_diff/model.py
index 499ecca15..7ab3318e0 100644
--- a/web/pgadmin/tools/schema_diff/model.py
+++ b/web/pgadmin/tools/schema_diff/model.py
@@ -7,6 +7,7 @@
#
##########################################################################
+from flask_babelex import gettext
class SchemaDiffModel(object):
"""
@@ -30,7 +31,7 @@ class SchemaDiffModel(object):
**kwargs : N number of parameters
"""
self._comparison_result = dict()
- self._comparison_msg = 'Comparision started...'
+ self._comparison_msg = gettext('Comparision started...')
self._comparison_percentage = 0
def clear_data(self):
diff --git a/web/pgadmin/tools/schema_diff/static/js/schema_diff.backform.js b/web/pgadmin/tools/schema_diff/static/js/schema_diff.backform.js
index ae3a7eebb..4af8857b2 100644
--- a/web/pgadmin/tools/schema_diff/static/js/schema_diff.backform.js
+++ b/web/pgadmin/tools/schema_diff/static/js/schema_diff.backform.js
@@ -289,11 +289,11 @@ let SchemaDiffHeaderView = Backform.Form.extend({
},
template: _.template(`
<div class="row pgadmin-control-group">
- <div class="col-1 control-label">Select Source</div>
+ <div class="col-1 control-label">` + gettext('Select Source') + `</div>
<div class="col-6 source row"></div>
</div>
<div class="row pgadmin-control-group">
- <div class="col-1 control-label">Select Target</div>
+ <div class="col-1 control-label">` + gettext('Select Target') + `</div>
<div class="col-6 target row"></div>
<div class="col-5 target-buttons">
<div class="action-btns d-flex">
@@ -421,9 +421,9 @@ let SchemaDiffFooterView = Backform.Form.extend({
template: {
'content': _.template(`
<div class="pg-el-sm-12 row <%=contentClass%>">
- <div class="pg-el-sm-4 ddl-source">Source</div>
- <div class="pg-el-sm-4 ddl-target">Target</div>
- <div class="pg-el-sm-4 ddl-diff">Difference
+ <div class="pg-el-sm-4 ddl-source">` + gettext('Source') + `</div>
+ <div class="pg-el-sm-4 ddl-target">` + gettext('Target') + `</div>
+ <div class="pg-el-sm-4 ddl-diff">` + gettext('Difference') + `
</div>
</div>
</div>
diff --git a/web/pgadmin/tools/schema_diff/static/js/schema_diff.js b/web/pgadmin/tools/schema_diff/static/js/schema_diff.js
index eb7719859..f0c75f224 100644
--- a/web/pgadmin/tools/schema_diff/static/js/schema_diff.js
+++ b/web/pgadmin/tools/schema_diff/static/js/schema_diff.js
@@ -85,7 +85,7 @@ define('pgadmin.schemadiff', [
})
.done(function(res) {
self.trans_id = res.data.schemaDiffTransId;
- res.data.panel_title = 'Schema Diff (Beta)'; //TODO: Set the panel title
+ res.data.panel_title = gettext('Schema Diff (Beta)'); //TODO: Set the panel title
// TODO: Following function is used to test the fetching of the
// databases this should be moved to server selection event later.
self.launch_schema_diff(res.data);
diff --git a/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js b/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js
index a5008db08..6bde4a846 100644
--- a/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js
+++ b/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js
@@ -302,11 +302,11 @@ export default class SchemaDiffUI {
var grid_width = (self.grid_width - 47) / 2 ;
var columns = [
checkboxSelector.getColumnDefinition(),
- {id: 'title', name: 'Schema Objects', field: 'title', minWidth: grid_width, formatter: formatColumnTitle},
- {id: 'status', name: 'Comparison Result', field: 'status', minWidth: grid_width},
- {id: 'label', name: 'Schema Objects', field: 'label', width: 0, minWidth: 0, maxWidth: 0,
+ {id: 'title', name: gettext('Schema Objects'), field: 'title', minWidth: grid_width, formatter: formatColumnTitle},
+ {id: 'status', name: gettext('Comparison Result'), field: 'status', minWidth: grid_width},
+ {id: 'label', name: gettext('Schema Objects'), field: 'label', width: 0, minWidth: 0, maxWidth: 0,
cssClass: 'really-hidden', headerCssClass: 'really-hidden'},
- {id: 'type', name: 'Schema Objects', field: 'type', width: 0, minWidth: 0, maxWidth: 0,
+ {id: 'type', name: gettext('Schema Objects'), field: 'type', width: 0, minWidth: 0, maxWidth: 0,
cssClass: 'really-hidden', headerCssClass: 'really-hidden'},
{id: 'id', name: 'id', field: 'id', width: 0, minWidth: 0, maxWidth: 0,
cssClass: 'really-hidden', headerCssClass: 'really-hidden' },
@@ -462,10 +462,10 @@ export default class SchemaDiffUI {
.done(function (res) {
let msg = res.data.compare_msg;
if (res.data.diff_percentage != 100) {
- msg = msg + ' (this may take a few minutes)...';
+ msg = msg + gettext(' (this may take a few minutes)...');
}
- msg = msg + '<br>'+ res.data.diff_percentage + '% completed.';
+ msg = msg + '<br>' + gettext('%s completed.', res.data.diff_percentage + '%');
$('#diff_fetching_data').find('.schema-diff-busy-text').html(msg);
})
.fail(function (xhr) {
diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
index 274fcb87d..4fc4f329b 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
@@ -2237,7 +2237,7 @@ define('tools.querytool', [
self.trigger('pgadmin-sqleditor:loading-icon:hide');
- self.gridView.set_editor_title(`(${gettext('Obtaining connection...')} ${_.unescape(url_params.title)}`);
+ self.gridView.set_editor_title('(' + gettext('Obtaining connection...') + ` ${_.unescape(url_params.title)}`);
let afterConn = function() {
let enableBtns = [];
diff --git a/web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py b/web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py
index 114046f6c..a4d74e860 100644
--- a/web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py
+++ b/web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py
@@ -212,9 +212,9 @@ def RegisterQueryToolPreferences(self):
'CSV_output', 'csv_quoting',
gettext("CSV quoting"), 'options', 'strings',
category_label=gettext('CSV Output'),
- options=[{'label': 'None', 'value': 'none'},
- {'label': 'All', 'value': 'all'},
- {'label': 'Strings', 'value': 'strings'}],
+ options=[{'label': gettext('None'), 'value': 'none'},
+ {'label': gettext('All'), 'value': 'all'},
+ {'label': gettext('Strings'), 'value': 'strings'}],
select2={
'allowClear': False,
'tags': False
@@ -240,7 +240,7 @@ def RegisterQueryToolPreferences(self):
options=[{'label': ';', 'value': ';'},
{'label': ',', 'value': ','},
{'label': '|', 'value': '|'},
- {'label': 'Tab', 'value': '\t'}],
+ {'label': gettext('Tab'), 'value': '\t'}],
select2={
'allowClear': False,
'tags': True
@@ -262,9 +262,9 @@ def RegisterQueryToolPreferences(self):
'Results_grid', 'results_grid_quoting',
gettext("Result copy quoting"), 'options', 'strings',
category_label=gettext('Results grid'),
- options=[{'label': 'None', 'value': 'none'},
- {'label': 'All', 'value': 'all'},
- {'label': 'Strings', 'value': 'strings'}],
+ options=[{'label': gettext('None'), 'value': 'none'},
+ {'label': gettext('All'), 'value': 'all'},
+ {'label': gettext('Strings'), 'value': 'strings'}],
select2={
'allowClear': False,
'tags': False
@@ -290,7 +290,7 @@ def RegisterQueryToolPreferences(self):
options=[{'label': ';', 'value': ';'},
{'label': ',', 'value': ','},
{'label': '|', 'value': '|'},
- {'label': 'Tab', 'value': '\t'}],
+ {'label': gettext('Tab'), 'value': '\t'}],
select2={
'allowClear': False,
'tags': True
diff --git a/web/pgadmin/tools/user_management/static/js/user_management.js b/web/pgadmin/tools/user_management/static/js/user_management.js
index 64014863f..2b1ed1727 100644
--- a/web/pgadmin/tools/user_management/static/js/user_management.js
+++ b/web/pgadmin/tools/user_management/static/js/user_management.js
@@ -27,7 +27,7 @@ define([
userFilter = function(collection) {
return (new Backgrid.Extension.ClientSideFilter({
collection: collection,
- placeholder: _('Filter by email'),
+ placeholder: gettext('Filter by email'),
// How long to wait after typing has stopped before searching can start
wait: 150,
}));
@@ -763,7 +763,7 @@ define([
<div class="input-group-prepend">
<span class="input-group-text fa fa-search" id="labelSearch"></span>
</div>
- <input type="search" class="form-control" id="txtGridSearch" placeholder="Search" aria-label="Search" aria-describedby="labelSearch" />
+ <input type="search" class="form-control" id="txtGridSearch" placeholder="` + gettext('Search') + `" aria-label="Search" aria-describedby="labelSearch" />
</div>
<button id="btn_refresh" type="button" class="btn btn-secondary btn-navtab-inline add" title="Add">
<span class="fa fa-plus "></span>
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgAdmin 4 - gettext usage fixes
@ 2020-03-24 05:35 Aditya Toshniwal <[email protected]>
parent: Aditya Toshniwal <[email protected]>
0 siblings, 1 reply; 5+ messages in thread
From: Aditya Toshniwal @ 2020-03-24 05:35 UTC (permalink / raw)
To: Libor M. <[email protected]>; +Cc: pgadmin-hackers; Akshay Joshi <[email protected]>
Hi Hackers,
Please find the updated patch with pep8, linter issues fixed.
On Mon, Mar 23, 2020 at 8:31 PM Aditya Toshniwal <
[email protected]> wrote:
> Hi Libor,
>
> Thank you for the patch. It is good clean up patch.
> I've made a few changes in the patch. You've imported sprintf which was
> not required since gettext also works as sprintf directly.
> I've also created a housekeeping redmine ticket to track it -
> https://redmine.postgresql.org/issues/5284
>
> The messages compile fine. The patch can be committed.
> Please find the attached updated patch.
>
>
>
> On Mon, Mar 23, 2020 at 4:00 PM Akshay Joshi <
> [email protected]> wrote:
>
>> Hi Aditya
>>
>> Can you please review this?
>>
>> On Mon, Mar 23, 2020 at 5:00 AM Libor M. <[email protected]> wrote:
>>
>>> Hello,
>>> I fixed using gettext function and add more usages for translations,
>>> specifically:
>>>
>>> - fixed usage gettext('') instead of _('') in javascript files
>>> - fixed usage gettext('') instead of `${gettext('')}` in javascript
>>> files, because "pybabel extract" not support extracting from this
>>> syntax
>>> - added a lot of gettext for support translations
>>>
>>> Diff file is attached.
>>>
>>> Best regards,
>>>
>>> Libor M.
>>>
>>> E-mail: [email protected]
>>> GitHub: https://github.com/liborm85
>>>
>>
>>
>> --
>> *Thanks & Regards*
>> *Akshay Joshi*
>>
>> *Sr. Software Architect*
>> *EnterpriseDB Software India Private Limited*
>> *Mobile: +91 976-788-8246*
>>
>
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> pgAdmin Hacker | Sr. Software Engineer | EnterpriseDB India | Pune
> "Don't Complain about Heat, Plant a TREE"
>
--
Thanks and Regards,
Aditya Toshniwal
pgAdmin Hacker | Sr. Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"
Attachments:
[application/octet-stream] RM5284_v2.patch (56.2K, 3-RM5284_v2.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py
index beaa65eb6..3c96c1051 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -1266,13 +1266,14 @@ class ServerNode(PGChildNodeView):
data={
'status': 1,
'result': gettext(
- 'Named restore point created: {0}'.format(
- restore_point_name))
+ 'Named restore point created: {0}').format(
+ restore_point_name)
})
except Exception as e:
- current_app.logger.error(
- 'Named restore point creation failed ({0})'.format(str(e))
+ current_app.logger.error(gettext(
+ 'Named restore point creation failed ({0})').format(
+ str(e))
)
return internal_server_error(errormsg=str(e))
diff --git a/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
index c012b9586..41cb0d0ac 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
@@ -50,7 +50,7 @@ class CastModule(CollectionNodeModule):
"""
NODE_TYPE = 'cast'
- COLLECTION_LABEL = 'Casts'
+ COLLECTION_LABEL = gettext('Casts')
def __init__(self, *args, **kwargs):
super(CastModule, self).__init__(*args, **kwargs)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger.js b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger.js
index 983389df6..add08f08a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger.js
@@ -111,10 +111,10 @@ define('pgadmin.node.event_trigger', [
id: 'enabled', label: gettext('Trigger enabled?'),
group: gettext('Definition'), mode: ['properties', 'edit','create'],
options: [
- {label: 'Enable', value: 'O'},
- {label: 'Disable', value: 'D'},
- {label: 'Replica', value: 'R'},
- {label: 'Always', value: 'A'},
+ {label: gettext('Enable'), value: 'O'},
+ {label: gettext('Disable'), value: 'D'},
+ {label: gettext('Replica'), value: 'R'},
+ {label: gettext('Always'), value: 'A'},
],
control: 'select2', select2: { allowClear: false, width: '100%' },
},{
@@ -125,9 +125,9 @@ define('pgadmin.node.event_trigger', [
id: 'eventname', label: gettext('Event'),
group: gettext('Definition'), cell: 'string',
options: [
- {label: 'DDL COMMAND START', value: 'DDL_COMMAND_START'},
- {label: 'DDL COMMAND END', value: 'DDL_COMMAND_END'},
- {label: 'SQL DROP', value: 'SQL_DROP'},
+ {label: gettext('DDL COMMAND START'), value: 'DDL_COMMAND_START'},
+ {label: gettext('DDL COMMAND END'), value: 'DDL_COMMAND_END'},
+ {label: gettext('SQL DROP'), value: 'SQL_DROP'},
],
control: 'select2', select2: { allowClear: false, width: '100%' },
},{
diff --git a/web/pgadmin/browser/server_groups/servers/databases/external_tables/properties.py b/web/pgadmin/browser/server_groups/servers/databases/external_tables/properties.py
index 88f20a15d..da1b2c5fc 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/external_tables/properties.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/external_tables/properties.py
@@ -52,8 +52,8 @@ class Properties:
execute_on_text = self.translate_execute_on_text(execute_on)
response = dict(
name=table_information_result['name'],
- type=gettext('readable' if not table_information_result[
- 'writable'] else 'writable'),
+ type=gettext('readable') if not table_information_result[
+ 'writable'] else gettext('writable'),
format_type=table_information_result['pg_encoding_to_char'],
format_options=table_information_result['fmtopts'],
external_options=table_information_result['options'],
@@ -65,14 +65,14 @@ class Properties:
@staticmethod
def translate_execute_on_text(execute_on):
if execute_on['type'] == 'host':
- return 'host %s' % execute_on['value']
+ return gettext('host %s') % execute_on['value']
elif execute_on['type'] == 'per_host':
- return 'per host'
+ return gettext('per host')
elif execute_on['type'] == 'master_only':
- return 'master segment'
+ return gettext('master segment')
elif execute_on['type'] == 'all_segments':
- return 'all segments'
+ return gettext('all segments')
elif execute_on['type'] == 'segment':
- return '%s segment' % execute_on['value']
+ return gettext('%s segment') % execute_on['value']
elif execute_on['type'] == 'segments':
- return '%d segments' % execute_on['value']
+ return gettext('%d segments') % execute_on['value']
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.js
index fd7e06cff..3c5c091ba 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.js
@@ -450,7 +450,7 @@ define('pgadmin.node.exclusion_constraint', [
titleTmpl = _.template([
'<div class="subnode-header">',
' <label class="control-label pg-el-sm-10"><%-label%></label>',
- ' <button class="btn btn-sm-sq btn-secondary add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%> title="' + _('Add new row') + '"></button>',
+ ' <button class="btn btn-sm-sq btn-secondary add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%> title="' + gettext('Add new row') + '"></button>',
'</div>'].join('\n')),
$gridBody =
$('<div class=\'pgadmin-control-group backgrid form-group col-12 object subnode\'></div>').append(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js
index 8695f8bd1..66083151f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js
@@ -378,7 +378,7 @@ define('pgadmin.node.foreign_key', [
titleTmpl = _.template([
'<div class="subnode-header">',
' <label class="control-label pg-el-sm-10"><%-label%></label>',
- ' <button class="btn btn-sm-sq btn-secondary add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%> title="' + _('Add new row') + '"></button>',
+ ' <button class="btn btn-sm-sq btn-secondary add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%> title="' + gettext('Add new row') + '"></button>',
'</div>'].join('\n')),
$gridBody =
$('<div class=\'pgadmin-control-group backgrid form-group col-12 object subnode\'></div>').append(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js
index 005242a4a..928342895 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js
@@ -71,12 +71,12 @@ function(
// To enable/disable all triggers for the table
name: 'enable_all_triggers', node: 'partition', module: this,
applies: ['object', 'context'], callback: 'enable_triggers_on_table',
- category: 'Trigger(s)', priority: 4, label: gettext('Enable All'),
+ category: gettext('Trigger(s)'), priority: 4, label: gettext('Enable All'),
icon: 'fa fa-check', enable : 'canCreate_with_trigger_enable',
},{
name: 'disable_all_triggers', node: 'partition', module: this,
applies: ['object', 'context'], callback: 'disable_triggers_on_table',
- category: 'Trigger(s)', priority: 4, label: gettext('Disable All'),
+ category: gettext('Trigger(s)'), priority: 4, label: gettext('Disable All'),
icon: 'fa fa-times', enable : 'canCreate_with_trigger_disable',
},{
name: 'reset_table_stats', node: 'partition', module: this,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js
index f197b6546..61761794f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js
@@ -82,23 +82,23 @@ define('pgadmin.node.table', [
},{
name: 'truncate_table', node: 'table', module: this,
applies: ['object', 'context'], callback: 'truncate_table',
- category: 'Truncate', priority: 3, label: gettext('Truncate'),
+ category: gettext('Truncate'), priority: 3, label: gettext('Truncate'),
icon: 'fa fa-eraser', enable : 'canCreate',
},{
name: 'truncate_table_cascade', node: 'table', module: this,
applies: ['object', 'context'], callback: 'truncate_table_cascade',
- category: 'Truncate', priority: 3, label: gettext('Truncate Cascade'),
+ category: gettext('Truncate'), priority: 3, label: gettext('Truncate Cascade'),
icon: 'fa fa-eraser', enable : 'canCreate',
},{
// To enable/disable all triggers for the table
name: 'enable_all_triggers', node: 'table', module: this,
applies: ['object', 'context'], callback: 'enable_triggers_on_table',
- category: 'Trigger(s)', priority: 4, label: gettext('Enable All'),
+ category: gettext('Trigger(s)'), priority: 4, label: gettext('Enable All'),
icon: 'fa fa-check', enable : 'canCreate_with_trigger_enable',
},{
name: 'disable_all_triggers', node: 'table', module: this,
applies: ['object', 'context'], callback: 'disable_triggers_on_table',
- category: 'Trigger(s)', priority: 4, label: gettext('Disable All'),
+ category: gettext('Trigger(s)'), priority: 4, label: gettext('Disable All'),
icon: 'fa fa-times', enable : 'canCreate_with_trigger_disable',
},{
name: 'reset_table_stats', node: 'table', module: this,
diff --git a/web/pgadmin/browser/server_groups/servers/static/js/variable.js b/web/pgadmin/browser/server_groups/servers/static/js/variable.js
index 329967e08..981582945 100644
--- a/web/pgadmin/browser/server_groups/servers/static/js/variable.js
+++ b/web/pgadmin/browser/server_groups/servers/static/js/variable.js
@@ -338,7 +338,7 @@ function(gettext, _, $, Backbone, Backform, Backgrid, Alertify, pgAdmin, pgNode)
titleTmpl = _.template([
'<div class=\'subnode-header\'>',
'<span class=\'control-label\'><%-label%></span>',
- '<button class=\'btn btn-sm-sq btn-secondary add fa fa-plus\' title=\'' + _('Add new row') + '\' <%=canAdd ? \'\' : \'disabled="disabled"\'%>><span class="sr-only">Add new row</span></button>',
+ '<button class=\'btn btn-sm-sq btn-secondary add fa fa-plus\' title=\'' + gettext('Add new row') + '\' <%=canAdd ? \'\' : \'disabled="disabled"\'%>><span class="sr-only">' + gettext('Add new row') + '</span></button>',
'</div>'].join('\n')),
$gridBody =
$('<div class=\'pgadmin-control-group backgrid form-group col-12 object subnode\'></div>').append(
diff --git a/web/pgadmin/browser/server_groups/servers/templates/servers/password.html b/web/pgadmin/browser/server_groups/servers/templates/servers/password.html
index afdfbfe96..9fc0b3945 100644
--- a/web/pgadmin/browser/server_groups/servers/templates/servers/password.html
+++ b/web/pgadmin/browser/server_groups/servers/templates/servers/password.html
@@ -15,7 +15,7 @@
<input class="custom-control-input" id="save_password" name="save_password" type="checkbox"
{% if not config.ALLOW_SAVE_PASSWORD %}disabled{% endif %}
>
- <label class="custom-control-label" for="save_password">Save Password</label>
+ <label class="custom-control-label" for="save_password">{{ _('Save Password') }}</label>
</div>
</div>
</div>
diff --git a/web/pgadmin/browser/server_groups/servers/templates/servers/tunnel_password.html b/web/pgadmin/browser/server_groups/servers/templates/servers/tunnel_password.html
index 5ae7d2fde..8724c8035 100644
--- a/web/pgadmin/browser/server_groups/servers/templates/servers/tunnel_password.html
+++ b/web/pgadmin/browser/server_groups/servers/templates/servers/tunnel_password.html
@@ -35,7 +35,7 @@
<input class="custom-control-input" id="save_password" name="save_password" type="checkbox"
{% if not config.ALLOW_SAVE_PASSWORD %}disabled{% endif %}
>
- <label class="custom-control-label" for="save_password" class="ml-1">Save Password</label>
+ <label class="custom-control-label" for="save_password" class="ml-1">{{ _('Save Password') }}</label>
</div>
</div>
</div>
diff --git a/web/pgadmin/browser/static/js/collection.js b/web/pgadmin/browser/static/js/collection.js
index e2e9c462e..2ec4fe1b5 100644
--- a/web/pgadmin/browser/static/js/collection.js
+++ b/web/pgadmin/browser/static/js/collection.js
@@ -183,7 +183,7 @@ define([
}
// Initialize a new Grid instance
that.grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: gridSchema.columns,
collection: that.collection,
className: 'backgrid table presentation table-bordered table-noouter-border table-hover',
diff --git a/web/pgadmin/browser/static/js/node.js b/web/pgadmin/browser/static/js/node.js
index 224caa33b..029a29817 100644
--- a/web/pgadmin/browser/static/js/node.js
+++ b/web/pgadmin/browser/static/js/node.js
@@ -216,7 +216,7 @@ define('pgadmin.browser.node', [
callback: 'show_script',
priority: 4,
label: type_label,
- category: 'Scripts',
+ category: gettext('Scripts'),
data: {
'script': stype,
},
diff --git a/web/pgadmin/browser/static/js/node.ui.js b/web/pgadmin/browser/static/js/node.ui.js
index 878497165..d81d8548b 100644
--- a/web/pgadmin/browser/static/js/node.ui.js
+++ b/web/pgadmin/browser/static/js/node.ui.js
@@ -113,7 +113,7 @@ define([
url_with_id: false,
select2: {
allowClear: true,
- placeholder: 'Select an item...',
+ placeholder: gettext('Select an item...'),
width: 'style',
},
}),
@@ -256,7 +256,7 @@ define([
},
select2: {
allowClear: true,
- placeholder: 'Select an item...',
+ placeholder: gettext('Select an item...'),
width: 'style',
templateResult: formatNode,
templateSelection: formatNode,
@@ -375,7 +375,7 @@ define([
url_with_id: false,
select2: {
allowClear: true,
- placeholder: 'Select an item...',
+ placeholder: gettext('Select an item...'),
width: 'style',
},
opt: {
@@ -510,7 +510,7 @@ define([
return res;
},
select2: {
- placeholder: 'Select an item...',
+ placeholder: gettext('Select an item...'),
width: 'style',
templateResult: formatNode,
templateSelection: formatNode,
@@ -555,7 +555,7 @@ define([
return res;
},
select2: {
- placeholder: 'Select an item...',
+ placeholder: gettext('Select an item...'),
width: 'style',
templateResult: formatNode,
templateSelection: formatNode,
@@ -570,7 +570,7 @@ define([
url_with_id: false,
select2: {
allowClear: true,
- placeholder: 'Select an item...',
+ placeholder: gettext('Select an item...'),
width: 'style',
multiple: true,
},
diff --git a/web/pgadmin/browser/templates/browser/master_password.html b/web/pgadmin/browser/templates/browser/master_password.html
index e1b95b1e2..763a9bcb1 100644
--- a/web/pgadmin/browser/templates/browser/master_password.html
+++ b/web/pgadmin/browser/templates/browser/master_password.html
@@ -2,7 +2,7 @@
<div>
<div><b>{{ content_text|safe }}</b></div>
<div class="input-group row py-2">
- <label for="password" class="col-sm-2 col-form-label">Password</label>
+ <label for="password" class="col-sm-2 col-form-label">{{ _('Password') }}</label>
<div class="col-sm-10">
<input type="password" class="form-control" id="password" name="password">
</div>
diff --git a/web/pgadmin/dashboard/static/js/dashboard.js b/web/pgadmin/dashboard/static/js/dashboard.js
index 61e71f076..6fc82546c 100644
--- a/web/pgadmin/dashboard/static/js/dashboard.js
+++ b/web/pgadmin/dashboard/static/js/dashboard.js
@@ -673,7 +673,7 @@ define('pgadmin.dashboard', [
// Set up the grid
var grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: columns,
collection: data,
className: 'backgrid presentation table table-bordered table-noouter-border table-hover',
diff --git a/web/pgadmin/dashboard/templates/dashboard/server_dashboard.html b/web/pgadmin/dashboard/templates/dashboard/server_dashboard.html
index 437b01ea0..2cceb4d86 100644
--- a/web/pgadmin/dashboard/templates/dashboard/server_dashboard.html
+++ b/web/pgadmin/dashboard/templates/dashboard/server_dashboard.html
@@ -87,7 +87,7 @@
<div class="input-group-prepend">
<span class="input-group-text fa fa-search" id="labelSearch"></span>
</div>
- <input type="search" class="form-control" id="txtGridSearch" placeholder="Search" aria-label="Search" aria-describedby="labelSearch">
+ <input type="search" class="form-control" id="txtGridSearch" placeholder="{{ _('Search') }}" aria-label="Search" aria-describedby="labelSearch">
</div>
<button id="btn_refresh" type="button" class="btn btn-secondary btn-navtab-inline" title="{{ _('Refresh') }}" aria-label="{{ _('Refresh') }}">
<span class="fa fa-refresh" aria-hidden="true"></span>
diff --git a/web/pgadmin/misc/bgprocess/static/js/bgprocess.js b/web/pgadmin/misc/bgprocess/static/js/bgprocess.js
index e63466a0e..f80a42599 100644
--- a/web/pgadmin/misc/bgprocess/static/js/bgprocess.js
+++ b/web/pgadmin/misc/bgprocess/static/js/bgprocess.js
@@ -311,8 +311,8 @@ define('misc.bgprocess', [
</div>
<div class="pg-bg-etime my-auto mr-2"></div>
<div class="ml-auto">
- <button class="btn btn-secondary pg-bg-more-details"><span class="fa fa-info-circle" role="img"></span> ${gettext('More details...')}</button>
- <button class="btn btn-danger bg-process-stop"><span class="fa fa-times-circle" role="img"></span> ${gettext('Stop Process')}</button>
+ <button class="btn btn-secondary pg-bg-more-details"><span class="fa fa-info-circle" role="img"></span> ` + gettext('More details...') + `</button>
+ <button class="btn btn-danger bg-process-stop"><span class="fa fa-times-circle" role="img"></span> ` + gettext('Stop Process') + `</button>
</div>
</div>
<div class="pg-bg-status py-1">
@@ -393,7 +393,7 @@ define('misc.bgprocess', [
is_new = true;
panel = this.panel =
pgBrowser.BackgroundProcessObsorver.create_panel();
- panel.title('Process Watcher - ' + self.type_desc);
+ panel.title(gettext('Process Watcher - %s', self.type_desc));
panel.focus();
}
@@ -419,7 +419,7 @@ define('misc.bgprocess', [
setTimeout(function() {
self.logs[0].scrollTop = self.logs[0].scrollHeight;
});
- self.logs_loading = $(`<li class="pg-bg-res-out loading-logs">${gettext('Loading process logs...')}</li>`);
+ self.logs_loading = $('<li class="pg-bg-res-out loading-logs">' + gettext('Loading process logs...') + '</li>');
self.logs.append(self.logs_loading);
// set bgprocess detailed description
$header.find('.bg-detailed-desc').html(self.detailed_desc);
diff --git a/web/pgadmin/misc/dependencies/static/js/dependencies.js b/web/pgadmin/misc/dependencies/static/js/dependencies.js
index f59c2c565..bab26019f 100644
--- a/web/pgadmin/misc/dependencies/static/js/dependencies.js
+++ b/web/pgadmin/misc/dependencies/static/js/dependencies.js
@@ -75,7 +75,7 @@ define('misc.dependencies', [
var $container = this.dependenciesPanel.layout().scene().find('.pg-panel-content'),
$gridContainer = $container.find('.pg-panel-dependencies-container'),
grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: [{
name: 'type',
label: gettext('Type'),
diff --git a/web/pgadmin/misc/dependents/static/js/dependents.js b/web/pgadmin/misc/dependents/static/js/dependents.js
index 357198084..5f6007f1d 100644
--- a/web/pgadmin/misc/dependents/static/js/dependents.js
+++ b/web/pgadmin/misc/dependents/static/js/dependents.js
@@ -76,7 +76,7 @@ define('misc.dependents', [
var $container = this.dependentsPanel.layout().scene().find('.pg-panel-content'),
$gridContainer = $container.find('.pg-panel-dependents-container'),
grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: [{
name: 'type',
label: gettext('Type'),
diff --git a/web/pgadmin/misc/file_manager/static/js/utility.js b/web/pgadmin/misc/file_manager/static/js/utility.js
index 2cc1aba87..04060b77d 100644
--- a/web/pgadmin/misc/file_manager/static/js/utility.js
+++ b/web/pgadmin/misc/file_manager/static/js/utility.js
@@ -1258,12 +1258,12 @@ define([
}
select_box = `<div class='change_file_types d-flex align-items-center p-1'>
- <div>
- ${gettext('Show hidden files and folders')}?
- <input type='checkbox' id='show_hidden' onclick='pgAdmin.FileUtils.handleClick(this)' tabindex='0'>
+ <div>` +
+ gettext('Show hidden files and folders?') +
+ `<input type='checkbox' id='show_hidden' onclick='pgAdmin.FileUtils.handleClick(this)' tabindex='0'>
</div>
<div class="ml-auto">
- <label class="my-auto">${gettext('Format')}</label>
+ <label class="my-auto">` + gettext('Format') + `</label>
<select name='type' tabindex='0'>${fileFormats}</select>
<div>`;
}
diff --git a/web/pgadmin/misc/statistics/static/js/statistics.js b/web/pgadmin/misc/statistics/static/js/statistics.js
index 657d47463..ebce79265 100644
--- a/web/pgadmin/misc/statistics/static/js/statistics.js
+++ b/web/pgadmin/misc/statistics/static/js/statistics.js
@@ -282,7 +282,7 @@ define('misc.statistics', [
}
self.grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: self.columns,
collection: self.collection,
className: GRID_CLASSES,
diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js
index a44d1a83a..a57f70ebc 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -609,11 +609,11 @@ define([
if(this.$el.find('.toggle.btn').hasClass('off')) {
this.$el.find('.sr-value').text(`
- ${label}, ${offText}, ${gettext('Toggle button')}
+ ${label}, ${offText}, ` + gettext('Toggle button') + `
`);
} else {
this.$el.find('.sr-value').text(`
- ${label}, ${onText}, ${gettext('Toggle button')}
+ ${label}, ${onText}, ` + gettext('Toggle button') + `
`);
}
},
@@ -1295,7 +1295,7 @@ define([
gridHeader = _.template([
'<div class="subnode-header">',
' <span class="control-label pg-el-sm-10" id="<%=cId%>"><%-label%></span>',
- ' <button aria-label="' + _('Add new row') + '" class="btn btn-sm-sq btn-secondary add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%> title="' + _('Add new row') + '"><%-add_label%></button>',
+ ' <button aria-label="' + gettext('Add new row') + '" class="btn btn-sm-sq btn-secondary add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%> title="' + gettext('Add new row') + '"><%-add_label%></button>',
'</div>',
].join('\n')),
gridBody = $('<div class="pgadmin-control-group backgrid form-group pg-el-12 object subnode "></div>').append(
@@ -1582,7 +1582,7 @@ define([
var self = this,
gridHeader = ['<div class=\'subnode-header\'>',
' <span class=\'control-label pg-el-sm-10\'>' + data.label + '</span>',
- ' <button aria-label="' + _('Add') + '" class=\'btn btn-sm-sq btn-secondary add fa fa-plus\' title=\'' + _('Add new row') + '\'></button>',
+ ' <button aria-label="' + gettext('Add') + '" class=\'btn btn-sm-sq btn-secondary add fa fa-plus\' title=\'' + gettext('Add new row') + '\'></button>',
'</div>',
].join('\n'),
gridBody = $('<div class=\'pgadmin-control-group backgrid form-group pg-el-12 object subnode\'></div>').append(gridHeader);
diff --git a/web/pgadmin/static/js/backgrid.pgadmin.js b/web/pgadmin/static/js/backgrid.pgadmin.js
index a64897b20..230d7ce56 100644
--- a/web/pgadmin/static/js/backgrid.pgadmin.js
+++ b/web/pgadmin/static/js/backgrid.pgadmin.js
@@ -432,7 +432,7 @@ define([
if (editable) {
this.$el.html(
- '<i class=\'fa fa-pencil-square subnode-edit-in-process\' title=\'' + _('Edit row') + '\' aria-label=\'' + _('Edit row') + '\'></i>'
+ '<i class=\'fa fa-pencil-square subnode-edit-in-process\' title=\'' + gettext('Edit row') + '\' aria-label=\'' + gettext('Edit row') + '\'></i>'
);
let body = $(this.$el).parents()[1],
container = $(body).find('.tab-content:first > .tab-pane.active:first');
@@ -451,7 +451,7 @@ define([
},
render: function() {
this.$el.empty();
- this.$el.html('<i class=\'fa fa-pencil-square-o\' title=\'' + _('Edit row') + '\' aria-label=\'' + _('Edit row') + '\'></i>');
+ this.$el.html('<i class=\'fa fa-pencil-square-o\' title=\'' + gettext('Edit row') + '\' aria-label=\'' + gettext('Edit row') + '\'></i>');
this.delegateEvents();
if (this.grabFocus)
this.$el.trigger('focus');
@@ -555,7 +555,7 @@ define([
var self = this;
this.$el.empty();
$(this.$el).attr('tabindex', 0);
- this.$el.html('<i aria-label="' + _('Delete row') + '" class=\'fa fa-trash\' title=\'' + _('Delete row') + '\'></i>');
+ this.$el.html('<i aria-label="' + gettext('Delete row') + '" class=\'fa fa-trash\' title=\'' + gettext('Delete row') + '\'></i>');
// Listen for Tab/Shift-Tab key
this.$el.on('keydown', function(e) {
// with keyboard navigation on space key, mark row for deletion
diff --git a/web/pgadmin/static/js/keyboard_shortcuts.js b/web/pgadmin/static/js/keyboard_shortcuts.js
index 5ba9b271a..fba3c9fb8 100644
--- a/web/pgadmin/static/js/keyboard_shortcuts.js
+++ b/web/pgadmin/static/js/keyboard_shortcuts.js
@@ -87,7 +87,7 @@ function shortcut_title(title, shortcut) {
* shortcut object is browser.get_preference().value
*/
function shortcut_accesskey_title(title, shortcut) {
- return `${title} (${gettext('accesskey')} + ${shortcut_key(shortcut)})`;
+ return `${title} (` + gettext('accesskey') + ` + ${shortcut_key(shortcut)})`;
}
diff --git a/web/pgadmin/static/js/sqleditor/calculate_query_run_time.js b/web/pgadmin/static/js/sqleditor/calculate_query_run_time.js
index f66629e55..5c7474339 100644
--- a/web/pgadmin/static/js/sqleditor/calculate_query_run_time.js
+++ b/web/pgadmin/static/js/sqleditor/calculate_query_run_time.js
@@ -8,6 +8,7 @@
//////////////////////////////////////////////////////////////
import moment from 'moment';
+import gettext from 'sources/gettext';
export function calculateQueryRunTime(startTime, endTime) {
let total_ms = moment(endTime).diff(startTime);
@@ -26,9 +27,9 @@ export function calculateQueryRunTime(startTime, endTime) {
hrs = parseInt(mins/60);
mins = mins%60;
- result = (hrs>0 ? hrs + ' hr ': '')
- + (mins>0 ? mins + ' min ': '')
- + (hrs<=0 && secs>0 ? secs + ' secs ': '')
- + (hrs<=0 && mins<=0 ? total_ms + ' msec ':'');
+ result = (hrs>0 ? hrs + ' ' + gettext('hr') + ' ': '')
+ + (mins>0 ? mins + ' ' + gettext('min') + ' ': '')
+ + (hrs<=0 && secs>0 ? secs + ' ' + gettext('secs') + ' ': '')
+ + (hrs<=0 && mins<=0 ? total_ms + ' ' + gettext('msec') + ' ':'');
return result.trim();
}
diff --git a/web/pgadmin/static/js/sqleditor/filter_dialog.js b/web/pgadmin/static/js/sqleditor/filter_dialog.js
index a060ce487..0ca1fed66 100644
--- a/web/pgadmin/static/js/sqleditor/filter_dialog.js
+++ b/web/pgadmin/static/js/sqleditor/filter_dialog.js
@@ -139,7 +139,7 @@ let FilterDialog = {
`<div id="show_filter_progress" class="pg-sp-container sql-editor-busy-fetching d-none">
<div class="pg-sp-content">
<div class="row"><div class="col-12 pg-sp-icon sql-editor-busy-icon"></div></div>
- <div class="row"><div class="col-12 pg-sp-text sql-editor-busy-text">${gettext('Loading data...')}</div></div>
+ <div class="row"><div class="col-12 pg-sp-text sql-editor-busy-text">` + gettext('Loading data...') + `</div></div>
</div>
</div>`
).appendTo($container);
diff --git a/web/pgadmin/static/js/sqleditor/history/query_history.js b/web/pgadmin/static/js/sqleditor/history/query_history.js
index 2e4228058..c171f7fbe 100644
--- a/web/pgadmin/static/js/sqleditor/history/query_history.js
+++ b/web/pgadmin/static/js/sqleditor/history/query_history.js
@@ -59,9 +59,9 @@ export default class QueryHistory {
this.parentNode.empty()
.removeClass('d-flex')
.append(
- `<div role="status" class='pg-panel-message'>${gettext(
- 'No history found'
- )}</div>`
+ '<div role="status" class="pg-panel-message">' +
+ gettext('No history found') +
+ '</div>'
);
} else {
this.parentNode.empty().addClass('d-flex');
diff --git a/web/pgadmin/static/js/sqleditor/history/query_history_details.js b/web/pgadmin/static/js/sqleditor/history/query_history_details.js
index 626e89b5a..8a884da00 100644
--- a/web/pgadmin/static/js/sqleditor/history/query_history_details.js
+++ b/web/pgadmin/static/js/sqleditor/history/query_history_details.js
@@ -87,10 +87,10 @@ export default class QueryHistoryDetails {
updateCopyButton(copied) {
if (copied) {
this.$copyBtn.addClass('was-copied').removeClass('copy-all');
- this.$copyBtn.text('Copied!');
+ this.$copyBtn.text(gettext('Copied!'));
} else {
this.$copyBtn.addClass('copy-all').removeClass('was-copied');
- this.$copyBtn.text('Copy');
+ this.$copyBtn.text(gettext('Copy'));
}
}
@@ -106,14 +106,14 @@ export default class QueryHistoryDetails {
};
this.$metaData.empty().append(
- `<div class='metadata'>
- ${itemTemplate(this.formatDate(this.entry.start_time), 'Date')}
- ${itemTemplate(
- this.entry.row_affected.toLocaleString(),
- 'Rows Affected'
- )}
- ${itemTemplate(this.entry.total_time, 'Duration')}
- </div>`
+ '<div class="metadata">' +
+ itemTemplate(this.formatDate(this.entry.start_time), gettext('Date')) +
+ itemTemplate(
+ this.entry.row_affected.toLocaleString(),
+ gettext('Rows Affected')
+ ) +
+ itemTemplate(this.entry.total_time, gettext('Duration')) +
+ '</div>'
);
}
@@ -179,7 +179,7 @@ export default class QueryHistoryDetails {
</div>
<div class='message-block'>
<div class='message'>
- <div class='message-header'>Messages</div>
+ <div class='message-header'>` + gettext('Messages') + `</div>
<div class='content'></div>
</div>
</div>
diff --git a/web/pgadmin/static/js/sqleditor/history/query_history_entries.js b/web/pgadmin/static/js/sqleditor/history/query_history_entries.js
index fcc20812e..8e58dc5aa 100644
--- a/web/pgadmin/static/js/sqleditor/history/query_history_entries.js
+++ b/web/pgadmin/static/js/sqleditor/history/query_history_entries.js
@@ -252,11 +252,11 @@ export class QueryHistoryEntries {
<div class="toggle-and-history-container">
<div class="query-history-toggle">
<label class="control-label">
- ${gettext('Show queries generated internally by pgAdmin')}?
+ ` + gettext('Show queries generated internally by pgAdmin?') + `
</label>
<input id="generated-queries-toggle" type="checkbox"
class="pgadmin-controls" data-style="quick"
- data-size="mini" data-on="${gettext('Yes')}" data-off="${gettext('No')}"
+ data-size="mini" data-on="` + gettext('Yes') + '" data-off="' + gettext('No') + `"
data-onstyle="success" data-offstyle="ternary" checked>
</div>
<div id='query_list' class='query-history' tabindex='0'></div>
diff --git a/web/pgadmin/static/js/sqleditor/query_tool_notifications.js b/web/pgadmin/static/js/sqleditor/query_tool_notifications.js
index cc01aa17a..aec3b6690 100644
--- a/web/pgadmin/static/js/sqleditor/query_tool_notifications.js
+++ b/web/pgadmin/static/js/sqleditor/query_tool_notifications.js
@@ -97,7 +97,7 @@ let queryToolNotifications = {
// Set up the grid
let notifications_grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: gridCols,
collection: queryToolNotifications.collection,
className: 'backgrid presentation table table-bordered table-hover table-noouter-border table-bottom-border',
diff --git a/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js b/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js
index ba87a3130..627ae3cdf 100644
--- a/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js
+++ b/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js
@@ -98,7 +98,7 @@ export class BackupDialogWrapper extends DialogWrapper {
const node = this.pgBrowser.Nodes[selectedTreeNodeData._type];
if (this.dialogTitle === null) {
- const title = `Backup (${node.label}: ${selectedTreeNodeData.label})`;
+ let title = gettext('Backup (%s: %s)', node.label, selectedTreeNodeData.label);
this.main(title);
}
diff --git a/web/pgadmin/tools/debugger/static/js/direct.js b/web/pgadmin/tools/debugger/static/js/direct.js
index 90493f357..179ded6c9 100644
--- a/web/pgadmin/tools/debugger/static/js/direct.js
+++ b/web/pgadmin/tools/debugger/static/js/direct.js
@@ -1047,7 +1047,7 @@ define([
// Initialize a new Grid instance
var stack_grid = this.stack_grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: stackGridCols,
row: Backgrid.Row.extend({
events: {
@@ -1112,7 +1112,7 @@ define([
// Initialize a new Grid instance
var result_grid = this.result_grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: resultGridCols,
collection: new ResultsCollection(result),
className: 'backgrid table table-bordered table-noouter-border table-bottom-border',
@@ -1190,7 +1190,7 @@ define([
// Initialize a new Grid instance
var variable_grid = this.variable_grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: gridCols,
collection: new VariablesCollection(my_obj),
className: 'backgrid table table-bordered table-noouter-border table-bottom-border',
@@ -1276,7 +1276,7 @@ define([
// Initialize a new Grid instance
var param_grid = this.param_grid = new Backgrid.Grid({
- emptyText: 'No data found',
+ emptyText: gettext('No data found'),
columns: paramGridCols,
collection: new ParametersCollection(param_obj),
className: 'backgrid table table-bordered table-noouter-border table-bottom-border',
diff --git a/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js b/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js
index e5f50fc7d..763edef57 100644
--- a/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js
+++ b/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js
@@ -251,7 +251,7 @@ define([
DbObjectFilter: function(coll) {
var clientSideFilter = this.clientSideFilter = new Backgrid.Extension.ClientSideFilter({
collection: coll,
- placeholder: _('Search by object type or name'),
+ placeholder: gettext('Search by object type or name'),
// The model fields to search for matches
fields: ['object_type', 'name'],
@@ -697,11 +697,11 @@ define([
*/
var dbObjectTypePage = self.dbObjectTypePage = new pgBrowser.WizardPage({
id: 1,
- page_title: _('Object Selection (step 1 of 3)'),
+ page_title: gettext('Object Selection (step 1 of 3)'),
disable_prev: true,
disable_next: true,
show_description: '',
- show_progress_bar: _('Please wait while fetching records...'),
+ show_progress_bar: gettext('Please wait while fetching records...'),
model: newModel,
view: new(function() {
@@ -735,13 +735,13 @@ define([
$(`
<div class="db_objects_container pg-el-xs-12">
<div class="db_objects_header d-flex py-1">
- <div>${_('Please select the objects to grant privileges to from the list below.')}</div>
+ <div>` + gettext('Please select the objects to grant privileges to from the list below.') + `</div>
<div class="db_objects_filter ml-auto">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text fa fa-search" id="labelSearch"></span>
</div>
- <input type="search" class="form-control" id="txtGridSearch" placeholder="Search" aria-label="Search" aria-describedby="labelSearch">
+ <input type="search" class="form-control" id="txtGridSearch" placeholder="` + gettext('Search') + `" aria-label="Search" aria-describedby="labelSearch">
</div>
</div>
</div>
@@ -822,8 +822,8 @@ define([
// Wizard for Privelege control
var privilegePage = self.privilegePage = new pgBrowser.WizardPage({
id: 2,
- page_title: _('Privilege Selection (step 2 of 3)'),
- show_description: _('Please add the required privileges for the selected objects.'),
+ page_title: gettext('Privilege Selection (step 2 of 3)'),
+ show_description: gettext('Please add the required privileges for the selected objects.'),
disable_next: true,
model: newModel,
@@ -1021,7 +1021,7 @@ define([
//Create SqlField Object
var sqlField = new Backform.Field({
id: 'sqltab',
- label: _('Sql Tab'),
+ label: gettext('Sql Tab'),
/**
Extend 'SqlTabControl' to define new
@@ -1091,8 +1091,8 @@ define([
// Wizard for SQL tab control
var reviewSQLPage = self.reviewSQLPage = new pgBrowser.WizardPage({
id: 3,
- page_title: _('Final (Review Selection) (step 3 of 3)'),
- show_description: _('The SQL below will be executed on the ' +
+ page_title: gettext('Final (Review Selection) (step 3 of 3)'),
+ show_description: gettext('The SQL below will be executed on the ' +
'database server to grant the selected privileges. ' +
'Please click on <b>Finish</b> to complete the process.'),
model: newModel,
@@ -1151,7 +1151,7 @@ define([
*/
self.wizard = new(pgBrowser.Wizard.extend({
options: {
- title: _('Grant Wizard'),
+ title: gettext('Grant Wizard'),
/* Main Wizard Title */
width: '',
height: '',
diff --git a/web/pgadmin/tools/maintenance/__init__.py b/web/pgadmin/tools/maintenance/__init__.py
index 3b3651e9e..d19e32d30 100644
--- a/web/pgadmin/tools/maintenance/__init__.py
+++ b/web/pgadmin/tools/maintenance/__init__.py
@@ -266,7 +266,7 @@ def create_maintenance_job(sid, did):
# Return response
return make_json_response(
data={'job_id': jid, 'status': True,
- 'info': 'Maintenance job created.'}
+ 'info': _('Maintenance job created.')}
)
diff --git a/web/pgadmin/tools/schema_diff/__init__.py b/web/pgadmin/tools/schema_diff/__init__.py
index 23e190ce0..1d1ff369a 100644
--- a/web/pgadmin/tools/schema_diff/__init__.py
+++ b/web/pgadmin/tools/schema_diff/__init__.py
@@ -36,7 +36,7 @@ class SchemaDiffModule(PgAdminModule):
A module class for Schema Diff derived from PgAdminModule.
"""
- LABEL = "Schema Diff"
+ LABEL = gettext("Schema Diff")
def get_own_menuitems(self):
return {}
@@ -439,7 +439,7 @@ def compare(trans_id, source_sid, source_did, source_scid,
comparison_result = []
- diff_model_obj.set_comparison_info("Comparing objects...", 0)
+ diff_model_obj.set_comparison_info(gettext("Comparing objects..."), 0)
update_session_diff_transaction(trans_id, session_obj,
diff_model_obj)
@@ -451,7 +451,8 @@ def compare(trans_id, source_sid, source_did, source_scid,
for node_name, node_view in all_registered_nodes.items():
view = SchemaDiffRegistry.get_node_view(node_name)
if hasattr(view, 'compare'):
- msg = "Comparing " + view.blueprint.COLLECTION_LABEL
+ msg = gettext('Comparing {0}').\
+ format(gettext(view.blueprint.COLLECTION_LABEL))
diff_model_obj.set_comparison_info(msg, total_percent)
# Update the message and total percentage in session object
update_session_diff_transaction(trans_id, session_obj,
@@ -468,7 +469,7 @@ def compare(trans_id, source_sid, source_did, source_scid,
comparison_result = comparison_result + res
total_percent = total_percent + node_percent
- msg = "Successfully compare the specified schemas."
+ msg = gettext("Successfully compare the specified schemas.")
total_percent = 100
diff_model_obj.set_comparison_info(msg, total_percent)
# Update the message and total percentage done in session object
@@ -501,7 +502,7 @@ def poll(trans_id):
msg, diff_percentage = diff_model_obj.get_comparison_info()
if diff_percentage == 100:
- diff_model_obj.set_comparison_info("Comparing objects...", 0)
+ diff_model_obj.set_comparison_info(gettext("Comparing objects..."), 0)
update_session_diff_transaction(trans_id, session_obj,
diff_model_obj)
diff --git a/web/pgadmin/tools/schema_diff/compare.py b/web/pgadmin/tools/schema_diff/compare.py
index 40d4382bb..7459b849b 100644
--- a/web/pgadmin/tools/schema_diff/compare.py
+++ b/web/pgadmin/tools/schema_diff/compare.py
@@ -12,6 +12,7 @@
import copy
from flask import render_template
+from flask_babelex import gettext
from pgadmin.utils.driver import get_driver
from config import PG_DEFAULT_DRIVER
from pgadmin.utils.ajax import internal_server_error
@@ -86,7 +87,7 @@ class SchemaDiffObjectCompare:
return compare_dictionaries(self, source_params, target_params,
target_schema, source, target,
self.node_type,
- self.blueprint.COLLECTION_LABEL,
+ gettext(self.blueprint.COLLECTION_LABEL),
self.keys_to_ignore)
def ddl_compare(self, **kwargs):
diff --git a/web/pgadmin/tools/schema_diff/model.py b/web/pgadmin/tools/schema_diff/model.py
index 499ecca15..e1652a218 100644
--- a/web/pgadmin/tools/schema_diff/model.py
+++ b/web/pgadmin/tools/schema_diff/model.py
@@ -7,6 +7,8 @@
#
##########################################################################
+from flask_babelex import gettext
+
class SchemaDiffModel(object):
"""
@@ -30,7 +32,7 @@ class SchemaDiffModel(object):
**kwargs : N number of parameters
"""
self._comparison_result = dict()
- self._comparison_msg = 'Comparision started...'
+ self._comparison_msg = gettext('Comparision started...')
self._comparison_percentage = 0
def clear_data(self):
diff --git a/web/pgadmin/tools/schema_diff/static/js/schema_diff.backform.js b/web/pgadmin/tools/schema_diff/static/js/schema_diff.backform.js
index ae3a7eebb..4af8857b2 100644
--- a/web/pgadmin/tools/schema_diff/static/js/schema_diff.backform.js
+++ b/web/pgadmin/tools/schema_diff/static/js/schema_diff.backform.js
@@ -289,11 +289,11 @@ let SchemaDiffHeaderView = Backform.Form.extend({
},
template: _.template(`
<div class="row pgadmin-control-group">
- <div class="col-1 control-label">Select Source</div>
+ <div class="col-1 control-label">` + gettext('Select Source') + `</div>
<div class="col-6 source row"></div>
</div>
<div class="row pgadmin-control-group">
- <div class="col-1 control-label">Select Target</div>
+ <div class="col-1 control-label">` + gettext('Select Target') + `</div>
<div class="col-6 target row"></div>
<div class="col-5 target-buttons">
<div class="action-btns d-flex">
@@ -421,9 +421,9 @@ let SchemaDiffFooterView = Backform.Form.extend({
template: {
'content': _.template(`
<div class="pg-el-sm-12 row <%=contentClass%>">
- <div class="pg-el-sm-4 ddl-source">Source</div>
- <div class="pg-el-sm-4 ddl-target">Target</div>
- <div class="pg-el-sm-4 ddl-diff">Difference
+ <div class="pg-el-sm-4 ddl-source">` + gettext('Source') + `</div>
+ <div class="pg-el-sm-4 ddl-target">` + gettext('Target') + `</div>
+ <div class="pg-el-sm-4 ddl-diff">` + gettext('Difference') + `
</div>
</div>
</div>
diff --git a/web/pgadmin/tools/schema_diff/static/js/schema_diff.js b/web/pgadmin/tools/schema_diff/static/js/schema_diff.js
index eb7719859..f0c75f224 100644
--- a/web/pgadmin/tools/schema_diff/static/js/schema_diff.js
+++ b/web/pgadmin/tools/schema_diff/static/js/schema_diff.js
@@ -85,7 +85,7 @@ define('pgadmin.schemadiff', [
})
.done(function(res) {
self.trans_id = res.data.schemaDiffTransId;
- res.data.panel_title = 'Schema Diff (Beta)'; //TODO: Set the panel title
+ res.data.panel_title = gettext('Schema Diff (Beta)'); //TODO: Set the panel title
// TODO: Following function is used to test the fetching of the
// databases this should be moved to server selection event later.
self.launch_schema_diff(res.data);
diff --git a/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js b/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js
index a5008db08..6bde4a846 100644
--- a/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js
+++ b/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js
@@ -302,11 +302,11 @@ export default class SchemaDiffUI {
var grid_width = (self.grid_width - 47) / 2 ;
var columns = [
checkboxSelector.getColumnDefinition(),
- {id: 'title', name: 'Schema Objects', field: 'title', minWidth: grid_width, formatter: formatColumnTitle},
- {id: 'status', name: 'Comparison Result', field: 'status', minWidth: grid_width},
- {id: 'label', name: 'Schema Objects', field: 'label', width: 0, minWidth: 0, maxWidth: 0,
+ {id: 'title', name: gettext('Schema Objects'), field: 'title', minWidth: grid_width, formatter: formatColumnTitle},
+ {id: 'status', name: gettext('Comparison Result'), field: 'status', minWidth: grid_width},
+ {id: 'label', name: gettext('Schema Objects'), field: 'label', width: 0, minWidth: 0, maxWidth: 0,
cssClass: 'really-hidden', headerCssClass: 'really-hidden'},
- {id: 'type', name: 'Schema Objects', field: 'type', width: 0, minWidth: 0, maxWidth: 0,
+ {id: 'type', name: gettext('Schema Objects'), field: 'type', width: 0, minWidth: 0, maxWidth: 0,
cssClass: 'really-hidden', headerCssClass: 'really-hidden'},
{id: 'id', name: 'id', field: 'id', width: 0, minWidth: 0, maxWidth: 0,
cssClass: 'really-hidden', headerCssClass: 'really-hidden' },
@@ -462,10 +462,10 @@ export default class SchemaDiffUI {
.done(function (res) {
let msg = res.data.compare_msg;
if (res.data.diff_percentage != 100) {
- msg = msg + ' (this may take a few minutes)...';
+ msg = msg + gettext(' (this may take a few minutes)...');
}
- msg = msg + '<br>'+ res.data.diff_percentage + '% completed.';
+ msg = msg + '<br>' + gettext('%s completed.', res.data.diff_percentage + '%');
$('#diff_fetching_data').find('.schema-diff-busy-text').html(msg);
})
.fail(function (xhr) {
diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
index 274fcb87d..4fc4f329b 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
@@ -2237,7 +2237,7 @@ define('tools.querytool', [
self.trigger('pgadmin-sqleditor:loading-icon:hide');
- self.gridView.set_editor_title(`(${gettext('Obtaining connection...')} ${_.unescape(url_params.title)}`);
+ self.gridView.set_editor_title('(' + gettext('Obtaining connection...') + ` ${_.unescape(url_params.title)}`);
let afterConn = function() {
let enableBtns = [];
diff --git a/web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py b/web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py
index 114046f6c..a4d74e860 100644
--- a/web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py
+++ b/web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py
@@ -212,9 +212,9 @@ def RegisterQueryToolPreferences(self):
'CSV_output', 'csv_quoting',
gettext("CSV quoting"), 'options', 'strings',
category_label=gettext('CSV Output'),
- options=[{'label': 'None', 'value': 'none'},
- {'label': 'All', 'value': 'all'},
- {'label': 'Strings', 'value': 'strings'}],
+ options=[{'label': gettext('None'), 'value': 'none'},
+ {'label': gettext('All'), 'value': 'all'},
+ {'label': gettext('Strings'), 'value': 'strings'}],
select2={
'allowClear': False,
'tags': False
@@ -240,7 +240,7 @@ def RegisterQueryToolPreferences(self):
options=[{'label': ';', 'value': ';'},
{'label': ',', 'value': ','},
{'label': '|', 'value': '|'},
- {'label': 'Tab', 'value': '\t'}],
+ {'label': gettext('Tab'), 'value': '\t'}],
select2={
'allowClear': False,
'tags': True
@@ -262,9 +262,9 @@ def RegisterQueryToolPreferences(self):
'Results_grid', 'results_grid_quoting',
gettext("Result copy quoting"), 'options', 'strings',
category_label=gettext('Results grid'),
- options=[{'label': 'None', 'value': 'none'},
- {'label': 'All', 'value': 'all'},
- {'label': 'Strings', 'value': 'strings'}],
+ options=[{'label': gettext('None'), 'value': 'none'},
+ {'label': gettext('All'), 'value': 'all'},
+ {'label': gettext('Strings'), 'value': 'strings'}],
select2={
'allowClear': False,
'tags': False
@@ -290,7 +290,7 @@ def RegisterQueryToolPreferences(self):
options=[{'label': ';', 'value': ';'},
{'label': ',', 'value': ','},
{'label': '|', 'value': '|'},
- {'label': 'Tab', 'value': '\t'}],
+ {'label': gettext('Tab'), 'value': '\t'}],
select2={
'allowClear': False,
'tags': True
diff --git a/web/pgadmin/tools/user_management/static/js/user_management.js b/web/pgadmin/tools/user_management/static/js/user_management.js
index 64014863f..2b1ed1727 100644
--- a/web/pgadmin/tools/user_management/static/js/user_management.js
+++ b/web/pgadmin/tools/user_management/static/js/user_management.js
@@ -27,7 +27,7 @@ define([
userFilter = function(collection) {
return (new Backgrid.Extension.ClientSideFilter({
collection: collection,
- placeholder: _('Filter by email'),
+ placeholder: gettext('Filter by email'),
// How long to wait after typing has stopped before searching can start
wait: 150,
}));
@@ -763,7 +763,7 @@ define([
<div class="input-group-prepend">
<span class="input-group-text fa fa-search" id="labelSearch"></span>
</div>
- <input type="search" class="form-control" id="txtGridSearch" placeholder="Search" aria-label="Search" aria-describedby="labelSearch" />
+ <input type="search" class="form-control" id="txtGridSearch" placeholder="` + gettext('Search') + `" aria-label="Search" aria-describedby="labelSearch" />
</div>
<button id="btn_refresh" type="button" class="btn btn-secondary btn-navtab-inline add" title="Add">
<span class="fa fa-plus "></span>
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgAdmin 4 - gettext usage fixes
@ 2020-03-24 05:45 Akshay Joshi <[email protected]>
parent: Aditya Toshniwal <[email protected]>
0 siblings, 0 replies; 5+ messages in thread
From: Akshay Joshi @ 2020-03-24 05:45 UTC (permalink / raw)
To: Aditya Toshniwal <[email protected]>; +Cc: Libor M. <[email protected]>; pgadmin-hackers
Thanks, patch applied.
On Tue, Mar 24, 2020 at 11:06 AM Aditya Toshniwal <
[email protected]> wrote:
> Hi Hackers,
>
> Please find the updated patch with pep8, linter issues fixed.
>
>
> On Mon, Mar 23, 2020 at 8:31 PM Aditya Toshniwal <
> [email protected]> wrote:
>
>> Hi Libor,
>>
>> Thank you for the patch. It is good clean up patch.
>> I've made a few changes in the patch. You've imported sprintf which was
>> not required since gettext also works as sprintf directly.
>> I've also created a housekeeping redmine ticket to track it -
>> https://redmine.postgresql.org/issues/5284
>>
>> The messages compile fine. The patch can be committed.
>> Please find the attached updated patch.
>>
>>
>>
>> On Mon, Mar 23, 2020 at 4:00 PM Akshay Joshi <
>> [email protected]> wrote:
>>
>>> Hi Aditya
>>>
>>> Can you please review this?
>>>
>>> On Mon, Mar 23, 2020 at 5:00 AM Libor M. <[email protected]> wrote:
>>>
>>>> Hello,
>>>> I fixed using gettext function and add more usages for translations,
>>>> specifically:
>>>>
>>>> - fixed usage gettext('') instead of _('') in javascript files
>>>> - fixed usage gettext('') instead of `${gettext('')}` in javascript
>>>> files, because "pybabel extract" not support extracting from this
>>>> syntax
>>>> - added a lot of gettext for support translations
>>>>
>>>> Diff file is attached.
>>>>
>>>> Best regards,
>>>>
>>>> Libor M.
>>>>
>>>> E-mail: [email protected]
>>>> GitHub: https://github.com/liborm85
>>>>
>>>
>>>
>>> --
>>> *Thanks & Regards*
>>> *Akshay Joshi*
>>>
>>> *Sr. Software Architect*
>>> *EnterpriseDB Software India Private Limited*
>>> *Mobile: +91 976-788-8246*
>>>
>>
>>
>> --
>> Thanks and Regards,
>> Aditya Toshniwal
>> pgAdmin Hacker | Sr. Software Engineer | EnterpriseDB India | Pune
>> "Don't Complain about Heat, Plant a TREE"
>>
>
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> pgAdmin Hacker | Sr. Software Engineer | EnterpriseDB India | Pune
> "Don't Complain about Heat, Plant a TREE"
>
--
*Thanks & Regards*
*Akshay Joshi*
*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2020-03-24 05:45 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-03-22 10:55 pgAdmin 4 - gettext usage fixes Libor M. <[email protected]>
2020-03-23 10:30 ` Akshay Joshi <[email protected]>
2020-03-23 15:01 ` Aditya Toshniwal <[email protected]>
2020-03-24 05:35 ` Aditya Toshniwal <[email protected]>
2020-03-24 05:45 ` Akshay Joshi <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox