From 36a3d4e53b6338dd66dcac6fcffa441c1dd37a74 Mon Sep 17 00:00:00 2001 From: Libor M Date: Mon, 20 Apr 2020 11:19:09 +0530 Subject: [PATCH] =?UTF-8?q?Some=20more=20gettext()=20usage=20fixes:=C2=A0?= =?UTF-8?q?=20=20=20-=20fixed=20`%`=20vs.=20`.format()`=20=C2=A0=20-=20uni?= =?UTF-8?q?fied=20texts=20and=20usage=20`%s`=20vs.=20`{}`/`{0}`=20=C2=A0?= =?UTF-8?q?=20-=20improved=20text=20sentences=20for=20translate=20=C2=A0?= =?UTF-8?q?=20-=20added=20gettext=20for=20next=20texts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/pgadmin/__init__.py | 4 ++-- .../databases/event_triggers/__init__.py | 4 ++-- .../databases/schemas/domains/__init__.py | 5 ++--- .../domains/domain_constraints/__init__.py | 5 ++--- .../schemas/foreign_tables/__init__.py | 5 ++--- .../static/js/fts_configuration.js | 2 +- .../schemas/fts_dictionaries/__init__.py | 3 ++- .../databases/schemas/functions/__init__.py | 5 ++--- .../databases/schemas/packages/__init__.py | 5 +++-- .../databases/schemas/sequences/__init__.py | 8 ++++---- .../schemas/tables/rules/__init__.py | 4 ++-- .../schemas/tables/triggers/__init__.py | 5 ++--- .../pgagent/steps/static/js/pga_jobstep.js | 3 +-- .../servers/templates/servers/password.html | 2 +- .../templates/servers/tunnel_password.html | 2 +- web/pgadmin/browser/static/js/browser.js | 2 +- .../misc/file_manager/static/js/utility.js | 2 +- web/pgadmin/misc/static/explain/js/explain.js | 20 +++++++++---------- web/pgadmin/static/js/backgrid.pgadmin.js | 4 ++-- .../history/query_history_details.js | 2 +- .../vendor/backgrid/backgrid-select-all.js | 2 +- .../js/search_objects_dialog_wrapper.js | 8 +++----- 22 files changed, 48 insertions(+), 54 deletions(-) diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py index a1b19fb7e..ae4a0d3f4 100644 --- a/web/pgadmin/__init__.py +++ b/web/pgadmin/__init__.py @@ -502,8 +502,8 @@ def create_app(app_name=None): svr_port = winreg.QueryValueEx(inst_key, 'Port')[0] svr_discovery_id = inst_id svr_comment = gettext( - "Auto-detected %s installation with the data " - "directory at {}").format( + "Auto-detected {0} installation with the data " + "directory at {1}").format( winreg.QueryValueEx( inst_key, 'Display Name' )[0], diff --git a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py index 83bec30ca..22fe68963 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py @@ -378,7 +378,7 @@ class EventTriggerView(PGChildNodeView): status=400, success=0, errormsg=gettext( - "Could not find the required parameter {}.").format(err) + "Could not find the required parameter ({}).").format(err) ) try: sql = render_template( @@ -636,7 +636,7 @@ class EventTriggerView(PGChildNodeView): status=410, success=0, errormsg=gettext( - "Could not find the required parameter {}." + "Could not find the required parameter ({})." ).format(arg) ) sql = render_template( diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py index 8f6fefe2c..a5b2ffbfe 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py @@ -216,9 +216,8 @@ class DomainView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare): status=410, success=0, errormsg=gettext( - "Could not find the required parameter (%s)." % - arg - ) + "Could not find the required parameter ({})." + ).format(arg) ) try: diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/__init__.py index 38c686a3b..b599425e9 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/__init__.py @@ -211,9 +211,8 @@ class DomainConstraintView(PGChildNodeView): status=410, success=0, errormsg=gettext( - "Could not find the required parameter (%s)." % - arg - ) + "Could not find the required parameter ({})." + ).format(arg) ) try: diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py index 28b30164c..d86695653 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py @@ -260,9 +260,8 @@ class ForeignTableView(PGChildNodeView, DataTypeReader, status=410, success=0, errormsg=gettext( - "Could not find the required parameter (%s)." % - arg - ) + "Could not find the required parameter ({})." + ).format(arg) ) try: diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/static/js/fts_configuration.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/static/js/fts_configuration.js index 551677322..7a4ed5edc 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/static/js/fts_configuration.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/static/js/fts_configuration.js @@ -213,7 +213,7 @@ define('pgadmin.node.fts_configuration', [ ' ', '
', '
', - ' ', + ' ', '
', ' ', ' ', diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/__init__.py index 6858ec8d6..805bd0efa 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/__init__.py @@ -431,7 +431,8 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare): status=410, success=0, errormsg=_( - "Could not find the required parameter (%s)." % arg) + "Could not find the required parameter ({})." + ).format(arg) ) # Fetch schema name from schema oid sql = render_template( diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py index 35d9e4216..d343b394a 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py @@ -277,9 +277,8 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare): status=410, success=0, errormsg=gettext( - "Could not find the required parameter (%s)." % - arg - ) + "Could not find the required parameter ({})." + ).format(arg) ) list_params = [] diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/__init__.py index f3d24df14..e1ec7cacf 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/__init__.py @@ -557,8 +557,9 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare): status=400, success=0, errormsg=_( - "Could not find the required parameter (%s).") - % arg) + "Could not find the required parameter ({})." + ).format(arg) + ) SQL, name = self.getSQL(gid, sid, did, data, scid, pkgid) # Most probably this is due to error diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py index 03d2da1e6..c5f6c4e9b 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py @@ -381,8 +381,8 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare): status=400, success=0, errormsg=_( - "Could not find the required parameter (%s)." % arg - ) + "Could not find the required parameter ({})." + ).format(arg) ) try: @@ -590,8 +590,8 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare): status=400, success=0, errormsg=_( - "Could not find the required parameter (%s)." % arg - ) + "Could not find the required parameter ({})." + ).format(arg) ) SQL, name = self.getSQL(gid, sid, did, data, scid, seid) # Most probably this is due to error diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/__init__.py index 26c79881b..f4f500b28 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/__init__.py @@ -341,8 +341,8 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare): status=410, success=0, errormsg=gettext( - "Could not find the required parameter (%s)." % arg - ) + "Could not find the required parameter ({})." + ).format(arg) ) try: SQL = render_template("/".join( diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py index 7383d7ad2..b15adae2e 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py @@ -542,9 +542,8 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare): status=410, success=0, errormsg=gettext( - "Could not find the required parameter (%s)." % - required_args[arg] - ) + "Could not find the required parameter ({})." + ).format(required_args[arg]) ) # Adding parent into data dict, will be using it while creating sql diff --git a/web/pgadmin/browser/server_groups/servers/pgagent/steps/static/js/pga_jobstep.js b/web/pgadmin/browser/server_groups/servers/pgagent/steps/static/js/pga_jobstep.js index 4df8e0517..c13b325f7 100644 --- a/web/pgadmin/browser/server_groups/servers/pgagent/steps/static/js/pga_jobstep.js +++ b/web/pgadmin/browser/server_groups/servers/pgagent/steps/static/js/pga_jobstep.js @@ -190,8 +190,7 @@ define('pgadmin.node.pga_jobstep', [ id: 'jstconnstr', label: gettext('Connection string'), type: 'text', deps: ['jstkind', 'jstconntype'], disabled: function(m) { return !m.get('jstkind') || m.get('jstconntype'); - }, helpMessage: gettext('Please specify the connection string for the remote database server. Each parameter setting is in the form keyword = value. Spaces around the equal sign are optional. To write an empty value, or a value containing spaces, surround it with single quotes, e.g., keyword = \'a value\'. Single quotes and backslashes within the value must be escaped with a backslash, i.e., \' and \\.
For more information, please see the documentation on %s', - 'libpq connection strings' + }, helpMessage: gettext('Please specify the connection string for the remote database server. Each parameter setting is in the form keyword = value. Spaces around the equal sign are optional. To write an empty value, or a value containing spaces, surround it with single quotes, e.g., keyword = \'a value\'. Single quotes and backslashes within the value must be escaped with a backslash, i.e., \' and \\.
For more information, please see the documentation on libpq connection strings.' ), mode: ['create', 'edit'], },{ id: 'jstonerror', label: gettext('On error'), cell: 'select2', 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 9fc0b3945..0cb15f2c9 100644 --- a/web/pgadmin/browser/server_groups/servers/templates/servers/password.html +++ b/web/pgadmin/browser/server_groups/servers/templates/servers/password.html @@ -3,7 +3,7 @@
{{ _('Please enter the password for the user \'{0}\' to connect the server - "{1}"').format(username, server_label) }}
- +
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 8724c8035..ea1dc178c 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 @@ -17,7 +17,7 @@ - +
diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js index a2bcd78c6..9a2980a81 100644 --- a/web/pgadmin/browser/static/js/browser.js +++ b/web/pgadmin/browser/static/js/browser.js @@ -226,7 +226,7 @@ define('pgadmin.browser', [ width: 500, isCloseable: false, isPrivate: true, - content: '
', + content: '
', }), // Dependencies of the object 'dependencies': new pgAdmin.Browser.Panel({ diff --git a/web/pgadmin/misc/file_manager/static/js/utility.js b/web/pgadmin/misc/file_manager/static/js/utility.js index 04060b77d..353baf560 100644 --- a/web/pgadmin/misc/file_manager/static/js/utility.js +++ b/web/pgadmin/misc/file_manager/static/js/utility.js @@ -1552,7 +1552,7 @@ define([ '
'+ '
'+ '
' + - '
Drop files here to upload. ' + lg.file_size_limit + + '
' + gettext('Drop files here to upload.') + ' ' + lg.file_size_limit + config.upload.fileSizeLimit + ' ' + lg.mb + '.
', path = $('.currentpath').val(), filesizelimit = config.upload.fileSizeLimit, diff --git a/web/pgadmin/misc/static/explain/js/explain.js b/web/pgadmin/misc/static/explain/js/explain.js index c3f6ed7dd..f20a427e2 100644 --- a/web/pgadmin/misc/static/explain/js/explain.js +++ b/web/pgadmin/misc/static/explain/js/explain.js @@ -490,44 +490,44 @@ define('pgadmin.misc.explain', [ if ('Join Filter' in _planData) { node_extra_info.push( - 'Join Filter: ' + _.escape(_planData['Join Filter']) + '' + gettext('Join Filter') + ': ' + _.escape(_planData['Join Filter']) ); } if ('Filter' in _planData) { - node_extra_info.push('Filter: ' + _.escape(_planData['Filter'])); + node_extra_info.push('' + gettext('Filter') + ': ' + _.escape(_planData['Filter'])); } if ('Index Cond' in _planData) { - node_extra_info.push('Index Cond: ' + _.escape(_planData['Index Cond'])); + node_extra_info.push('' + gettext('Index Cond') + ': ' + _.escape(_planData['Index Cond'])); } if ('Hash Cond' in _planData) { - node_extra_info.push('Hash Cond: ' + _.escape(_planData['Hash Cond'])); + node_extra_info.push('' + gettext('Hash Cond') + ': ' + _.escape(_planData['Hash Cond'])); } if ('Rows Removed by Filter' in _planData) { node_extra_info.push( - 'Rows Removed by Filter: ' + + '' + gettext('Rows Removed by Filter') + ': ' + _.escape(_planData['Rows Removed by Filter']) ); } if ('Peak Memory Usage' in _planData) { var buffer = [ - 'Buckets:', _.escape(_planData['Hash Buckets']), - 'Batches:', _.escape(_planData['Hash Batches']), - 'Memory Usage:', _.escape(_planData['Peak Memory Usage']), 'kB', + '' + gettext('Buckets') + ':', _.escape(_planData['Hash Buckets']), + '' + gettext('Batches') + ':', _.escape(_planData['Hash Batches']), + '' + gettext('Memory Usage') + ':', _.escape(_planData['Peak Memory Usage']), 'kB', ].join(' '); node_extra_info.push(buffer); } if ('Recheck Cond' in _planData) { - node_extra_info.push('Recheck Cond: ' + _planData['Recheck Cond']); + node_extra_info.push('' + gettext('Recheck Cond') + ': ' + _planData['Recheck Cond']); } if ('Exact Heap Blocks' in _planData) { - node_extra_info.push('Heap Blocks: exact=' + _planData['Exact Heap Blocks']); + node_extra_info.push('' + gettext('Heap Blocks') + ': exact=' + _planData['Exact Heap Blocks']); } info.rows.push(_explainRowTemplate({ diff --git a/web/pgadmin/static/js/backgrid.pgadmin.js b/web/pgadmin/static/js/backgrid.pgadmin.js index e196efa0d..84009a152 100644 --- a/web/pgadmin/static/js/backgrid.pgadmin.js +++ b/web/pgadmin/static/js/backgrid.pgadmin.js @@ -1081,7 +1081,7 @@ define([ }, render: function() { this.$el.empty(); - this.$el.html(' '); + this.$el.html(' '); this.delegateEvents(); return this; }, @@ -2055,7 +2055,7 @@ define([ $(`
`) ); 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 8a884da00..d5bfac86a 100644 --- a/web/pgadmin/static/js/sqleditor/history/query_history_details.js +++ b/web/pgadmin/static/js/sqleditor/history/query_history_details.js @@ -128,7 +128,7 @@ export default class QueryHistoryDetails { this.$errMsgBlock.removeClass('d-none'); this.$errMsgBlock.empty().append( `
- Error Message ${_.escape(this.parseErrorMessage(this.entry.message))} + ` + gettext('Error Message') + ` ${_.escape(this.parseErrorMessage(this.entry.message))}
` ); } else { diff --git a/web/pgadmin/static/vendor/backgrid/backgrid-select-all.js b/web/pgadmin/static/vendor/backgrid/backgrid-select-all.js index 8cc11698b..ab882f364 100644 --- a/web/pgadmin/static/vendor/backgrid/backgrid-select-all.js +++ b/web/pgadmin/static/vendor/backgrid/backgrid-select-all.js @@ -126,7 +126,7 @@ '
', ' ', ' ', '
' ].join('\n')); diff --git a/web/pgadmin/tools/search_objects/static/js/search_objects_dialog_wrapper.js b/web/pgadmin/tools/search_objects/static/js/search_objects_dialog_wrapper.js index 0c4a315db..6c3b4fa39 100644 --- a/web/pgadmin/tools/search_objects/static/js/search_objects_dialog_wrapper.js +++ b/web/pgadmin/tools/search_objects/static/js/search_objects_dialog_wrapper.js @@ -150,8 +150,7 @@ export default class SearchObjectsDialogWrapper extends DialogWrapper { if(count != 0 && !count) { count = gettext('Unknown'); } - this.searchResultCount.innerHTML = count + ' ' + - (count===1 ? gettext('match found.'): gettext('matches found.')); + this.searchResultCount.innerHTML = (count===1 ? gettext('%s match found.', count): gettext('%s matches found.', count)); } showOtherInfo(rowno) { @@ -256,8 +255,7 @@ export default class SearchObjectsDialogWrapper extends DialogWrapper { if(!rowData.show_node) { this.showMessage( - gettext('%s objects are disabled in the browser.', rowData.type_label) + ' ' + - gettext('You can enable them in the') + ' ' + gettext('preferences dialog') + '.', + gettext('%s objects are disabled in the browser. You can enable them in the preferences dialog.', rowData.type_label), true, (statusBar)=>{ statusBar.querySelector('.pref-dialog-link').addEventListener('click', ()=>{ @@ -465,7 +463,7 @@ export default class SearchObjectsDialogWrapper extends DialogWrapper { ).then((res)=>{ let types = [{ id: 'all', - text: 'All types', + text: gettext('All types'), }]; for (const key of Object.keys(res.data.data).sort()) {