diff --git a/docs/en_US/release_notes_4_20.rst b/docs/en_US/release_notes_4_20.rst index e5a224fe8..db7407cda 100644 --- a/docs/en_US/release_notes_4_20.rst +++ b/docs/en_US/release_notes_4_20.rst @@ -15,6 +15,7 @@ Housekeeping ************ | `Issue #5271 `_ - Enhance the color of switch control for both light and dark theme. +| `Issue #5284 `_ - Added and fixed gettext usage for better translation coverage. Bug fixes ********* 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([ '
', ' ', - ' ', + ' ', '
'].join('\n')), $gridBody = $('
').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([ '
', ' ', - ' ', + ' ', '
'].join('\n')), $gridBody = $('
').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([ '
', '<%-label%>', - '', + '', '
'].join('\n')), $gridBody = $('
').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 @@ - + 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 @@ - + 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 @@
{{ content_text|safe }}
- +
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 @@
- +
- - + +
@@ -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 = $(`
  • ${gettext('Loading process logs...')}
  • `); + self.logs_loading = $('
  • ' + gettext('Loading process logs...') + '
  • '); 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 = `
    -
    - ${gettext('Show hidden files and folders')}? - +
    ` + + gettext('Show hidden files and folders?') + + `
    - +
    `; } 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([ '
    ', ' <%-label%>', - ' ', + ' ', '
    ', ].join('\n')), gridBody = $('
    ').append( @@ -1582,7 +1582,7 @@ define([ var self = this, gridHeader = ['
    ', ' ' + data.label + '', - ' ', + ' ', '
    ', ].join('\n'), gridBody = $('
    ').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( - '' + '' ); 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(''); + this.$el.html(''); 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(''); + this.$el.html(''); // 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 = { `
    -
    ${gettext('Loading data...')}
    +
    ` + gettext('Loading data...') + `
    ` ).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( - `
    ${gettext( - 'No history found' - )}
    ` + '
    ' + + gettext('No history found') + + '
    ' ); } 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( - `` + '' ); } @@ -179,7 +179,7 @@ export default class QueryHistoryDetails {
    -
    Messages
    +
    ` + gettext('Messages') + `
    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 {
    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([ $(`
    -
    ${_('Please select the objects to grant privileges to from the list below.')}
    +
    ` + gettext('Please select the objects to grant privileges to from the list below.') + `
    - +
    @@ -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 Finish 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(`
    -
    Select Source
    +
    ` + gettext('Select Source') + `
    -
    Select Target
    +
    ` + gettext('Select Target') + `
    @@ -421,9 +421,9 @@ let SchemaDiffFooterView = Backform.Form.extend({ template: { 'content': _.template(`
    -
    Source
    -
    Target
    -
    Difference +
    ` + gettext('Source') + `
    +
    ` + gettext('Target') + `
    +
    ` + gettext('Difference') + `
    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 + '
    '+ res.data.diff_percentage + '% completed.'; + msg = msg + '
    ' + 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([
    - +