public inbox for [email protected]  
help / color / mirror / Atom feed
pgAdmin 4 - next gettext usage fixes
11+ messages / 4 participants
[nested] [flat]

* pgAdmin 4 - next gettext usage fixes
@ 2020-04-08 15:41 Libor M. <[email protected]>
  2020-04-10 09:27 ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 11+ messages in thread

From: Libor M. @ 2020-04-08 15:41 UTC (permalink / raw)
  To: pgadmin-hackers

Hello,
I fixed next gettext usage:

- fixed gettext usage with .format() only for original text with %s
- fixed typos
- fixed translation yes/no buttons in dialog
- improved translating sentences without "connecting" words (eg. see
web/pgadmin/dashboard/static/js/dashboard.js, word 'cancel' needs to
be translated in Czech language as 'zrušit' but in another sentence as
'zrušení')
- added gettext for text translations

Diff file is attached.

Best regards,

Libor M.

E-mail: [email protected]
GitHub: https://github.com/liborm85


Attachments:

  [application/octet-stream] pgadmin4_gettext_fixes2.diff (95.8K, 2-pgadmin4_gettext_fixes2.diff)
  download | inline diff:
diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py
index 5ca2ae67a..b99b20ba5 100644
--- a/web/pgadmin/__init__.py
+++ b/web/pgadmin/__init__.py
@@ -503,7 +503,7 @@ def create_app(app_name=None):
                             svr_discovery_id = inst_id
                             svr_comment = gettext(
                                 "Auto-detected %s installation with the data "
-                                "directory at %s" % (
+                                "directory at %s") % (
                                     winreg.QueryValueEx(
                                         inst_key, 'Display Name'
                                     )[0],
@@ -511,7 +511,6 @@ def create_app(app_name=None):
                                         inst_key, 'Data Directory'
                                     )[0]
                                 )
-                            )
 
                             add_server(
                                 user_id, servergroup_id, svr_name,
@@ -560,11 +559,10 @@ def create_app(app_name=None):
                         description = description.decode('utf-8')
                         data_directory = data_directory.decode('utf-8')
                     svr_comment = gettext(u"Auto-detected %s installation "
-                                          u"with the data directory at %s" % (
+                                          u"with the data directory at %s") % (
                                               description,
                                               data_directory
                                           )
-                                          )
                     add_server(user_id, servergroup_id, svr_name,
                                svr_superuser, svr_port, svr_discovery_id,
                                svr_comment)
diff --git a/web/pgadmin/browser/register_browser_preferences.py b/web/pgadmin/browser/register_browser_preferences.py
index 5f57f9fa1..2857fc7cd 100644
--- a/web/pgadmin/browser/register_browser_preferences.py
+++ b/web/pgadmin/browser/register_browser_preferences.py
@@ -39,14 +39,14 @@ def register_browser_preferences(self):
         gettext("Browser tree state saving interval"), 'integer',
         30, category_label=gettext('Display'),
         help_str=gettext(
-            'Browser tree state saving interval in seconds.'
+            'Browser tree state saving interval in seconds. '
             'Use -1 to disable the tree saving mechanism.'
         )
     )
 
     self.preference.register(
         'display', 'confirm_on_refresh_close',
-        gettext("Confirm on close or refresh ?"), 'boolean',
+        gettext("Confirm on close or refresh?"), 'boolean',
         True, category_label=gettext('Display'),
         help_str=gettext(
             'Confirm closure or refresh of the browser or browser tab is '
@@ -56,7 +56,7 @@ def register_browser_preferences(self):
 
     self.preference.register(
         'display', 'confirm_on_properties_close',
-        gettext("Confirm before Close/Reset in object properties dialog ?"),
+        gettext("Confirm before Close/Reset in object properties dialog?"),
         'boolean',
         True, category_label=gettext('Display'),
         help_str=gettext(
diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py
index 1a9eb6a8f..3b32cfcdb 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -741,8 +741,7 @@ class ServerNode(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
 
         if 'hostaddr' in data and data['hostaddr'] and data['hostaddr'] != '':
@@ -838,7 +837,7 @@ class ServerNode(PGChildNodeView):
                         status=401,
                         success=0,
                         errormsg=gettext(
-                            u"Unable to connect to server:\n\n%s" % errmsg)
+                            u"Unable to connect to server:\n\n%s") % errmsg
                     )
                 else:
                     if 'save_password' in data and data['save_password'] and \
diff --git a/web/pgadmin/browser/server_groups/servers/databases/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
index ebf7ae7ff..085ee35b6 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
@@ -175,7 +175,7 @@ class DatabaseView(PGChildNodeView):
                     kwargs['sid']
                 )
                 if self.manager is None:
-                    return gone(errormsg="Could not find the server.")
+                    return gone(errormsg=_("Could not find the server."))
 
                 if action and action in ["drop"]:
                     self.conn = self.manager.connection()
@@ -567,8 +567,7 @@ class DatabaseView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
         # The below SQL will execute CREATE DDL only
         SQL = render_template(
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 99315a3e7..b49265aaa 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
@@ -368,8 +368,7 @@ class CastView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
         try:
             sql = render_template("/".join([self.template_path, 'create.sql']),
@@ -668,8 +667,7 @@ class CastView(PGChildNodeView):
 
             if res is None:
                 return gone(gettext(
-                    "Could not generate reversed engineered SQL for the cast \
-                    node."
+                    "Could not generate reversed engineered SQL for the cast node."
                 ))
 
             return ajax_response(response=res)
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 369606952..42da4cfc4 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,8 +378,7 @@ class EventTriggerView(PGChildNodeView):
                 status=400,
                 success=0,
                 errormsg=gettext(
-                    "Could not find the required parameter %s." % err
-                )
+                    "Could not find the required parameter %s.") % err
             )
         try:
             sql = render_template(
@@ -637,8 +636,7 @@ class EventTriggerView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter %s." % err
-                    )
+                        "Could not find the required parameter %s.") % err
                 )
             sql = render_template(
                 "/".join([self.template_path, 'create.sql']),
diff --git a/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
index 2339914d8..9605b9b4a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
@@ -262,8 +262,7 @@ class ExtensionView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
 
         status, res = self.conn.execute_dict(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
index f6def506e..e5bf06357 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
@@ -393,8 +393,7 @@ class ForeignDataWrapperView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
 
         try:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
index 90487dff3..66fcf424b 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
@@ -388,8 +388,7 @@ class ForeignServerView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
         try:
             if 'fsrvacl' in data:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/static/js/foreign_server.js b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/static/js/foreign_server.js
index 8b6427850..ad6f1f76b 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/static/js/foreign_server.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/static/js/foreign_server.js
@@ -36,7 +36,7 @@ define('pgadmin.node.foreign_server', [
       if (_.isUndefined(this.get('fsrvoption')) ||
             _.isNull(this.get('fsrvoption')) ||
             String(this.get('fsrvoption')).replace(/^\s+|\s+$/g, '') == '') {
-        var msg = 'Please enter an option name';
+        var msg = gettext('Please enter an option name.');
         this.errorModel.set('fsrvoption', msg);
         return msg;
       } else {
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/__init__.py
index ee7648fd4..47e55570a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/__init__.py
@@ -396,8 +396,7 @@ class UserMappingView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
 
         try:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/static/js/user_mapping.js b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/static/js/user_mapping.js
index 39e0726b2..400a6722f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/static/js/user_mapping.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/static/js/user_mapping.js
@@ -39,7 +39,7 @@ define('pgadmin.node.user_mapping', [
       if (_.isUndefined(this.get('umoption')) ||
             _.isNull(this.get('umoption')) ||
             String(this.get('umoption')).replace(/^\s+|\s+$/g, '') == '') {
-        var msg = 'Please enter an option name';
+        var msg = gettext('Please enter an option name.');
         this.errorModel.set('umoption', msg);
         return msg;
       } else {
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/static/js/foreign_data_wrapper.js b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/static/js/foreign_data_wrapper.js
index f79a72da2..ff412dcbc 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/static/js/foreign_data_wrapper.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/static/js/foreign_data_wrapper.js
@@ -37,7 +37,7 @@ define('pgadmin.node.foreign_data_wrapper', [
       if (_.isUndefined(this.get('fdwoption')) ||
             _.isNull(this.get('fdwoption')) ||
             String(this.get('fdwoption')).replace(/^\s+|\s+$/g, '') == '') {
-        var msg = 'Please enter an option name';
+        var msg = gettext('Please enter an option name.');
         this.errorModel.set('fdwoption', msg);
         return msg;
       } else {
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
index 341743c57..77f22e6fa 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
@@ -453,8 +453,7 @@ class LanguageView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
 
         try:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
index f9bffb76f..dce8242f3 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
@@ -136,7 +136,7 @@ def check_precondition(f):
             kwargs['sid']
         )
         if not self.manager:
-            return gone(errormsg="Could not find the server.")
+            return gone(errormsg=gettext("Could not find the server."))
 
         self.conn = self.manager.connection(did=kwargs['did'])
         # Set the template path for the SQL scripts
@@ -570,9 +570,8 @@ It may have been removed by another user.
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s)." %
+                        "Could not find the required parameter (%s).") %
                         required_args[arg]
-                    )
                 )
         try:
             self.format_request_acls(data)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py
index 34227cd11..8cf703987 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py
@@ -458,8 +458,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
         if self._check_definition(data):
             return make_json_response(
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 6bf03e8ef..98ee29629 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)." %
+                                "Could not find the required parameter (%s).") %
                                 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 6b1c60d8f..d7a1efa1d 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
@@ -257,9 +257,8 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
                             status=410,
                             success=0,
                             errormsg=gettext(
-                                "Could not find the required parameter (%s)." %
+                                "Could not find the required parameter (%s).") %
                                 arg
-                            )
                         )
 
             try:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py
index 7065c6630..362f7c6ce 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py
@@ -422,8 +422,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
 
         # Either copy config or parser must be present in data
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 6b8232f07..a7eea04d7 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,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s)." % arg)
+                        "Could not find the required parameter (%s).") % arg
                 )
         # Fetch schema name from schema oid
         sql = render_template(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/__init__.py
index d4a1151f6..b79b6ef5b 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/__init__.py
@@ -379,8 +379,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
         # Fetch schema name from schema oid
         sql = render_template(
@@ -850,7 +849,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
                 return gone(
                     _(
                         "Could not generate reversed engineered query for "
-                        "FTS Parser node"
+                        "FTS Parser node."
                     )
                 )
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py
index 7032682f1..4d61e8dcb 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py
@@ -354,8 +354,7 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
         # Fetch schema name from schema oid
         sql = render_template("/".join([self.template_path, 'schema.sql']),
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 7e12863a6..785f87b6e 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)." %
+                                "Could not find the required parameter (%s).") %
                                 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 e26de7c82..9c6fc4139 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
@@ -379,8 +379,7 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
         data['schema'] = self.schema
 
@@ -557,8 +556,7 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
                         status=400,
                         success=0,
                         errormsg=_(
-                            "Could not find the required parameter (%s)." % arg
-                        )
+                            "Could not find the required parameter (%s).") % arg
                     )
 
         SQL, name = self.getSQL(gid, sid, did, data, scid, pkgid)
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 6328de605..d731ade47 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,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
 
         try:
@@ -590,8 +589,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
                         status=400,
                         success=0,
                         errormsg=_(
-                            "Could not find the required parameter (%s)." % arg
-                        )
+                            "Could not find the required parameter (%s).") % 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/synonyms/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
index b9f5d57df..af7fc2b86 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
@@ -450,8 +450,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
 
         try:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
index e000076c0..bea7b33f4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
@@ -908,8 +908,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
 
         # Parse privilege data coming from client according to database format
@@ -1578,7 +1577,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
 
         return make_json_response(
             status=200,
-            info=gettext("Table rows counted: %s" % count),
+            info=gettext("Table rows counted: %s") % count,
             data={'total_rows': count}
         )
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/__init__.py
index 472a371de..e6a78f234 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/__init__.py
@@ -392,9 +392,8 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s)." %
+                        "Could not find the required parameter (%s).") %
                         required_args[arg]
-                    )
                 )
 
         # Parse privilege data coming from client according to database format
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/__init__.py
index 1f280e807..611e4e758 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/__init__.py
@@ -511,9 +511,8 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s)." %
+                        "Could not find the required parameter (%s).") %
                         required_args[arg]
-                    )
                 )
 
         # Adding parent into data dict, will be using it while creating sql
@@ -904,8 +903,8 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
                 if not status:
                     return internal_server_error(errormsg=res)
                 if len(res['rows']) == 0:
-                    return gone(gettext("""Could not find the compound
-                     trigger in the table."""))
+                    return gone(gettext("Could not find the compound "
+                                        "trigger in the table."))
 
                 data = dict(res['rows'][0])
                 # Adding parent into data dict,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/static/js/compound_trigger.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/static/js/compound_trigger.js
index 8b54f6d5d..3cb8d7969 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/static/js/compound_trigger.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/static/js/compound_trigger.js
@@ -194,10 +194,10 @@ define('pgadmin.node.compound_trigger', [
             return false;
           },
           options: [
-            {label: 'Enable', value: 'O'},
-            {label: 'Enable Replica', value: 'R'},
-            {label: 'Enable Always', value: 'A'},
-            {label: 'Disable', value: 'D'},
+            {label: gettext('Enable'), value: 'O'},
+            {label: gettext('Enable Replica'), value: 'R'},
+            {label: gettext('Enable Always'), value: 'A'},
+            {label: gettext('Disable'), value: 'D'},
           ],
           control: 'select2', select2: { allowClear: false, width: '100%' },
         },{
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py
index 484e7dcce..2f1ba57bb 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py
@@ -476,8 +476,7 @@ class CheckConstraintView(PGChildNodeView):
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
 
         data['schema'] = self.schema
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py
index 96045bac1..ab3ee6ab5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py
@@ -496,16 +496,14 @@ class ExclusionConstraintView(PGChildNodeView):
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find required parameter (%s)." % str(arg)
-                    )
+                        "Could not find required parameter (%s).") % str(arg)
                 )
             elif isinstance(data[arg], list) and len(data[arg]) < 1:
                 return make_json_response(
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find required parameter (%s)." % str(arg)
-                    )
+                        "Could not find required parameter (%s).") % str(arg)
                 )
 
         data['schema'] = self.schema
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py
index 6a3d70afe..3bd124ed6 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py
@@ -506,16 +506,14 @@ class ForeignKeyConstraintView(PGChildNodeView):
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find required parameter (%s)." % str(arg)
-                    )
+                        "Could not find required parameter (%s).") % str(arg)
                 )
             elif isinstance(data[arg], list) and len(data[arg]) < 1:
                 return make_json_response(
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find required parameter (%s)." % str(arg)
-                    )
+                        "Could not find required parameter (%s).") % str(arg)
                 )
 
         data['schema'] = self.schema
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
index 4b0a0918c..a8723b347 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
@@ -287,9 +287,9 @@ class IndexConstraintView(PGChildNodeView):
             return res
 
         if len(res) == 0:
-            return gone(_("""Could not find the {} in the table.""".format(
-                "primary key" if self.constraint_type == "p" else "unique key"
-            )))
+            return gone(_("""Could not find the {} in the table.""").format(
+                _("primary key") if self.constraint_type == "p" else _("unique key")
+            ))
 
         result = res
         if cid:
@@ -386,9 +386,9 @@ class IndexConstraintView(PGChildNodeView):
             return internal_server_error(errormsg=rset)
 
         if len(rset['rows']) == 0:
-            return gone(_("""Could not find the {} in the table.""".format(
-                "primary key" if self.constraint_type == "p" else "unique key"
-            )))
+            return gone(_("""Could not find the {} in the table.""").format(
+                _("primary key") if self.constraint_type == "p" else _("unique key")
+            ))
 
         res = self.blueprint.generate_browser_node(
             rset['rows'][0]['oid'],
@@ -533,8 +533,7 @@ class IndexConstraintView(PGChildNodeView):
                         success=0,
                         errormsg=_(
                             "Could not find at least one required "
-                            "parameter (%s)." % str(param)
-                        )
+                            "parameter (%s).") % str(param)
                     )
 
             elif arg not in data:
@@ -542,8 +541,7 @@ class IndexConstraintView(PGChildNodeView):
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
 
         data['schema'] = self.schema
@@ -824,9 +822,9 @@ class IndexConstraintView(PGChildNodeView):
         if not status:
             return internal_server_error(errormsg=res)
         if len(res['rows']) == 0:
-            return gone(_("""Could not find the {} in the table.""".format(
-                "primary key" if self.constraint_type == "p" else "unique key"
-            )))
+            return gone(_("""Could not find the {} in the table.""").format(
+                _("primary key") if self.constraint_type == "p" else _("unique key")
+            ))
 
         data = res['rows'][0]
         data['schema'] = self.schema
@@ -916,10 +914,10 @@ class IndexConstraintView(PGChildNodeView):
                 return internal_server_error(errormsg=res)
             if len(res['rows']) == 0:
                 return gone(
-                    _("""Could not find the {} in the table.""".format(
-                        "primary key" if self.constraint_type == "p"
-                        else "unique key"
-                    ))
+                    _("""Could not find the {} in the table.""").format(
+                        _("primary key") if self.constraint_type == "p"
+                        else _("unique key")
+                    )
                 )
 
             result = res['rows'][0]
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/primary_key.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/primary_key.js
index dad06e2f9..812618490 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/primary_key.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/primary_key.js
@@ -649,7 +649,7 @@ define('pgadmin.node.primary_key', [
 
           if ((_.isUndefined(index) || String(index).replace(/^\s+|\s+$/g, '') == '') &&
             (_.isUndefined(columns) || _.isNull(columns) || columns.length < 1)) {
-            var msg = gettext('Please specify columns for %s', gettext('Primary key'));
+            var msg = gettext('Please specify columns for %s.', gettext('Primary key'));
             this.errorModel.set('columns', msg);
             return msg;
           }
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/unique_constraint.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/unique_constraint.js
index a03b8a165..cc7472eac 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/unique_constraint.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/unique_constraint.js
@@ -638,7 +638,7 @@ define('pgadmin.node.unique_constraint', [
 
           if ((_.isUndefined(index) || String(index).replace(/^\s+|\s+$/g, '') == '') &&
             (_.isUndefined(columns) || _.isNull(columns) || columns.length < 1)) {
-            var msg = gettext('Please specify columns for %s', gettext('Unique constraint'));
+            var msg = gettext('Please specify columns for %s.', gettext('Unique constraint'));
             this.errorModel.set('columns', msg);
             return msg;
           }
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py
index 23709d6d5..b818148a5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py
@@ -576,10 +576,10 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
         for arg in required_args:
             err_msg = None
             if arg == 'columns' and len(data['columns']) < 1:
-                err_msg = "You must provide one or more column to create index"
+                err_msg = gettext("You must provide one or more column to create index.")
 
             if arg not in data:
-                err_msg = "Could not find the required parameter (%s)." % \
+                err_msg = gettext("Could not find the required parameter (%s).") % \
                           required_args[arg]
                 # Check if we have at least one column
             if err_msg is not None:
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 928342895..9ce744cfa 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
@@ -60,12 +60,12 @@ function(
         pgBrowser.add_menus([{
           name: 'truncate_table', node: 'partition', 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: 'partition', 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
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/static/js/trigger.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/static/js/trigger.js
index a4e6f4ede..5ffed4617 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/static/js/trigger.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/static/js/trigger.js
@@ -196,10 +196,10 @@ define('pgadmin.node.trigger', [
             return false;
           },
           options: [
-            {label: 'Enable', value: 'O'},
-            {label: 'Enable Replica', value: 'R'},
-            {label: 'Enable Always', value: 'A'},
-            {label: 'Disable', value: 'D'},
+            {label: gettext('Enable'), value: 'O'},
+            {label: gettext('Enable Replica'), value: 'R'},
+            {label: gettext('Enable Always'), value: 'A'},
+            {label: gettext('Disable'), value: 'D'},
           ],
           control: 'select2', select2: { allowClear: false, width: '100%' },
         },{
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
index 8512a9b9b..173717bad 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
@@ -946,9 +946,8 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s)." %
+                        "Could not find the required parameter (%s).") %
                         required_args[arg]
-                    )
                 )
             # Additional checks goes here
             # If type is range then check if subtype is defined or not
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.js
index 8babb2bbd..17a7b84aa 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.js
@@ -218,9 +218,9 @@ define('pgadmin.node.type', [
       else if (this.get('is_tlength')
         && !_.isUndefined(this.get('tlength'))) {
         if (this.get('tlength') < this.get('min_val'))
-          errmsg = gettext('Length/Precision should not be less than %s', this.get('min_val'));
+          errmsg = gettext('Length/Precision should not be less than %s.', this.get('min_val'));
         if (this.get('tlength') > this.get('max_val') )
-          errmsg = gettext('Length/Precision should not be greater than %s', this.get('max_val'));
+          errmsg = gettext('Length/Precision should not be greater than %s.', this.get('max_val'));
           // If we have any error set then throw it to user
         if(errmsg) {
           this.errorModel.set('tlength', errmsg);
@@ -231,9 +231,9 @@ define('pgadmin.node.type', [
       else if (this.get('is_precision')
         && !_.isUndefined(this.get('precision'))) {
         if (this.get('precision') < this.get('min_val'))
-          errmsg = gettext('Scale should not be less than %s', this.get('min_val'));
+          errmsg = gettext('Scale should not be less than %s.', this.get('min_val'));
         if (this.get('precision') > this.get('max_val'))
-          errmsg = gettext('Scale should not be greater than %s', this.get('max_val'));
+          errmsg = gettext('Scale should not be greater than %s.', this.get('max_val'));
           // If we have any error set then throw it to user
         if(errmsg) {
           this.errorModel.set('precision', errmsg);
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
index e9a1f38fe..d5d71c97f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
@@ -493,8 +493,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
         try:
             SQL, nameOrError = self.getSQL(gid, sid, did, scid, data)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
index 5dfed1abb..297116d24 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
@@ -190,7 +190,7 @@ define('pgadmin.node.database', [
 
           Alertify.confirm(
             gettext('Disconnect the database'),
-            pgadminUtils.sprintf(gettext('Are you sure you want to disconnect the database - %s?'), d.label),
+            gettext('Are you sure you want to disconnect the database - %s?', d.label),
             function() {
               var data = d;
               $.ajax({
@@ -228,7 +228,11 @@ define('pgadmin.node.database', [
                   t.unload(i);
                 });
             },
-            function() { return true; });
+            function() { return true; }
+          ).set('labels', {
+            ok: gettext('Yes'),
+            cancel: gettext('No'),
+          });
 
           return false;
         },
diff --git a/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py b/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py
index 08ca3dc99..28a8e5901 100644
--- a/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py
@@ -284,8 +284,7 @@ SELECT EXISTS(
                     status=410,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
 
         status, res = self.conn.execute_void('BEGIN')
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 5f42d75d0..4df8e0517 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
@@ -305,7 +305,7 @@ define('pgadmin.node.pga_jobstep', [
             !_.isUndefined(val) && !_.isNull(val) &&
               String(val).replace(/^\s+|\s+$/g, '') == ''
           ) {
-            msg = gettext('Please select valid on error option .');
+            msg = gettext('Please select valid on error option.');
             this.errorModel.set('jstonerror', msg);
           } else {
             this.errorModel.unset('jstonerror');
diff --git a/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py b/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py
index 337e55cc4..24d3206ad 100644
--- a/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py
@@ -363,8 +363,7 @@ class ResourceGroupView(NodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s)." % arg
-                    )
+                        "Could not find the required parameter (%s).") % arg
                 )
         try:
             # Below logic will create new resource group
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 981582945..b99e709e4 100644
--- a/web/pgadmin/browser/server_groups/servers/static/js/variable.js
+++ b/web/pgadmin/browser/server_groups/servers/static/js/variable.js
@@ -203,7 +203,7 @@ function(gettext, _, $, Backbone, Backform, Backgrid, Alertify, pgAdmin, pgNode)
       } else if (_.isUndefined(this.get('value')) ||
               _.isNull(this.get('value')) ||
                 String(this.get('value')).replace(/^\s+|\s+$/g, '') == '') {
-        msg = ('Please enter a value for the parameter.');
+        msg = gettext('Please enter a value for the parameter.');
         this.errorModel.set('value', msg);
         this.errorModel.unset('name');
       } else {
diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
index 62436aa88..5250ff876 100644
--- a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
@@ -295,9 +295,8 @@ class TablespaceView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s)." %
+                        "Could not find the required parameter (%s).") %
                         required_args[arg]
-                    )
                 )
 
         # To format privileges coming from client
diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/static/js/tablespace.js b/web/pgadmin/browser/server_groups/servers/tablespaces/static/js/tablespace.js
index e328eb770..fe214d4b1 100644
--- a/web/pgadmin/browser/server_groups/servers/tablespaces/static/js/tablespace.js
+++ b/web/pgadmin/browser/server_groups/servers/tablespaces/static/js/tablespace.js
@@ -261,7 +261,7 @@ define('pgadmin.node.tablespace', [
                       self.__internal.buttons[2].element.disabled = false;
                     } else {
                       self.__internal.buttons[2].element.disabled = true;
-                      this.errorModel.set('tblspc', gettext('Please select tablespace'));
+                      this.errorModel.set('tblspc', gettext('Please select tablespace.'));
                     }
                   });
                 },
diff --git a/web/pgadmin/browser/server_groups/servers/types.py b/web/pgadmin/browser/server_groups/servers/types.py
index ba7d23fbe..2cc0cd251 100644
--- a/web/pgadmin/browser/server_groups/servers/types.py
+++ b/web/pgadmin/browser/server_groups/servers/types.py
@@ -74,7 +74,7 @@ class ServerType(object):
         return self.spriority
 
     def __str__(self):
-        return "Type: {0}, Description:{1}, Priority: {2}".format(
+        return _("Type: {0}, Description: {1}, Priority: {2}").format(
             self.stype, self.desc, self.spriority
         )
 
@@ -115,9 +115,9 @@ class ServerType(object):
             res = 'psql'
         else:
             raise Exception(
-                _("Could not find the utility for the operation '%s'".format(
+                _("Could not find the utility for the operation '%s'").format(
                     operation
-                ))
+                )
             )
         bin_path = self.utility_path.get()
         if "$DIR" in bin_path:
diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js
index e8ac4afef..ed54c3ccb 100644
--- a/web/pgadmin/browser/static/js/browser.js
+++ b/web/pgadmin/browser/static/js/browser.js
@@ -623,7 +623,7 @@ define('pgadmin.browser', [
 
                 Alertify.confirm(gettext('Reset Master Password'),
                   gettext('This will remove all the saved passwords. This will also remove established connections to '
-                    + 'the server and you may need to reconnect again. Do you wish to continue ?'),
+                    + 'the server and you may need to reconnect again. Do you wish to continue?'),
                   function() {
                     /* If user clicks Yes */
                     self.reset_master_password();
diff --git a/web/pgadmin/browser/static/js/collection.js b/web/pgadmin/browser/static/js/collection.js
index a3c9ad96e..7a2785f20 100644
--- a/web/pgadmin/browser/static/js/collection.js
+++ b/web/pgadmin/browser/static/js/collection.js
@@ -179,7 +179,7 @@ define([
                   <div class="custom-control custom-checkbox custom-checkbox-no-label">
                     <input tabindex="-1" type="checkbox" class="custom-control-input" id="${id}" ${disabled?'disabled':''}/>
                     <label class="custom-control-label" for="${id}">
-                      <span class="sr-only">Select<span>
+                      <span class="sr-only">` + gettext('Select') + `<span>
                     </label>
                   </div>
                 `);
diff --git a/web/pgadmin/browser/static/js/node.js b/web/pgadmin/browser/static/js/node.js
index df4657b6b..5d3d341cd 100644
--- a/web/pgadmin/browser/static/js/node.js
+++ b/web/pgadmin/browser/static/js/node.js
@@ -761,9 +761,7 @@ define('pgadmin.browser.node', [
         obj = pgBrowser.Nodes[d._type];
         var objName = d.label;
 
-        var msg, title, drop_label;
-
-        if (obj.dropAsRemove) drop_label = 'Remove'; else drop_label = 'Drop';
+        var msg, title;
 
         if (input.url == 'delete') {
 
@@ -780,8 +778,13 @@ define('pgadmin.browser.node', [
             return;
           }
         } else {
-          msg = gettext('Are you sure you want to %s %s "%s"?', drop_label.toLowerCase(), obj.label.toLowerCase(), d.label);
-          title = gettext('%s %s?', drop_label, obj.label);
+          if (obj.dropAsRemove) {
+            msg = gettext('Are you sure you want to remove %s "%s"?', obj.label.toLowerCase(), d.label);
+            title = gettext('Remove %s?', obj.label);
+          } else {
+            msg = gettext('Are you sure you want to drop %s "%s"?', obj.label.toLowerCase(), d.label);
+            title = gettext('Drop %s?', obj.label);
+          }
 
           if (!(_.isFunction(obj.canDrop) ?
             obj.canDrop.apply(obj, [d, i]) : obj.canDrop)) {
@@ -822,7 +825,11 @@ define('pgadmin.browser.node', [
 
               });
           },
-          null).show();
+          null
+        ).set('labels', {
+          ok: gettext('Yes'),
+          cancel: gettext('No'),
+        }).show();
       },
       // Callback for creating script(s) & opening them in Query editor
       show_script: function(args, item) {
diff --git a/web/pgadmin/browser/templates/browser/messages.html b/web/pgadmin/browser/templates/browser/messages.html
index 46602eba2..8b7d63409 100644
--- a/web/pgadmin/browser/templates/browser/messages.html
+++ b/web/pgadmin/browser/templates/browser/messages.html
@@ -3,7 +3,7 @@
 <div style="position: fixed; top: 70px; right: 20px; width: 400px; z-index: 9999">
     {% for category, message in messages %}
     <div class="alert alert-{{ category }} alert-dismissible" role="alert">
-        <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span
+        <button type="button" class="close" data-dismiss="alert" aria-label="{{ _('Close') }}"><span
                 aria-hidden="true">&times;</span></button>
         {{ message|safe }}
     </div>
diff --git a/web/pgadmin/browser/utils.py b/web/pgadmin/browser/utils.py
index 0fda71a0e..01cfad7ce 100644
--- a/web/pgadmin/browser/utils.py
+++ b/web/pgadmin/browser/utils.py
@@ -303,8 +303,8 @@ class NodeView(with_metaclass(MethodViewType, View)):
                 status=406,
                 success=0,
                 errormsg=gettext(
-                    'Unimplemented method ({0}) for this url ({1})'.format(
-                        meth, flask.request.path)
+                    'Unimplemented method ({0}) for this url ({1})').format(
+                        meth, flask.request.path
                 )
             )
 
diff --git a/web/pgadmin/dashboard/static/js/dashboard.js b/web/pgadmin/dashboard/static/js/dashboard.js
index 6fc82546c..66eeb35be 100644
--- a/web/pgadmin/dashboard/static/js/dashboard.js
+++ b/web/pgadmin/dashboard/static/js/dashboard.js
@@ -1448,7 +1448,7 @@ define('pgadmin.dashboard', [
         pg_version = this.get('postgres_version') || null,
         cell_action = this.get('cell_action') || null,
         is_cancel_session = cell_action === 'cancel',
-        txtAction = is_cancel_session ? gettext('cancel') : gettext('terminate');
+        txtMessage;
 
       // With PG10, We have background process showing on dashboard
       // We will not allow user to cancel them as they will fail with error
@@ -1456,20 +1456,22 @@ define('pgadmin.dashboard', [
 
       // Background processes do not have database field populated
       if (pg_version && pg_version >= 100000 && !m.get('datname')) {
-        Alertify.info(
-          gettext('You cannot ') +
-          txtAction +
-          gettext(' background worker processes.')
-        );
+        if (is_cancel_session) {
+          txtMessage = gettext('You cannot cancel background worker processes.');
+        } else {
+          txtMessage = gettext('You cannot terminate background worker processes.');
+        }
+        Alertify.info(txtMessage);
         return false;
         // If it is the last active connection on maintenance db then error out
       } else if (maintenance_database == m.get('datname') &&
         m.get('state') == 'active' && active_sessions.length == 1) {
-        Alertify.error(
-          gettext('You are not allowed to ') +
-          txtAction +
-          gettext(' the main active session.')
-        );
+        if (is_cancel_session) {
+          txtMessage = gettext('You are not allowed to cancel the main active session.');
+        } else {
+          txtMessage = gettext('You are not allowed to terminate the main active session.');
+        }
+        Alertify.error(txtMessage);
         return false;
       } else if (is_cancel_session && m.get('state') == 'idle') {
         // If this session is already idle then do nothing
@@ -1485,11 +1487,12 @@ define('pgadmin.dashboard', [
         return true;
       } else {
         // Do not allow to cancel someone else session to non-super user
-        Alertify.error(
-          gettext('Superuser privileges are required to ') +
-          txtAction +
-          gettext(' another users query.')
-        );
+        if (is_cancel_session) {
+          txtMessage = gettext('Superuser privileges are required to cancel another users query.');
+        } else {
+          txtMessage = gettext('Superuser privileges are required to terminate another users query.');
+        }
+        Alertify.error(txtMessage);
         return false;
       }
     },
diff --git a/web/pgadmin/dashboard/templates/dashboard/server_dashboard.html b/web/pgadmin/dashboard/templates/dashboard/server_dashboard.html
index 2cceb4d86..709bccec0 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/file_manager/__init__.py b/web/pgadmin/misc/file_manager/__init__.py
index 0be67e465..e34a69a68 100644
--- a/web/pgadmin/misc/file_manager/__init__.py
+++ b/web/pgadmin/misc/file_manager/__init__.py
@@ -367,23 +367,23 @@ class Filemanager(object):
             capabilities = ['select_file', 'rename', 'upload', 'create']
             files_only = True
             folders_only = False
-            title = "Select File"
+            title = gettext("Select File")
         elif fm_type == 'select_folder':
             capabilities = ['select_folder', 'rename', 'create']
             files_only = False
             folders_only = True
-            title = "Select Folder"
+            title = gettext("Select Folder")
         elif fm_type == 'create_file':
             capabilities = ['select_file', 'rename', 'create']
             files_only = True
             folders_only = False
-            title = "Create File"
+            title = gettext("Create File")
         elif fm_type == 'storage_dialog':
             capabilities = ['select_folder', 'select_file', 'download',
                             'rename', 'delete', 'upload', 'create']
             files_only = True
             folders_only = False
-            title = "Storage Manager"
+            title = gettext("Storage Manager")
 
         # get last visited directory, if not present then traverse in reverse
         # order to find closest parent directory
@@ -561,7 +561,7 @@ class Filemanager(object):
             Filemanager.check_access_permission(dir, path)
         except Exception as e:
             Filemanager.resume_windows_warning()
-            err_msg = u"Error: {0}".format(e)
+            err_msg = gettext(u"Error: {0}").format(e)
             files = {
                 'Code': 0,
                 'Error': err_msg
@@ -601,7 +601,7 @@ class Filemanager(object):
             Filemanager.resume_windows_warning()
             return {
                 'Code': 0,
-                'Error': gettext(u"'{0}' file does not exist.".format(path))
+                'Error': gettext(u"'{0}' file does not exist.").format(path)
             }
 
         user_dir = path
@@ -664,9 +664,9 @@ class Filemanager(object):
             Filemanager.resume_windows_warning()
             if (hasattr(e, 'strerror') and
                     e.strerror == gettext('Permission denied')):
-                err_msg = u"Error: {0}".format(e.strerror)
+                err_msg = gettext(u"Error: {0}").format(e.strerror)
             else:
-                err_msg = u"Error: {0}".format(e)
+                err_msg = gettext(u"Error: {0}").format(e)
             files = {
                 'Code': 0,
                 'Error': err_msg
@@ -699,7 +699,7 @@ class Filemanager(object):
         # Do not allow user to access outside his storage dir in server mode.
         if not orig_path.startswith(dir):
             raise Exception(
-                gettext(u"Access denied ({0})".format(path)))
+                gettext(u"Access denied ({0})").format(path))
         return True
 
     @staticmethod
@@ -759,7 +759,7 @@ class Filemanager(object):
                 'Filename': split_path(path)[-1],
                 'FileType': '',
                 'Path': path,
-                'Error': gettext(u"Error: {0}".format(e)),
+                'Error': gettext(u"Error: {0}").format(e),
                 'Code': 0,
                 'Info': '',
                 'Properties': {
@@ -791,8 +791,7 @@ class Filemanager(object):
 
         if not path_exists(orig_path):
             thefile['Error'] = gettext(
-                u"'{0}' file does not exist.".format(path)
-            )
+                u"'{0}' file does not exist.").format(path)
             thefile['Code'] = -1
             return thefile
 
@@ -844,7 +843,7 @@ class Filemanager(object):
             Filemanager.check_access_permission(dir, new)
         except Exception as e:
             res = {
-                'Error': gettext(u"Error: {0}".format(e)),
+                'Error': gettext(u"Error: {0}").format(e),
                 'Code': 0
             }
             return res
@@ -925,7 +924,7 @@ class Filemanager(object):
                 os.remove(orig_path)
         except Exception as e:
             code = 0
-            err_msg = u"Error: {0}".format(e.strerror)
+            err_msg = gettext(u"Error: {0}").format(e.strerror)
 
         result = {
             'Path': path,
@@ -969,14 +968,14 @@ class Filemanager(object):
                     f.write(data)
         except Exception as e:
             code = 0
-            err_msg = u"Error: {0}".format(
-                e.strerror if hasattr(e, 'strerror') else u'Unknown')
+            err_msg = gettext(u"Error: {0}").format(
+                e.strerror if hasattr(e, 'strerror') else gettext(u'Unknown'))
 
         try:
             Filemanager.check_access_permission(dir, path)
         except Exception as e:
             res = {
-                'Error': gettext(u"Error: {0}".format(e)),
+                'Error': gettext(u"Error: {0}").format(e),
                 'Code': 0
             }
             return res
@@ -1013,9 +1012,9 @@ class Filemanager(object):
         except Exception as e:
             code = 0
             if hasattr(e, 'strerror'):
-                err_msg = u"Error: {0}".format(e.strerror)
+                err_msg = gettext(u"Error: {0}").format(e.strerror)
             else:
-                err_msg = u"Error: {0}".format(e)
+                err_msg = gettext(u"Error: {0}").format(e)
 
         result = {
             'Path': path,
@@ -1098,13 +1097,13 @@ class Filemanager(object):
             # we don't want to expose real path of file
             # so only show error message.
             if ex.strerror == 'Permission denied':
-                err_msg = u"Error: {0}".format(ex.strerror)
+                err_msg = gettext(u"Error: {0}").format(ex.strerror)
             else:
-                err_msg = u"Error: {0}".format(str(ex))
+                err_msg = gettext(u"Error: {0}").format(str(ex))
 
         except Exception as ex:
             status = False
-            err_msg = u"Error: {0}".format(str(ex))
+            err_msg = gettext(u"Error: {0}").format(str(ex))
 
         # Remove root storage path from error message
         # when running in Server mode
@@ -1150,14 +1149,14 @@ class Filemanager(object):
                 os.mkdir(newPath)
             except Exception as e:
                 code = 0
-                err_msg = u"Error: {0}".format(e.strerror)
+                err_msg = gettext(u"Error: {0}").format(e.strerror)
         else:
             newPath, newName = self.getNewName(dir, path, name)
             try:
                 os.mkdir(newPath)
             except Exception as e:
                 code = 0
-                err_msg = u"Error: {0}".format(e.strerror)
+                err_msg = gettext(u"Error: {0}").format(e.strerror)
 
         result = {
             'Parent': path,
@@ -1191,7 +1190,7 @@ class Filemanager(object):
                 dir, u"{}{}".format(path, path)
             )
         except Exception as e:
-            resp = Response(gettext(u"Error: {0}".format(e)))
+            resp = Response(gettext(u"Error: {0}").format(e))
             resp.headers['Content-Disposition'] = \
                 'attachment; filename=' + name
             return resp
@@ -1208,7 +1207,7 @@ class Filemanager(object):
         try:
             Filemanager.check_access_permission(dir, path)
         except Exception as e:
-            err_msg = u"Error: {0}".format(e)
+            err_msg = gettext(u"Error: {0}").format(e)
             res['Code'] = 0
             res['Error'] = err_msg
         return res
diff --git a/web/pgadmin/misc/file_manager/static/js/select_dialogue.js b/web/pgadmin/misc/file_manager/static/js/select_dialogue.js
index 97d1ed770..5e63bd7eb 100644
--- a/web/pgadmin/misc/file_manager/static/js/select_dialogue.js
+++ b/web/pgadmin/misc/file_manager/static/js/select_dialogue.js
@@ -22,7 +22,7 @@ module.exports =  Alertify.dialog('fileSelectionDlg', function() {
       // Set title and button name
       var self = this;
       if (_.isUndefined(params['dialog_title'])) {
-        params['dialog_title'] = 'Select file';
+        params['dialog_title'] = gettext('Select file');
       }
       self.dialog_type = params['dialog_type'];
 
diff --git a/web/pgadmin/misc/static/explain/js/explain_statistics.js b/web/pgadmin/misc/static/explain/js/explain_statistics.js
index 51ff772c7..7558e967f 100644
--- a/web/pgadmin/misc/static/explain/js/explain_statistics.js
+++ b/web/pgadmin/misc/static/explain/js/explain_statistics.js
@@ -9,6 +9,7 @@
 
 import $ from 'jquery';
 import Backbone from 'backbone';
+import gettext from 'sources/gettext';
 
 // Backbone model for other statistics
 let StatisticsModel = Backbone.Model.extend({
@@ -34,7 +35,7 @@ let StatisticsModel = Backbone.Model.extend({
     });
 
     if (Object.keys(jit_stats).length > 0){
-      tooltip.append('<tr><td class="label explain-tooltip">JIT:</td></tr>');
+      tooltip.append('<tr><td class="label explain-tooltip">' + gettext('JIT:') + '</td></tr>');
       _.each(jit_stats, function(value, key) {
         key = _.escape(key);
         value = _.escape(value);
@@ -48,7 +49,7 @@ let StatisticsModel = Backbone.Model.extend({
     }
 
     if (Object.keys(triggers_stats).length > 0){
-      tooltip.append('<tr><td class="label explain-tooltip">Triggers:</td></tr>');
+      tooltip.append('<tr><td class="label explain-tooltip">' + gettext('Triggers:') + '</td></tr>');
       _.each(triggers_stats, function(triggers, key_id) {
         if (triggers instanceof Object) {
           _.each(triggers, function(value, key) {
@@ -87,7 +88,7 @@ let StatisticsModel = Backbone.Model.extend({
     }
 
     if (Object.keys(summary).length > 0){
-      tooltip.append('<tr><td class="label explain-tooltip">Summary:</td></tr>');
+      tooltip.append('<tr><td class="label explain-tooltip">' + gettext('Summary:') + '</td></tr>');
       _.each(summary, function(value, key) {
         key = _.escape(key);
         value = _.escape(value);
diff --git a/web/pgadmin/static/js/alertify/dialog.js b/web/pgadmin/static/js/alertify/dialog.js
index 8e5bdb738..77040848d 100644
--- a/web/pgadmin/static/js/alertify/dialog.js
+++ b/web/pgadmin/static/js/alertify/dialog.js
@@ -8,7 +8,6 @@
 //////////////////////////////////////////////////////////////
 
 import gettext from '../gettext';
-import {sprintf} from 'sources/utils';
 import {DialogFactory} from './dialog_factory';
 import Backform from '../backform.pgadmin';
 import {getTreeNodeHierarchyFromIdentifier} from '../tree/pgadmin_tree_node';
@@ -133,7 +132,7 @@ export class Dialog {
     } else {
       this.alertify.alert(
         gettext(this.errorAlertTitle),
-        sprintf(gettext('Failed to load preference %s of module %s'), preference_name, module)
+        gettext('Failed to load preference %s of module %s', preference_name, module)
       );
       return false;
     }
diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js
index 303e62064..08f078d60 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -586,7 +586,7 @@ define([
       '<span class="<%=controlLabelClassName%>"><%=label%></span>',
       '<label class="sr-value sr-only" for="<%=cId%>"></label>',
       '<div class="<%=controlsClassName%> <%=extraClasses.join(\' \')%>">',
-      '      <input tabindex="-1" type="checkbox" aria-hidden="true" aria-label="Toggle button" data-style="quick" data-toggle="toggle"',
+      '      <input tabindex="-1" type="checkbox" aria-hidden="true" aria-label="' + gettext('Toggle button') + '" data-style="quick" data-toggle="toggle"',
       '      data-size="<%=options.size%>" data-height="<%=options.height%>"  ',
       '      data-on="<%=options.onText%>" data-off="<%=options.offText%>" ',
       '      data-onstyle="<%=options.onColor%>" data-offstyle="<%=options.offColor%>" data-width="<%=options.width%>" ',
@@ -2723,7 +2723,7 @@ define([
       '<div class="input-group">',
       '<input type="<%=type%>" id="<%=cId%>" class="form-control <%=extraClasses.join(\' \')%>" name="<%=name%>" min="<%=min%>" max="<%=max%>"maxlength="<%=maxlength%>" value="<%-value%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=readonly ? "readonly aria-readonly=true" : ""%> <%=required ? "required" : ""%> />',
       '<div class="input-group-append">',
-      '<button class="btn btn-secondary fa fa-ellipsis-h select_item" <%=disabled ? "disabled" : ""%> <%=readonly ? "disabled" : ""%> aria-hidden="true" aria-label="Select file" title="Select file"></button>',
+      '<button class="btn btn-secondary fa fa-ellipsis-h select_item" <%=disabled ? "disabled" : ""%> <%=readonly ? "disabled" : ""%> aria-hidden="true" aria-label="' + gettext('Select file') + '" title="' + gettext('Select file') + '"></button>',
       '</div>',
       '</div>',
       '<% if (helpMessage && helpMessage.length) { %>',
diff --git a/web/pgadmin/static/js/browser/server_groups/servers/databases/external_tables/external_tables.js b/web/pgadmin/static/js/browser/server_groups/servers/databases/external_tables/external_tables.js
index 204b73168..396cca4a1 100644
--- a/web/pgadmin/static/js/browser/server_groups/servers/databases/external_tables/external_tables.js
+++ b/web/pgadmin/static/js/browser/server_groups/servers/databases/external_tables/external_tables.js
@@ -59,7 +59,7 @@ export function initialize(pgBrowser, gettext) {
             mode: ['properties'],
           }, {
             id: 'format_option',
-            label: gettext('Format Optionos'),
+            label: gettext('Format Options'),
             type: 'text',
             mode: ['properties'],
           }, {
diff --git a/web/pgadmin/static/js/sqleditor/call_render_after_poll.js b/web/pgadmin/static/js/sqleditor/call_render_after_poll.js
index b5a38c4b8..d8d364722 100644
--- a/web/pgadmin/static/js/sqleditor/call_render_after_poll.js
+++ b/web/pgadmin/static/js/sqleditor/call_render_after_poll.js
@@ -9,7 +9,6 @@
 
 import {calculateQueryRunTime} from './calculate_query_run_time';
 import gettext from '../gettext';
-import {sprintf} from 'sources/utils';
 
 function hasResultsToDisplay(res) {
   return res.colinfo != null;
@@ -34,8 +33,7 @@ export function callRenderAfterPoll(sqlEditor, alertify, res) {
     sqlEditor.total_time = calculateQueryRunTime(
       sqlEditor.query_start_time,
       sqlEditor.query_end_time);
-    const msg = sprintf(
-      gettext('Query returned successfully in %s.'), sqlEditor.total_time);
+    const msg = gettext('Query returned successfully in %s.', sqlEditor.total_time);
     if (res.result)
       res.result += '\n\n' + msg;
     else
diff --git a/web/pgadmin/static/js/sqleditor/execute_query.js b/web/pgadmin/static/js/sqleditor/execute_query.js
index c7626bd06..6c4069d24 100644
--- a/web/pgadmin/static/js/sqleditor/execute_query.js
+++ b/web/pgadmin/static/js/sqleditor/execute_query.js
@@ -198,7 +198,7 @@ class ExecuteQuery {
   }
 
   initializeExecutionOnSqlEditor(sqlStatement) {
-    this.loadingScreen.show('Running query...');
+    this.loadingScreen.show(gettext('Running query...'));
 
     $('#btn-flash').prop('disabled', true);
     $('#btn-download').prop('disabled', true);
diff --git a/web/pgadmin/static/js/sqleditor/geometry_viewer.js b/web/pgadmin/static/js/sqleditor/geometry_viewer.js
index 54ba0073e..40d2de914 100644
--- a/web/pgadmin/static/js/sqleditor/geometry_viewer.js
+++ b/web/pgadmin/static/js/sqleditor/geometry_viewer.js
@@ -390,7 +390,7 @@ function parseData(items, columns, columnIndex, GeometryLib) {
   }
 
   if (mixedSRID) {
-    infoList.push(gettext('Geometries with non-SRID') + selectedSRID + ' not rendered.');
+    infoList.push(gettext('Geometries with non-SRID %s not rendered.', selectedSRID));
   }
 
   return {
diff --git a/web/pgadmin/static/js/sqleditor/query_tool_notifications.js b/web/pgadmin/static/js/sqleditor/query_tool_notifications.js
index aec3b6690..181e58d58 100644
--- a/web/pgadmin/static/js/sqleditor/query_tool_notifications.js
+++ b/web/pgadmin/static/js/sqleditor/query_tool_notifications.js
@@ -115,18 +115,10 @@ let queryToolNotifications = {
       for (let i in notify_messages) {
         let notify_msg = '';
         if (notify_messages[i].payload != '') {
-          notify_msg = gettext('Asynchronous notification "')
-            + notify_messages[i].channel
-            + gettext('" with payload "')
-            + notify_messages[i].payload
-            + gettext('" received from server process with PID ')
-            + notify_messages[i].pid;
+          notify_msg = gettext('Asynchronous notification "%s" with payload "%s" received from server process with PID %s', notify_messages[i].channel, notify_messages[i].payload, notify_messages[i].pid);
         }
         else {
-          notify_msg = gettext('Asynchronous notification "')
-            + notify_messages[i].channel
-            + gettext('" received from server process with PID ')
-            + notify_messages[i].pid;
+          notify_msg = gettext('Asynchronous notification "%s" received from server process with PID %s', notify_messages[i].channel, notify_messages[i].pid);
         }
 
         Alertify.info(notify_msg);
diff --git a/web/pgadmin/static/js/sqleditor/query_tool_preferences.js b/web/pgadmin/static/js/sqleditor/query_tool_preferences.js
index 01cddcb4e..553984758 100644
--- a/web/pgadmin/static/js/sqleditor/query_tool_preferences.js
+++ b/web/pgadmin/static/js/sqleditor/query_tool_preferences.js
@@ -90,7 +90,7 @@ function updateUIPreferences(sqlEditor) {
     .attr('accesskey', shortcut_key(preferences.btn_conn_status))
     .find('i')
     .attr('title',
-      shortcut_accesskey_title('Connection status (click for details)',
+      shortcut_accesskey_title(gettext('Connection status (click for details)'),
         preferences.btn_conn_status));
 
   /* Accessed using ctrl,atl,shift and key */
diff --git a/web/pgadmin/tools/backup/static/js/backup_dialog.js b/web/pgadmin/tools/backup/static/js/backup_dialog.js
index 355ca39e4..481fc7463 100644
--- a/web/pgadmin/tools/backup/static/js/backup_dialog.js
+++ b/web/pgadmin/tools/backup/static/js/backup_dialog.js
@@ -15,7 +15,7 @@ import axios from 'axios/index';
 
 export class BackupDialog extends Dialog {
   constructor(pgBrowser, $, alertify, BackupModel, backform = Backform) {
-    super('Backup Error',
+    super(gettext('Backup Error'),
       '<div class=\'backup_dialog\'></div>',
       pgBrowser, $, alertify, BackupModel, backform
     );
diff --git a/web/pgadmin/tools/datagrid/static/js/show_data.js b/web/pgadmin/tools/datagrid/static/js/show_data.js
index fd4aed3a4..d2700cfbf 100644
--- a/web/pgadmin/tools/datagrid/static/js/show_data.js
+++ b/web/pgadmin/tools/datagrid/static/js/show_data.js
@@ -56,7 +56,7 @@ export function showDataGrid(
 
     $.get(url_for('datagrid.filter'),
       function(data) {
-        alertify.filterDialog(`Data Filter - ${queryToolTitle}`, data, validateUrl, preferences, okCallback)
+        alertify.filterDialog(gettext('Data Filter - %s', queryToolTitle), data, validateUrl, preferences, okCallback)
           .resizeTo(pgBrowser.stdW.sm,pgBrowser.stdH.sm);
       }
     );
diff --git a/web/pgadmin/tools/debugger/__init__.py b/web/pgadmin/tools/debugger/__init__.py
index 2336d538d..efec9298d 100644
--- a/web/pgadmin/tools/debugger/__init__.py
+++ b/web/pgadmin/tools/debugger/__init__.py
@@ -891,7 +891,7 @@ def start_debugger_listener(trans_id):
             data={
                 'status': False,
                 'result': gettext(
-                    'Not connected to server or connection with the server has'
+                    'Not connected to server or connection with the server has '
                     'been closed.'
                 )
             }
diff --git a/web/pgadmin/tools/debugger/static/js/direct.js b/web/pgadmin/tools/debugger/static/js/direct.js
index 179ded6c9..5011c4a5a 100644
--- a/web/pgadmin/tools/debugger/static/js/direct.js
+++ b/web/pgadmin/tools/debugger/static/js/direct.js
@@ -1909,33 +1909,33 @@ define([
 
       /* Update the shortcuts of the buttons */
       self.toolbarView.$el.find('#btn-step-into')
-        .attr('title', keyboardShortcuts.shortcut_accesskey_title('Step into',self.preferences.btn_step_into))
-        .attr('aria-label', keyboardShortcuts.shortcut_accesskey_title('Step into',self.preferences.btn_step_into))
+        .attr('title', keyboardShortcuts.shortcut_accesskey_title(gettext('Step into'),self.preferences.btn_step_into))
+        .attr('aria-label', keyboardShortcuts.shortcut_accesskey_title(gettext('Step into'),self.preferences.btn_step_into))
         .attr('accesskey', keyboardShortcuts.shortcut_key(self.preferences.btn_step_into));
 
       self.toolbarView.$el.find('#btn-step-over')
-        .attr('title', keyboardShortcuts.shortcut_accesskey_title('Step over',self.preferences.btn_step_over))
-        .attr('aria-label', keyboardShortcuts.shortcut_accesskey_title('Step over',self.preferences.btn_step_over))
+        .attr('title', keyboardShortcuts.shortcut_accesskey_title(gettext('Step over'),self.preferences.btn_step_over))
+        .attr('aria-label', keyboardShortcuts.shortcut_accesskey_title(gettext('Step over'),self.preferences.btn_step_over))
         .attr('accesskey', keyboardShortcuts.shortcut_key(self.preferences.btn_step_over));
 
       self.toolbarView.$el.find('#btn-continue')
-        .attr('title', keyboardShortcuts.shortcut_accesskey_title('Continue/Start',self.preferences.btn_start))
-        .attr('aria-label', keyboardShortcuts.shortcut_accesskey_title('Continue/Start',self.preferences.btn_start))
+        .attr('title', keyboardShortcuts.shortcut_accesskey_title(gettext('Continue/Start'),self.preferences.btn_start))
+        .attr('aria-label', keyboardShortcuts.shortcut_accesskey_title(gettext('Continue/Start'),self.preferences.btn_start))
         .attr('accesskey', keyboardShortcuts.shortcut_key(self.preferences.btn_start));
 
       self.toolbarView.$el.find('#btn-toggle-breakpoint')
-        .attr('title', keyboardShortcuts.shortcut_accesskey_title('Toggle breakpoint',self.preferences.btn_toggle_breakpoint))
-        .attr('aria-label', keyboardShortcuts.shortcut_accesskey_title('Toggle breakpoint',self.preferences.btn_toggle_breakpoint))
+        .attr('title', keyboardShortcuts.shortcut_accesskey_title(gettext('Toggle breakpoint'),self.preferences.btn_toggle_breakpoint))
+        .attr('aria-label', keyboardShortcuts.shortcut_accesskey_title(gettext('Toggle breakpoint'),self.preferences.btn_toggle_breakpoint))
         .attr('accesskey', keyboardShortcuts.shortcut_key(self.preferences.btn_toggle_breakpoint));
 
       self.toolbarView.$el.find('#btn-clear-breakpoint')
-        .attr('title', keyboardShortcuts.shortcut_accesskey_title('Clear all breakpoints',self.preferences.btn_clear_breakpoints))
-        .attr('aria-label', keyboardShortcuts.shortcut_accesskey_title('Clear all breakpoints',self.preferences.btn_clear_breakpoints))
+        .attr('title', keyboardShortcuts.shortcut_accesskey_title(gettext('Clear all breakpoints'),self.preferences.btn_clear_breakpoints))
+        .attr('aria-label', keyboardShortcuts.shortcut_accesskey_title(gettext('Clear all breakpoints'),self.preferences.btn_clear_breakpoints))
         .attr('accesskey', keyboardShortcuts.shortcut_key(self.preferences.btn_clear_breakpoints));
 
       self.toolbarView.$el.find('#btn-stop')
-        .attr('title', keyboardShortcuts.shortcut_accesskey_title('Stop',self.preferences.btn_stop))
-        .attr('aria-label', keyboardShortcuts.shortcut_accesskey_title('Stop',self.preferences.btn_stop))
+        .attr('title', keyboardShortcuts.shortcut_accesskey_title(gettext('Stop'),self.preferences.btn_stop))
+        .attr('aria-label', keyboardShortcuts.shortcut_accesskey_title(gettext('Stop'),self.preferences.btn_stop))
         .attr('accesskey', keyboardShortcuts.shortcut_key(self.preferences.btn_stop));
     },
     // Register the panel with new debugger docker instance.
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 6eeddd0bf..9031bc49c 100644
--- a/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js
+++ b/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js
@@ -713,7 +713,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="` + gettext('Search') + `" aria-label="Search" aria-describedby="labelSearch">
+                                <input type="search" class="form-control" id="txtGridSearch" placeholder="` + gettext('Search') + '" aria-label="' + gettext('Search') + `" aria-describedby="labelSearch">
                               </div>
                             </div>
                           </div>
diff --git a/web/pgadmin/tools/import_export/static/js/import_export.js b/web/pgadmin/tools/import_export/static/js/import_export.js
index c46a4e9d8..e8cad1012 100644
--- a/web/pgadmin/tools/import_export/static/js/import_export.js
+++ b/web/pgadmin/tools/import_export/static/js/import_export.js
@@ -201,7 +201,7 @@ define([
         multiple: true,
         allowClear: true,
         first_empty: false,
-        placeholder: gettext('Colums for exporting...'),
+        placeholder: gettext('Columns for exporting...'),
         preserveSelectionOrder: true,
       },
       visible: 'exporting',
diff --git a/web/pgadmin/tools/restore/static/js/restore_dialog.js b/web/pgadmin/tools/restore/static/js/restore_dialog.js
index ea6ccf4b9..145e2f466 100644
--- a/web/pgadmin/tools/restore/static/js/restore_dialog.js
+++ b/web/pgadmin/tools/restore/static/js/restore_dialog.js
@@ -8,7 +8,6 @@
 //////////////////////////////////////////////////////////////
 
 import gettext from '../../../../static/js/gettext';
-import {sprintf} from 'sources/utils';
 import Backform from '../../../../static/js/backform.pgadmin';
 import {Dialog} from '../../../../static/js/alertify/dialog';
 import url_for from 'sources/url_for';
@@ -16,7 +15,7 @@ import axios from 'axios/index';
 
 export class RestoreDialog extends Dialog {
   constructor(pgBrowser, $, alertify, RestoreModel, backform = Backform) {
-    super('Restore Error',
+    super(gettext('Restore Error'),
       '<div class=\'restore_dialog\'></div>',
       pgBrowser, $, alertify, RestoreModel, backform);
   }
@@ -66,7 +65,7 @@ export class RestoreDialog extends Dialog {
       if (!node)
         return;
 
-      let title = sprintf(gettext('Restore (%s: %s)'), node.label, data.label);
+      let title = gettext('Restore (%s: %s)', node.label, data.label);
       that.createOrGetDialog(title, 'restore');
       that.alertify.pg_restore(title, aciTreeItem1, data, node)
         .resizeTo(width, height);
diff --git a/web/pgadmin/tools/sqleditor/__init__.py b/web/pgadmin/tools/sqleditor/__init__.py
index 7ecbb4845..386a655e4 100644
--- a/web/pgadmin/tools/sqleditor/__init__.py
+++ b/web/pgadmin/tools/sqleditor/__init__.py
@@ -1296,10 +1296,10 @@ def save_file():
             else:
                 output_file.write(file_content)
     except IOError as e:
-        err_msg = "Error: {0}".format(e.strerror)
+        err_msg = gettext("Error: {0}").format(e.strerror)
         return internal_server_error(errormsg=err_msg)
     except Exception as e:
-        err_msg = "Error: {0}".format(e.strerror)
+        err_msg = gettext("Error: {0}").format(e.strerror)
         return internal_server_error(errormsg=err_msg)
 
     return make_json_response(
@@ -1371,7 +1371,7 @@ def start_query_download_tool(trans_id):
 
                 return r
         except Exception as e:
-            err_msg = "Error: {0}".format(e.strerror)
+            err_msg = gettext("Error: {0}").format(e.strerror)
             return internal_server_error(errormsg=err_msg)
     else:
         return internal_server_error(
diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
index f76bdbc7a..f5519fcdf 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
@@ -3331,8 +3331,8 @@ define('tools.querytool', [
               return true;
             }
           ).set('labels', {
-            ok: 'Yes',
-            cancel: 'No',
+            ok: gettext('Yes'),
+            cancel: gettext('No'),
           });
         } else {
           self._open_select_file_manager();
@@ -4275,7 +4275,7 @@ define('tools.querytool', [
           };
         });
 
-        let msg = gettext('The current transaction is not commited to the database.'
+        let msg = gettext('The current transaction is not commited to the database. '
                            + 'Do you want to commit or rollback the transaction?');
 
         alertify.confirmCommit(gettext('Commit transaction?'), msg, is_commit_disabled);
diff --git a/web/pgadmin/tools/user_management/__init__.py b/web/pgadmin/tools/user_management/__init__.py
index 78aa99a15..20ef16bb8 100644
--- a/web/pgadmin/tools/user_management/__init__.py
+++ b/web/pgadmin/tools/user_management/__init__.py
@@ -251,7 +251,7 @@ def create_user(data):
         if f in data and data[f] != '':
             continue
         else:
-            return False, _("Missing field: '{0}'".format(f))
+            return False, _("Missing field: '{0}'").format(f)
 
     try:
         new_data = validate_user(data)
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 2fbe1dd59..23ea06807 100644
--- a/web/pgadmin/tools/user_management/static/js/user_management.js
+++ b/web/pgadmin/tools/user_management/static/js/user_management.js
@@ -869,9 +869,9 @@ 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="` + gettext('Search') + `" aria-label="Search" aria-describedby="labelSearch" />
+                          <input type="search" class="form-control" id="txtGridSearch" placeholder="` + gettext('Search') + '" aria-label="' + gettext('Search') + `" aria-describedby="labelSearch" />
                         </div>
-                        <button id="btn_refresh" type="button" class="btn btn-secondary btn-navtab-inline add" title="Add">
+                        <button id="btn_refresh" type="button" class="btn btn-secondary btn-navtab-inline add" title="` + gettext('Add') + `">
                           <span class="fa fa-plus "></span>
                         </button>
                       </div>
diff --git a/web/pgadmin/utils/driver/psycopg2/connection.py b/web/pgadmin/utils/driver/psycopg2/connection.py
index d3f276fd1..21799c9c0 100644
--- a/web/pgadmin/utils/driver/psycopg2/connection.py
+++ b/web/pgadmin/utils/driver/psycopg2/connection.py
@@ -1745,7 +1745,7 @@ Failed to reset the connection to the server due to following error:
         # Do not append if error starts with `ERROR:` as most pg related
         # error starts with `ERROR:`
         if not errmsg.startswith(u'ERROR:'):
-            errmsg = u'ERROR:  ' + errmsg + u'\n\n'
+            errmsg = gettext(u'ERROR: ') + errmsg + u'\n\n'
 
         if exception_obj.diag.severity is not None \
                 and exception_obj.diag.message_primary is not None:
diff --git a/web/pgadmin/utils/driver/psycopg2/server_manager.py b/web/pgadmin/utils/driver/psycopg2/server_manager.py
index 57ddd6179..c14831a8c 100644
--- a/web/pgadmin/utils/driver/psycopg2/server_manager.py
+++ b/web/pgadmin/utils/driver/psycopg2/server_manager.py
@@ -159,17 +159,17 @@ class ServerManager(object):
     def MajorVersion(self):
         if self.sversion is not None:
             return int(self.sversion / 10000)
-        raise Exception("Information is not available.")
+        raise Exception(gettext("Information is not available."))
 
     def MinorVersion(self):
         if self.sversion:
             return int(int(self.sversion / 100) % 100)
-        raise Exception("Information is not available.")
+        raise Exception(gettext("Information is not available."))
 
     def PatchVersion(self):
         if self.sversion:
             return int(int(self.sversion / 100) / 100)
-        raise Exception("Information is not available.")
+        raise Exception(gettext("Information is not available."))
 
     def connection(
             self, database=None, conn_id=None, auto_reconnect=True, did=None,
@@ -492,8 +492,8 @@ WHERE db.oid = {0}""".format(did))
 
             except Exception as e:
                 current_app.logger.exception(e)
-                return False, "Failed to decrypt the SSH tunnel " \
-                              "password.\nError: {0}".format(str(e))
+                return False, gettext("Failed to decrypt the SSH tunnel "
+                                      "password.\nError: {0}").format(str(e))
 
         try:
             # If authentication method is 1 then it uses identity file
@@ -518,8 +518,8 @@ WHERE db.oid = {0}""".format(did))
             self.tunnel_created = True
         except BaseSSHTunnelForwarderError as e:
             current_app.logger.exception(e)
-            return False, "Failed to create the SSH tunnel." \
-                          "\nError: {0}".format(str(e))
+            return False, gettext("Failed to create the SSH tunnel.\n"
+                                  "Error: {0}").format(str(e))
 
         # Update the port to communicate locally
         self.local_bind_port = self.tunnel_object.local_bind_port


^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgAdmin 4 - next gettext usage fixes
  2020-04-08 15:41 pgAdmin 4 - next gettext usage fixes Libor M. <[email protected]>
@ 2020-04-10 09:27 ` Akshay Joshi <[email protected]>
  2020-04-15 06:08   ` Re: pgAdmin 4 - next gettext usage fixes Aditya Toshniwal <[email protected]>
  0 siblings, 1 reply; 11+ messages in thread

From: Akshay Joshi @ 2020-04-10 09:27 UTC (permalink / raw)
  To: Libor M. <[email protected]>; +Cc: pgadmin-hackers

Hi Libor

Thanks, patch applied. Please make sure to run the PEP8 checks before
sending the patch.
I have fixed and committed the code.

On Wed, Apr 8, 2020 at 9:30 PM Libor M. <[email protected]> wrote:

> Hello,
> I fixed next gettext usage:
>
> - fixed gettext usage with .format() only for original text with %s
> - fixed typos
> - fixed translation yes/no buttons in dialog
> - improved translating sentences without "connecting" words (eg. see
> web/pgadmin/dashboard/static/js/dashboard.js, word 'cancel' needs to
> be translated in Czech language as 'zrušit' but in another sentence as
> 'zrušení')
> - added gettext for text 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] 11+ messages in thread

* Re: pgAdmin 4 - next gettext usage fixes
  2020-04-08 15:41 pgAdmin 4 - next gettext usage fixes Libor M. <[email protected]>
  2020-04-10 09:27 ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
@ 2020-04-15 06:08   ` Aditya Toshniwal <[email protected]>
  2020-04-15 06:17     ` Re: pgAdmin 4 - next gettext usage fixes Ashesh Vashi <[email protected]>
  2020-04-15 08:03     ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  0 siblings, 2 replies; 11+ messages in thread

From: Aditya Toshniwal @ 2020-04-15 06:08 UTC (permalink / raw)
  To: Akshay Joshi <[email protected]>; +Cc: Libor M. <[email protected]>; pgadmin-hackers

Hi Hackers/Libor,

The changes like below are incorrect. Try "Count rows" from a table's
context menu.

-            info=gettext("Table rows counted: %s" % count),

+            info=gettext("Table rows counted: %s") % count,

Attached is the patch to fix all such changes in pgAdmin, to use format()
instead.
Please review.

On Fri, Apr 10, 2020 at 2:57 PM Akshay Joshi <[email protected]>
wrote:

> Hi Libor
>
> Thanks, patch applied. Please make sure to run the PEP8 checks before
> sending the patch.
> I have fixed and committed the code.
>
> On Wed, Apr 8, 2020 at 9:30 PM Libor M. <[email protected]> wrote:
>
>> Hello,
>> I fixed next gettext usage:
>>
>> - fixed gettext usage with .format() only for original text with %s
>> - fixed typos
>> - fixed translation yes/no buttons in dialog
>> - improved translating sentences without "connecting" words (eg. see
>> web/pgadmin/dashboard/static/js/dashboard.js, word 'cancel' needs to
>> be translated in Czech language as 'zrušit' but in another sentence as
>> 'zrušení')
>> - added gettext for text 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] gettext_format_fixes.patch (28.3K, 3-gettext_format_fixes.patch)
  download | inline diff:
diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py
index ef6461ee4..dd5fc0535 100644
--- a/web/pgadmin/__init__.py
+++ b/web/pgadmin/__init__.py
@@ -503,13 +503,13 @@ def create_app(app_name=None):
                             svr_discovery_id = inst_id
                             svr_comment = gettext(
                                 "Auto-detected %s installation with the data "
-                                "directory at %s") % (
+                                "directory at {}".format(
                                     winreg.QueryValueEx(
                                         inst_key, 'Display Name'
                                     )[0],
                                     winreg.QueryValueEx(
                                         inst_key, 'Data Directory'
-                                    )[0])
+                                    )[0]))
 
                             add_server(
                                 user_id, servergroup_id, svr_name,
@@ -557,11 +557,12 @@ def create_app(app_name=None):
                     if hasattr(str, 'decode'):
                         description = description.decode('utf-8')
                         data_directory = data_directory.decode('utf-8')
-                    svr_comment = gettext(u"Auto-detected %s installation "
-                                          u"with the data directory at %s") % (
+                    svr_comment = gettext(u"Auto-detected {0} installation "
+                                          u"with the data directory at {1}".
+                                          format(
                                               description,
                                               data_directory
-                    )
+                                          ))
                     add_server(user_id, servergroup_id, svr_name,
                                svr_superuser, svr_port, svr_discovery_id,
                                svr_comment)
diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py
index d62d69138..59efae8b1 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -737,7 +737,8 @@ class ServerNode(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
 
         if 'hostaddr' in data and data['hostaddr'] and data['hostaddr'] != '':
@@ -835,7 +836,8 @@ class ServerNode(PGChildNodeView):
                         status=401,
                         success=0,
                         errormsg=gettext(
-                            u"Unable to connect to server:\n\n%s") % errmsg
+                            u"Unable to connect to server:\n\n{}".
+                            format(errmsg))
                     )
                 else:
                     if 'save_password' in data and data['save_password'] and \
@@ -1027,7 +1029,7 @@ class ServerNode(PGChildNodeView):
                     tunnel_password = server.tunnel_password
             else:
                 tunnel_password = data['tunnel_password'] \
-                    if 'tunnel_password'in data else ''
+                    if 'tunnel_password' in data else ''
                 save_tunnel_password = data['save_tunnel_password'] \
                     if tunnel_password and 'save_tunnel_password' in data \
                     else False
diff --git a/web/pgadmin/browser/server_groups/servers/databases/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
index 085ee35b6..db6e1273a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
@@ -567,7 +567,8 @@ class DatabaseView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
         # The below SQL will execute CREATE DDL only
         SQL = render_template(
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 503192cb2..5558d97f8 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
@@ -368,7 +368,8 @@ class CastView(PGChildNodeView):
                     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([self.template_path, 'create.sql']),
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 42da4cfc4..45f11e655 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 %s.") % err
+                    "Could not find the required parameter {}.".format(err))
             )
         try:
             sql = render_template(
@@ -636,7 +636,8 @@ class EventTriggerView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter %s.") % err
+                        "Could not find the required parameter {}.".
+                        format(err))
                 )
             sql = render_template(
                 "/".join([self.template_path, 'create.sql']),
diff --git a/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
index 9605b9b4a..f19b3452e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
@@ -262,7 +262,8 @@ class ExtensionView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
 
         status, res = self.conn.execute_dict(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
index e5bf06357..bb8d5482f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
@@ -393,7 +393,8 @@ class ForeignDataWrapperView(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/foreign_data_wrappers/foreign_servers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
index 66fcf424b..acf07617a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
@@ -388,7 +388,8 @@ class ForeignServerView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
         try:
             if 'fsrvacl' in data:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/__init__.py
index 47e55570a..1ee66eade 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/__init__.py
@@ -396,7 +396,8 @@ class UserMappingView(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/languages/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
index 77f22e6fa..d5ed9e297 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
@@ -453,7 +453,8 @@ class LanguageView(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/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
index 38cdec02c..67835b431 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
@@ -570,8 +570,8 @@ It may have been removed by another user.
                     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]))
                 )
         try:
             self.format_request_acls(data)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py
index 8cf703987..89f7ae547 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py
@@ -458,7 +458,8 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
         if self._check_definition(data):
             return make_json_response(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py
index 362f7c6ce..169d8da3f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py
@@ -422,7 +422,8 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
 
         # Either copy config or parser must be present in data
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/__init__.py
index b79b6ef5b..0f0b1f6bb 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/__init__.py
@@ -379,7 +379,8 @@ class FtsParserView(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/fts_templates/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py
index 4d61e8dcb..18bf3b8d2 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py
@@ -354,7 +354,8 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "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("/".join([self.template_path, 'schema.sql']),
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 519e30e97..b2a85090f 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
@@ -379,7 +379,8 @@ 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))
                 )
         data['schema'] = self.schema
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
index 13623b737..ca9e46e8a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
@@ -450,7 +450,8 @@ class SynonymView(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:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
index bea7b33f4..2c7ea56e5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
@@ -908,7 +908,8 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
 
         # Parse privilege data coming from client according to database format
@@ -1577,7 +1578,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
 
         return make_json_response(
             status=200,
-            info=gettext("Table rows counted: %s") % count,
+            info=gettext("Table rows counted: {}".format(count)),
             data={'total_rows': count}
         )
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/__init__.py
index 280958a98..c443749cc 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/__init__.py
@@ -392,8 +392,8 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
                     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]))
                 )
 
         # Parse privilege data coming from client according to database format
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/__init__.py
index 553d06c31..4b56d0b8c 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/__init__.py
@@ -511,8 +511,8 @@ class CompoundTriggerView(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/databases/schemas/tables/constraints/check_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py
index 2f1ba57bb..d65d3cc33 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py
@@ -476,7 +476,8 @@ class CheckConstraintView(PGChildNodeView):
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
 
         data['schema'] = self.schema
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py
index ab3ee6ab5..b2a5bbbe5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py
@@ -496,14 +496,16 @@ class ExclusionConstraintView(PGChildNodeView):
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find required parameter (%s).") % str(arg)
+                        "Could not find required parameter ({}).".
+                        format(str(arg)))
                 )
             elif isinstance(data[arg], list) and len(data[arg]) < 1:
                 return make_json_response(
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find required parameter (%s).") % str(arg)
+                        "Could not find required parameter ({}).".
+                        format(str(arg)))
                 )
 
         data['schema'] = self.schema
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py
index d057a3f2f..1abbc45b3 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py
@@ -514,14 +514,16 @@ class ForeignKeyConstraintView(PGChildNodeView):
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find required parameter (%s).") % str(arg)
+                        "Could not find required parameter ({}).".
+                        format(str(arg)))
                 )
             elif isinstance(data[arg], list) and len(data[arg]) < 1:
                 return make_json_response(
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find required parameter (%s).") % str(arg)
+                        "Could not find required parameter ({}).".
+                        format(str(arg)))
                 )
 
         data['schema'] = self.schema
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
index 05c5f84d1..bd2974c3d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
@@ -535,7 +535,7 @@ class IndexConstraintView(PGChildNodeView):
                         success=0,
                         errormsg=_(
                             "Could not find at least one required "
-                            "parameter (%s).") % str(param)
+                            "parameter ({}).".format(str(param)))
                     )
 
             elif arg not in data:
@@ -543,7 +543,8 @@ class IndexConstraintView(PGChildNodeView):
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
 
         data['schema'] = self.schema
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
index 02eb23b02..970933479 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
@@ -946,8 +946,8 @@ class TypeView(PGChildNodeView, DataTypeReader, 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]))
                 )
             # Additional checks goes here
             # If type is range then check if subtype is defined or not
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
index 955af8bc1..5d8d16249 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
@@ -493,7 +493,8 @@ class ViewNode(PGChildNodeView, VacuumSettings, 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, nameOrError = self.getSQL(gid, sid, did, data)
@@ -743,7 +744,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
                                  ).split('FROM')
                 if 'definition' in data and (
                         len(old_def) > 1 or len(new_def) > 1
-                ) and(
+                ) and (
                         old_def[0] != new_def[0] and
                         old_def[0] not in new_def[0]
                 ):
diff --git a/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py b/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py
index 28a8e5901..cb852f84c 100644
--- a/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py
@@ -284,7 +284,8 @@ SELECT EXISTS(
                     status=410,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
 
         status, res = self.conn.execute_void('BEGIN')
diff --git a/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py b/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py
index 24d3206ad..c68a09b9a 100644
--- a/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py
@@ -363,7 +363,8 @@ class ResourceGroupView(NodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
         try:
             # Below logic will create new resource group
diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
index 73e81e1b1..04954b80b 100644
--- a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
@@ -295,8 +295,8 @@ class TablespaceView(PGChildNodeView):
                     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]))
                 )
 
         # To format privileges coming from client


^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgAdmin 4 - next gettext usage fixes
  2020-04-08 15:41 pgAdmin 4 - next gettext usage fixes Libor M. <[email protected]>
  2020-04-10 09:27 ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  2020-04-15 06:08   ` Re: pgAdmin 4 - next gettext usage fixes Aditya Toshniwal <[email protected]>
@ 2020-04-15 06:17     ` Ashesh Vashi <[email protected]>
  1 sibling, 0 replies; 11+ messages in thread

From: Ashesh Vashi @ 2020-04-15 06:17 UTC (permalink / raw)
  To: Aditya Toshniwal <[email protected]>; +Cc: Akshay Joshi <[email protected]>; Libor M. <[email protected]>; pgadmin-hackers

On Wed, Apr 15, 2020 at 11:38 AM Aditya Toshniwal <
[email protected]> wrote:

> Hi Hackers/Libor,
>
> The changes like below are incorrect. Try "Count rows" from a table's
> context menu.
>
> -            info=gettext("Table rows counted: %s" % count),
>
> +            info=gettext("Table rows counted: %s") % count,
>
I would also avoid using this syntax, when multiple variables need to be
replaced.
e.g.
gettext("Test(#%s) -> %s") % test_no % test_result

Each language has different semantics, and the position of these variables
may change based on them.
We should use the 'format' function with proper variables in such cases.
e.g.
gettext("Test(#{test_no}) ->{test_result}").format(test_no, test_result).

I've not reviewed the patch, but - please look at this aspect while
reviewing the patch.

-- Thanks, Ashesh

>
> Attached is the patch to fix all such changes in pgAdmin, to use format()
> instead.
> Please review.
>
> On Fri, Apr 10, 2020 at 2:57 PM Akshay Joshi <
> [email protected]> wrote:
>
>> Hi Libor
>>
>> Thanks, patch applied. Please make sure to run the PEP8 checks before
>> sending the patch.
>> I have fixed and committed the code.
>>
>> On Wed, Apr 8, 2020 at 9:30 PM Libor M. <[email protected]> wrote:
>>
>>> Hello,
>>> I fixed next gettext usage:
>>>
>>> - fixed gettext usage with .format() only for original text with %s
>>> - fixed typos
>>> - fixed translation yes/no buttons in dialog
>>> - improved translating sentences without "connecting" words (eg. see
>>> web/pgadmin/dashboard/static/js/dashboard.js, word 'cancel' needs to
>>> be translated in Czech language as 'zrušit' but in another sentence as
>>> 'zrušení')
>>> - added gettext for text 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"
>


^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgAdmin 4 - next gettext usage fixes
  2020-04-08 15:41 pgAdmin 4 - next gettext usage fixes Libor M. <[email protected]>
  2020-04-10 09:27 ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  2020-04-15 06:08   ` Re: pgAdmin 4 - next gettext usage fixes Aditya Toshniwal <[email protected]>
@ 2020-04-15 08:03     ` Akshay Joshi <[email protected]>
  2020-04-15 09:25       ` Re: pgAdmin 4 - next gettext usage fixes Aditya Toshniwal <[email protected]>
  1 sibling, 1 reply; 11+ messages in thread

From: Akshay Joshi @ 2020-04-15 08:03 UTC (permalink / raw)
  To: Aditya Toshniwal <[email protected]>; +Cc: Libor M. <[email protected]>; pgadmin-hackers

Hi Aditya

I think the fix is incorrect. .format method should be applied after
gettext() like gettext().format(). Please check for other places too and
send the updated patch.

On Wed, Apr 15, 2020 at 11:38 AM Aditya Toshniwal <
[email protected]> wrote:

> Hi Hackers/Libor,
>
> The changes like below are incorrect. Try "Count rows" from a table's
> context menu.
>
> -            info=gettext("Table rows counted: %s" % count),
>
> +            info=gettext("Table rows counted: %s") % count,
>
> Attached is the patch to fix all such changes in pgAdmin, to use format()
> instead.
> Please review.
>
> On Fri, Apr 10, 2020 at 2:57 PM Akshay Joshi <
> [email protected]> wrote:
>
>> Hi Libor
>>
>> Thanks, patch applied. Please make sure to run the PEP8 checks before
>> sending the patch.
>> I have fixed and committed the code.
>>
>> On Wed, Apr 8, 2020 at 9:30 PM Libor M. <[email protected]> wrote:
>>
>>> Hello,
>>> I fixed next gettext usage:
>>>
>>> - fixed gettext usage with .format() only for original text with %s
>>> - fixed typos
>>> - fixed translation yes/no buttons in dialog
>>> - improved translating sentences without "connecting" words (eg. see
>>> web/pgadmin/dashboard/static/js/dashboard.js, word 'cancel' needs to
>>> be translated in Czech language as 'zrušit' but in another sentence as
>>> 'zrušení')
>>> - added gettext for text 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 & Regards*
*Akshay Joshi*

*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*


^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgAdmin 4 - next gettext usage fixes
  2020-04-08 15:41 pgAdmin 4 - next gettext usage fixes Libor M. <[email protected]>
  2020-04-10 09:27 ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  2020-04-15 06:08   ` Re: pgAdmin 4 - next gettext usage fixes Aditya Toshniwal <[email protected]>
  2020-04-15 08:03     ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
@ 2020-04-15 09:25       ` Aditya Toshniwal <[email protected]>
  2020-04-15 11:17         ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 11+ messages in thread

From: Aditya Toshniwal @ 2020-04-15 09:25 UTC (permalink / raw)
  To: Akshay Joshi <[email protected]>; +Cc: Libor M. <[email protected]>; pgadmin-hackers

Hi,

Please find the updated patch.

On Wed, Apr 15, 2020 at 1:33 PM Akshay Joshi <[email protected]>
wrote:

> Hi Aditya
>
> I think the fix is incorrect. .format method should be applied after
> gettext() like gettext().format(). Please check for other places too and
> send the updated patch.
>
> On Wed, Apr 15, 2020 at 11:38 AM Aditya Toshniwal <
> [email protected]> wrote:
>
>> Hi Hackers/Libor,
>>
>> The changes like below are incorrect. Try "Count rows" from a table's
>> context menu.
>>
>> -            info=gettext("Table rows counted: %s" % count),
>>
>> +            info=gettext("Table rows counted: %s") % count,
>>
>> Attached is the patch to fix all such changes in pgAdmin, to use format()
>> instead.
>> Please review.
>>
>> On Fri, Apr 10, 2020 at 2:57 PM Akshay Joshi <
>> [email protected]> wrote:
>>
>>> Hi Libor
>>>
>>> Thanks, patch applied. Please make sure to run the PEP8 checks before
>>> sending the patch.
>>> I have fixed and committed the code.
>>>
>>> On Wed, Apr 8, 2020 at 9:30 PM Libor M. <[email protected]> wrote:
>>>
>>>> Hello,
>>>> I fixed next gettext usage:
>>>>
>>>> - fixed gettext usage with .format() only for original text with %s
>>>> - fixed typos
>>>> - fixed translation yes/no buttons in dialog
>>>> - improved translating sentences without "connecting" words (eg. see
>>>> web/pgadmin/dashboard/static/js/dashboard.js, word 'cancel' needs to
>>>> be translated in Czech language as 'zrušit' but in another sentence as
>>>> 'zrušení')
>>>> - added gettext for text 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 & 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] gettext_format_fixes_v2.patch (30.1K, 3-gettext_format_fixes_v2.patch)
  download | inline diff:
diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py
index ef6461ee4..a1b19fb7e 100644
--- a/web/pgadmin/__init__.py
+++ b/web/pgadmin/__init__.py
@@ -503,7 +503,7 @@ def create_app(app_name=None):
                             svr_discovery_id = inst_id
                             svr_comment = gettext(
                                 "Auto-detected %s installation with the data "
-                                "directory at %s") % (
+                                "directory at {}").format(
                                     winreg.QueryValueEx(
                                         inst_key, 'Display Name'
                                     )[0],
@@ -557,11 +557,9 @@ def create_app(app_name=None):
                     if hasattr(str, 'decode'):
                         description = description.decode('utf-8')
                         data_directory = data_directory.decode('utf-8')
-                    svr_comment = gettext(u"Auto-detected %s installation "
-                                          u"with the data directory at %s") % (
-                                              description,
-                                              data_directory
-                    )
+                    svr_comment = gettext(u"Auto-detected {0} installation "
+                                          u"with the data directory at {1}"
+                                          ).format(description, data_directory)
                     add_server(user_id, servergroup_id, svr_name,
                                svr_superuser, svr_port, svr_discovery_id,
                                svr_comment)
diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py
index d62d69138..9266cdbcf 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -737,7 +737,8 @@ class ServerNode(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({})."
+                    ).format(arg)
                 )
 
         if 'hostaddr' in data and data['hostaddr'] and data['hostaddr'] != '':
@@ -835,7 +836,8 @@ class ServerNode(PGChildNodeView):
                         status=401,
                         success=0,
                         errormsg=gettext(
-                            u"Unable to connect to server:\n\n%s") % errmsg
+                            u"Unable to connect to server:\n\n{}"
+                        ).format(errmsg)
                     )
                 else:
                     if 'save_password' in data and data['save_password'] and \
@@ -1027,7 +1029,7 @@ class ServerNode(PGChildNodeView):
                     tunnel_password = server.tunnel_password
             else:
                 tunnel_password = data['tunnel_password'] \
-                    if 'tunnel_password'in data else ''
+                    if 'tunnel_password' in data else ''
                 save_tunnel_password = data['save_tunnel_password'] \
                     if tunnel_password and 'save_tunnel_password' in data \
                     else False
diff --git a/web/pgadmin/browser/server_groups/servers/databases/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
index 085ee35b6..0d1581f5f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
@@ -567,7 +567,8 @@ class DatabaseView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({})."
+                    ).format(arg)
                 )
         # The below SQL will execute CREATE DDL only
         SQL = render_template(
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 503192cb2..6f2ece0f9 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
@@ -368,7 +368,8 @@ class CastView(PGChildNodeView):
                     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([self.template_path, 'create.sql']),
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 42da4cfc4..aa35fb5d4 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 %s.") % err
+                    "Could not find the required parameter {}.".format(err))
             )
         try:
             sql = render_template(
@@ -636,7 +636,8 @@ class EventTriggerView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter %s.") % err
+                        "Could not find the required parameter {}."
+                    ).format(arg)
                 )
             sql = render_template(
                 "/".join([self.template_path, 'create.sql']),
diff --git a/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
index 9605b9b4a..21b314083 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
@@ -262,7 +262,8 @@ class ExtensionView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({})."
+                    ).format(arg)
                 )
 
         status, res = self.conn.execute_dict(
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 da1b2c5fc..5d0107fce 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
@@ -65,7 +65,7 @@ class Properties:
     @staticmethod
     def translate_execute_on_text(execute_on):
         if execute_on['type'] == 'host':
-            return gettext('host %s') % execute_on['value']
+            return gettext('host {}').format(execute_on['value'])
         elif execute_on['type'] == 'per_host':
             return gettext('per host')
         elif execute_on['type'] == 'master_only':
@@ -73,6 +73,6 @@ class Properties:
         elif execute_on['type'] == 'all_segments':
             return gettext('all segments')
         elif execute_on['type'] == 'segment':
-            return gettext('%s segment') % execute_on['value']
+            return gettext('{} segment').format(execute_on['value'])
         elif execute_on['type'] == 'segments':
-            return gettext('%d segments') % execute_on['value']
+            return gettext('{} segments').format(execute_on['value'])
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
index e5bf06357..371e21313 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
@@ -393,7 +393,8 @@ class ForeignDataWrapperView(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/foreign_data_wrappers/foreign_servers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
index 66fcf424b..6286ed94e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
@@ -388,7 +388,8 @@ class ForeignServerView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({})."
+                    ).format(arg)
                 )
         try:
             if 'fsrvacl' in data:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/__init__.py
index 47e55570a..61743eb65 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/__init__.py
@@ -396,7 +396,8 @@ class UserMappingView(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/languages/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
index 77f22e6fa..ecd6e3cc1 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
@@ -453,7 +453,8 @@ class LanguageView(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/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
index 38cdec02c..a13402fff 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
@@ -570,8 +570,8 @@ It may have been removed by another user.
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") %
-                    required_args[arg]
+                        "Could not find the required parameter ({})."
+                    ).format(arg)
                 )
         try:
             self.format_request_acls(data)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py
index 8cf703987..8c0537bf0 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py
@@ -458,7 +458,8 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({})."
+                    ).format(arg)
                 )
         if self._check_definition(data):
             return make_json_response(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py
index 362f7c6ce..d17f511ca 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py
@@ -422,7 +422,8 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({})."
+                    ).format(arg)
                 )
 
         # Either copy config or parser must be present in data
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/__init__.py
index b79b6ef5b..ce5d82aed 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/__init__.py
@@ -379,7 +379,8 @@ class FtsParserView(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/fts_templates/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py
index 4d61e8dcb..1e760b637 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py
@@ -354,7 +354,8 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "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("/".join([self.template_path, 'schema.sql']),
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 519e30e97..56d33c06c 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
@@ -379,7 +379,8 @@ 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)
                 )
         data['schema'] = self.schema
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
index 13623b737..8c53c2b51 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
@@ -450,7 +450,8 @@ class SynonymView(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:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
index bea7b33f4..03073e277 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
@@ -908,7 +908,8 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({})."
+                    ).format(arg)
                 )
 
         # Parse privilege data coming from client according to database format
@@ -1577,7 +1578,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
 
         return make_json_response(
             status=200,
-            info=gettext("Table rows counted: %s") % count,
+            info=gettext("Table rows counted: {}").format(count),
             data={'total_rows': count}
         )
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/__init__.py
index 280958a98..ef0ddd3ae 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/__init__.py
@@ -392,8 +392,8 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
                     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])
                 )
 
         # Parse privilege data coming from client according to database format
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/__init__.py
index 553d06c31..c80c752ca 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/__init__.py
@@ -511,8 +511,8 @@ class CompoundTriggerView(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/databases/schemas/tables/constraints/check_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py
index 2f1ba57bb..9f263fb47 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py
@@ -476,7 +476,8 @@ class CheckConstraintView(PGChildNodeView):
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({})."
+                    ).format(arg)
                 )
 
         data['schema'] = self.schema
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py
index ab3ee6ab5..c5e6b9959 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py
@@ -496,14 +496,16 @@ class ExclusionConstraintView(PGChildNodeView):
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find required parameter (%s).") % str(arg)
+                        "Could not find required parameter ({})."
+                    ).format(arg)
                 )
             elif isinstance(data[arg], list) and len(data[arg]) < 1:
                 return make_json_response(
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find required parameter (%s).") % str(arg)
+                        "Could not find required parameter ({})."
+                    ).format(arg)
                 )
 
         data['schema'] = self.schema
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py
index d057a3f2f..81eeb067d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py
@@ -514,14 +514,16 @@ class ForeignKeyConstraintView(PGChildNodeView):
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find required parameter (%s).") % str(arg)
+                        "Could not find required parameter ({})."
+                    ).format(arg)
                 )
             elif isinstance(data[arg], list) and len(data[arg]) < 1:
                 return make_json_response(
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find required parameter (%s).") % str(arg)
+                        "Could not find required parameter ({})."
+                    ).format(arg)
                 )
 
         data['schema'] = self.schema
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
index 05c5f84d1..444ed0b2b 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
@@ -535,7 +535,7 @@ class IndexConstraintView(PGChildNodeView):
                         success=0,
                         errormsg=_(
                             "Could not find at least one required "
-                            "parameter (%s).") % str(param)
+                            "parameter ({}).".format(str(param)))
                     )
 
             elif arg not in data:
@@ -543,7 +543,8 @@ class IndexConstraintView(PGChildNodeView):
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({})."
+                    ).format(arg)
                 )
 
         data['schema'] = self.schema
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py
index c68804520..801f8297a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py
@@ -580,8 +580,8 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
                                   "create index.")
 
             if arg not in data:
-                err_msg = gettext("Could not find the required parameter (%s)"
-                                  ".") % required_args[arg]
+                err_msg = gettext("Could not find the required parameter ({})"
+                                  ".").format(required_args[arg])
                 # Check if we have at least one column
             if err_msg is not None:
                 return make_json_response(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
index 02eb23b02..4a8e91c55 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
@@ -946,8 +946,8 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") %
-                    required_args[arg]
+                        "Could not find the required parameter ({})."
+                    ).format(arg)
                 )
             # Additional checks goes here
             # If type is range then check if subtype is defined or not
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
index 955af8bc1..a8da96e12 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
@@ -493,7 +493,8 @@ class ViewNode(PGChildNodeView, VacuumSettings, 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, nameOrError = self.getSQL(gid, sid, did, data)
@@ -743,7 +744,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
                                  ).split('FROM')
                 if 'definition' in data and (
                         len(old_def) > 1 or len(new_def) > 1
-                ) and(
+                ) and (
                         old_def[0] != new_def[0] and
                         old_def[0] not in new_def[0]
                 ):
diff --git a/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py b/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py
index 28a8e5901..797a6cb81 100644
--- a/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py
@@ -284,7 +284,8 @@ SELECT EXISTS(
                     status=410,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({})."
+                    ).format(arg)
                 )
 
         status, res = self.conn.execute_void('BEGIN')
diff --git a/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py b/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py
index 24d3206ad..913dad50c 100644
--- a/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py
@@ -363,7 +363,8 @@ class ResourceGroupView(NodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({})."
+                    ).format(arg)
                 )
         try:
             # Below logic will create new resource group
diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
index 73e81e1b1..8e2f7f8a9 100644
--- a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
@@ -295,8 +295,8 @@ class TablespaceView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") %
-                    required_args[arg]
+                        "Could not find the required parameter ({})."
+                    ).format(arg)
                 )
 
         # To format privileges coming from client


^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgAdmin 4 - next gettext usage fixes
  2020-04-08 15:41 pgAdmin 4 - next gettext usage fixes Libor M. <[email protected]>
  2020-04-10 09:27 ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  2020-04-15 06:08   ` Re: pgAdmin 4 - next gettext usage fixes Aditya Toshniwal <[email protected]>
  2020-04-15 08:03     ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  2020-04-15 09:25       ` Re: pgAdmin 4 - next gettext usage fixes Aditya Toshniwal <[email protected]>
@ 2020-04-15 11:17         ` Akshay Joshi <[email protected]>
  2020-04-15 11:46           ` Re: pgAdmin 4 - next gettext usage fixes Libor M. <[email protected]>
  0 siblings, 1 reply; 11+ messages in thread

From: Akshay Joshi @ 2020-04-15 11:17 UTC (permalink / raw)
  To: Aditya Toshniwal <[email protected]>; +Cc: Libor M. <[email protected]>; pgadmin-hackers

Thanks, patch applied.

On Wed, Apr 15, 2020 at 2:55 PM Aditya Toshniwal <
[email protected]> wrote:

> Hi,
>
> Please find the updated patch.
>
> On Wed, Apr 15, 2020 at 1:33 PM Akshay Joshi <
> [email protected]> wrote:
>
>> Hi Aditya
>>
>> I think the fix is incorrect. .format method should be applied after
>> gettext() like gettext().format(). Please check for other places too and
>> send the updated patch.
>>
>> On Wed, Apr 15, 2020 at 11:38 AM Aditya Toshniwal <
>> [email protected]> wrote:
>>
>>> Hi Hackers/Libor,
>>>
>>> The changes like below are incorrect. Try "Count rows" from a table's
>>> context menu.
>>>
>>> -            info=gettext("Table rows counted: %s" % count),
>>>
>>> +            info=gettext("Table rows counted: %s") % count,
>>>
>>> Attached is the patch to fix all such changes in pgAdmin, to use
>>> format() instead.
>>> Please review.
>>>
>>> On Fri, Apr 10, 2020 at 2:57 PM Akshay Joshi <
>>> [email protected]> wrote:
>>>
>>>> Hi Libor
>>>>
>>>> Thanks, patch applied. Please make sure to run the PEP8 checks before
>>>> sending the patch.
>>>> I have fixed and committed the code.
>>>>
>>>> On Wed, Apr 8, 2020 at 9:30 PM Libor M. <[email protected]> wrote:
>>>>
>>>>> Hello,
>>>>> I fixed next gettext usage:
>>>>>
>>>>> - fixed gettext usage with .format() only for original text with %s
>>>>> - fixed typos
>>>>> - fixed translation yes/no buttons in dialog
>>>>> - improved translating sentences without "connecting" words (eg. see
>>>>> web/pgadmin/dashboard/static/js/dashboard.js, word 'cancel' needs to
>>>>> be translated in Czech language as 'zrušit' but in another sentence as
>>>>> 'zrušení')
>>>>> - added gettext for text 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 & 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 & Regards*
*Akshay Joshi*

*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*


^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgAdmin 4 - next gettext usage fixes
  2020-04-08 15:41 pgAdmin 4 - next gettext usage fixes Libor M. <[email protected]>
  2020-04-10 09:27 ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  2020-04-15 06:08   ` Re: pgAdmin 4 - next gettext usage fixes Aditya Toshniwal <[email protected]>
  2020-04-15 08:03     ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  2020-04-15 09:25       ` Re: pgAdmin 4 - next gettext usage fixes Aditya Toshniwal <[email protected]>
  2020-04-15 11:17         ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
@ 2020-04-15 11:46           ` Libor M. <[email protected]>
  2020-04-16 07:50             ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 11+ messages in thread

From: Libor M. @ 2020-04-15 11:46 UTC (permalink / raw)
  To: Akshay Joshi <[email protected]>; +Cc: Aditya Toshniwal <[email protected]>; pgadmin-hackers

Hi,
next minor gettext and format fixes in patch.

Best regards,

Libor M.

E-mail: [email protected]
GitHub: https://github.com/liborm85

st 15. 4. 2020 v 13:17 odesílatel Akshay Joshi
<[email protected]> napsal:
>
> Thanks, patch applied.
>
> On Wed, Apr 15, 2020 at 2:55 PM Aditya Toshniwal <[email protected]> wrote:
>>
>> Hi,
>>
>> Please find the updated patch.
>>
>> On Wed, Apr 15, 2020 at 1:33 PM Akshay Joshi <[email protected]> wrote:
>>>
>>> Hi Aditya
>>>
>>> I think the fix is incorrect. .format method should be applied after gettext() like gettext().format(). Please check for other places too and send the updated patch.
>>>
>>> On Wed, Apr 15, 2020 at 11:38 AM Aditya Toshniwal <[email protected]> wrote:
>>>>
>>>> Hi Hackers/Libor,
>>>>
>>>> The changes like below are incorrect. Try "Count rows" from a table's context menu.
>>>>
>>>> -            info=gettext("Table rows counted: %s" % count),
>>>>
>>>> +            info=gettext("Table rows counted: %s") % count,
>>>>
>>>>
>>>> Attached is the patch to fix all such changes in pgAdmin, to use format() instead.
>>>> Please review.
>>>>
>>>> On Fri, Apr 10, 2020 at 2:57 PM Akshay Joshi <[email protected]> wrote:
>>>>>
>>>>> Hi Libor
>>>>>
>>>>> Thanks, patch applied. Please make sure to run the PEP8 checks before sending the patch.
>>>>> I have fixed and committed the code.
>>>>>
>>>>> On Wed, Apr 8, 2020 at 9:30 PM Libor M. <[email protected]> wrote:
>>>>>>
>>>>>> Hello,
>>>>>> I fixed next gettext usage:
>>>>>>
>>>>>> - fixed gettext usage with .format() only for original text with %s
>>>>>> - fixed typos
>>>>>> - fixed translation yes/no buttons in dialog
>>>>>> - improved translating sentences without "connecting" words (eg. see
>>>>>> web/pgadmin/dashboard/static/js/dashboard.js, word 'cancel' needs to
>>>>>> be translated in Czech language as 'zrušit' but in another sentence as
>>>>>> 'zrušení')
>>>>>> - added gettext for text 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 & 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 & Regards
> Akshay Joshi
> Sr. Software Architect
> EnterpriseDB Software India Private Limited
> Mobile: +91 976-788-8246


Attachments:

  [application/octet-stream] pgadmin4_gettext.diff (3.2K, 2-pgadmin4_gettext.diff)
  download | inline diff:
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 aa35fb5d4..83bec30ca 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(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
index 444ed0b2b..8bd4790fb 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
@@ -737,7 +737,7 @@ class IndexConstraintView(PGChildNodeView):
 
             return make_json_response(
                 success=1,
-                info=_("{0} dropped.".format(self.node_label)),
+                info=_("{0} dropped.").format(self.node_label),
                 data={
                     'id': cid,
                     'sid': sid,
diff --git a/web/pgadmin/browser/server_groups/servers/static/js/server.js b/web/pgadmin/browser/server_groups/servers/static/js/server.js
index 409488587..57f89919a 100644
--- a/web/pgadmin/browser/server_groups/servers/static/js/server.js
+++ b/web/pgadmin/browser/server_groups/servers/static/js/server.js
@@ -425,7 +425,7 @@ define('pgadmin.node.server', [
             Alertify.dialog('changeServerPassword' ,function factory() {
               return {
                 main: function(params) {
-                  var title = gettext('Change Password ');
+                  var title = gettext('Change Password');
                   this.set('title', title);
                   this.user_name = params.user.name;
                 },
diff --git a/web/pgadmin/misc/file_manager/__init__.py b/web/pgadmin/misc/file_manager/__init__.py
index e34a69a68..5311034f4 100644
--- a/web/pgadmin/misc/file_manager/__init__.py
+++ b/web/pgadmin/misc/file_manager/__init__.py
@@ -910,7 +910,7 @@ class Filemanager(object):
             Filemanager.check_access_permission(dir, path)
         except Exception as e:
             res = {
-                'Error': gettext(u"Error: {0}".format(e)),
+                'Error': gettext(u"Error: {0}").format(e),
                 'Code': 0
             }
             return res
@@ -1131,7 +1131,7 @@ class Filemanager(object):
                 path, name))
         except Exception as e:
             res = {
-                'Error': gettext(u"Error: {0}".format(e)),
+                'Error': gettext(u"Error: {0}").format(e),
                 'Code': 0
             }
             return res


^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgAdmin 4 - next gettext usage fixes
  2020-04-08 15:41 pgAdmin 4 - next gettext usage fixes Libor M. <[email protected]>
  2020-04-10 09:27 ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  2020-04-15 06:08   ` Re: pgAdmin 4 - next gettext usage fixes Aditya Toshniwal <[email protected]>
  2020-04-15 08:03     ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  2020-04-15 09:25       ` Re: pgAdmin 4 - next gettext usage fixes Aditya Toshniwal <[email protected]>
  2020-04-15 11:17         ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  2020-04-15 11:46           ` Re: pgAdmin 4 - next gettext usage fixes Libor M. <[email protected]>
@ 2020-04-16 07:50             ` Akshay Joshi <[email protected]>
  2020-04-19 12:20               ` Re: pgAdmin 4 - next gettext usage fixes Libor M. <[email protected]>
  0 siblings, 1 reply; 11+ messages in thread

From: Akshay Joshi @ 2020-04-16 07:50 UTC (permalink / raw)
  To: Libor M. <[email protected]>; +Cc: Aditya Toshniwal <[email protected]>; pgadmin-hackers

Thanks, patch applied.

On Wed, Apr 15, 2020 at 5:17 PM Libor M. <[email protected]> wrote:

> Hi,
> next minor gettext and format fixes in patch.
>
> Best regards,
>
> Libor M.
>
> E-mail: [email protected]
> GitHub: https://github.com/liborm85
>
> st 15. 4. 2020 v 13:17 odesílatel Akshay Joshi
> <[email protected]> napsal:
> >
> > Thanks, patch applied.
> >
> > On Wed, Apr 15, 2020 at 2:55 PM Aditya Toshniwal <
> [email protected]> wrote:
> >>
> >> Hi,
> >>
> >> Please find the updated patch.
> >>
> >> On Wed, Apr 15, 2020 at 1:33 PM Akshay Joshi <
> [email protected]> wrote:
> >>>
> >>> Hi Aditya
> >>>
> >>> I think the fix is incorrect. .format method should be applied after
> gettext() like gettext().format(). Please check for other places too and
> send the updated patch.
> >>>
> >>> On Wed, Apr 15, 2020 at 11:38 AM Aditya Toshniwal <
> [email protected]> wrote:
> >>>>
> >>>> Hi Hackers/Libor,
> >>>>
> >>>> The changes like below are incorrect. Try "Count rows" from a table's
> context menu.
> >>>>
> >>>> -            info=gettext("Table rows counted: %s" % count),
> >>>>
> >>>> +            info=gettext("Table rows counted: %s") % count,
> >>>>
> >>>>
> >>>> Attached is the patch to fix all such changes in pgAdmin, to use
> format() instead.
> >>>> Please review.
> >>>>
> >>>> On Fri, Apr 10, 2020 at 2:57 PM Akshay Joshi <
> [email protected]> wrote:
> >>>>>
> >>>>> Hi Libor
> >>>>>
> >>>>> Thanks, patch applied. Please make sure to run the PEP8 checks
> before sending the patch.
> >>>>> I have fixed and committed the code.
> >>>>>
> >>>>> On Wed, Apr 8, 2020 at 9:30 PM Libor M. <[email protected]> wrote:
> >>>>>>
> >>>>>> Hello,
> >>>>>> I fixed next gettext usage:
> >>>>>>
> >>>>>> - fixed gettext usage with .format() only for original text with %s
> >>>>>> - fixed typos
> >>>>>> - fixed translation yes/no buttons in dialog
> >>>>>> - improved translating sentences without "connecting" words (eg. see
> >>>>>> web/pgadmin/dashboard/static/js/dashboard.js, word 'cancel' needs to
> >>>>>> be translated in Czech language as 'zrušit' but in another sentence
> as
> >>>>>> 'zrušení')
> >>>>>> - added gettext for text 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 & 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 & Regards
> > Akshay Joshi
> > Sr. Software Architect
> > EnterpriseDB Software India Private Limited
> > Mobile: +91 976-788-8246
>


-- 
*Thanks & Regards*
*Akshay Joshi*

*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*


^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgAdmin 4 - next gettext usage fixes
  2020-04-08 15:41 pgAdmin 4 - next gettext usage fixes Libor M. <[email protected]>
  2020-04-10 09:27 ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  2020-04-15 06:08   ` Re: pgAdmin 4 - next gettext usage fixes Aditya Toshniwal <[email protected]>
  2020-04-15 08:03     ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  2020-04-15 09:25       ` Re: pgAdmin 4 - next gettext usage fixes Aditya Toshniwal <[email protected]>
  2020-04-15 11:17         ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  2020-04-15 11:46           ` Re: pgAdmin 4 - next gettext usage fixes Libor M. <[email protected]>
  2020-04-16 07:50             ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
@ 2020-04-19 12:20               ` Libor M. <[email protected]>
  2020-04-20 13:47                 ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 11+ messages in thread

From: Libor M. @ 2020-04-19 12:20 UTC (permalink / raw)
  To: Akshay Joshi <[email protected]>; +Cc: Aditya Toshniwal <[email protected]>; pgadmin-hackers

Hi,
I sending patch for slightly modified the use of gettext:
- fixed `%` vs. `.format()`
- unified texts and usage `%s` vs. `{}`/`{0}`
- improved text sentences for translate
- added gettext for next texts

Best regards,

Libor M.

E-mail: [email protected]
GitHub: https://github.com/liborm85

čt 16. 4. 2020 v 9:51 odesílatel Akshay Joshi
<[email protected]> napsal:
>
> Thanks, patch applied.
>
> On Wed, Apr 15, 2020 at 5:17 PM Libor M. <[email protected]> wrote:
>>
>> Hi,
>> next minor gettext and format fixes in patch.
>>
>> Best regards,
>>
>> Libor M.
>>
>> E-mail: [email protected]
>> GitHub: https://github.com/liborm85
>>
>> st 15. 4. 2020 v 13:17 odesílatel Akshay Joshi
>> <[email protected]> napsal:
>> >
>> > Thanks, patch applied.
>> >
>> > On Wed, Apr 15, 2020 at 2:55 PM Aditya Toshniwal <[email protected]> wrote:
>> >>
>> >> Hi,
>> >>
>> >> Please find the updated patch.
>> >>
>> >> On Wed, Apr 15, 2020 at 1:33 PM Akshay Joshi <[email protected]> wrote:
>> >>>
>> >>> Hi Aditya
>> >>>
>> >>> I think the fix is incorrect. .format method should be applied after gettext() like gettext().format(). Please check for other places too and send the updated patch.
>> >>>
>> >>> On Wed, Apr 15, 2020 at 11:38 AM Aditya Toshniwal <[email protected]> wrote:
>> >>>>
>> >>>> Hi Hackers/Libor,
>> >>>>
>> >>>> The changes like below are incorrect. Try "Count rows" from a table's context menu.
>> >>>>
>> >>>> -            info=gettext("Table rows counted: %s" % count),
>> >>>>
>> >>>> +            info=gettext("Table rows counted: %s") % count,
>> >>>>
>> >>>>
>> >>>> Attached is the patch to fix all such changes in pgAdmin, to use format() instead.
>> >>>> Please review.
>> >>>>
>> >>>> On Fri, Apr 10, 2020 at 2:57 PM Akshay Joshi <[email protected]> wrote:
>> >>>>>
>> >>>>> Hi Libor
>> >>>>>
>> >>>>> Thanks, patch applied. Please make sure to run the PEP8 checks before sending the patch.
>> >>>>> I have fixed and committed the code.
>> >>>>>
>> >>>>> On Wed, Apr 8, 2020 at 9:30 PM Libor M. <[email protected]> wrote:
>> >>>>>>
>> >>>>>> Hello,
>> >>>>>> I fixed next gettext usage:
>> >>>>>>
>> >>>>>> - fixed gettext usage with .format() only for original text with %s
>> >>>>>> - fixed typos
>> >>>>>> - fixed translation yes/no buttons in dialog
>> >>>>>> - improved translating sentences without "connecting" words (eg. see
>> >>>>>> web/pgadmin/dashboard/static/js/dashboard.js, word 'cancel' needs to
>> >>>>>> be translated in Czech language as 'zrušit' but in another sentence as
>> >>>>>> 'zrušení')
>> >>>>>> - added gettext for text 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 & 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 & Regards
>> > Akshay Joshi
>> > Sr. Software Architect
>> > EnterpriseDB Software India Private Limited
>> > Mobile: +91 976-788-8246
>
>
>
> --
> Thanks & Regards
> Akshay Joshi
> Sr. Software Architect
> EnterpriseDB Software India Private Limited
> Mobile: +91 976-788-8246


Attachments:

  [application/octet-stream] pgadmin4_gettext_fix.diff (24.3K, 2-pgadmin4_gettext_fix.diff)
  download | inline diff:
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', [
           '   </div>',
           '   <div class="col-6" header="token"></div>',
           '   <div class="col-2">',
-          '     <button class="btn btn-sm-sq btn-secondary add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%> ><span class="sr-only">Add Token</span></button>',
+          '     <button class="btn btn-sm-sq btn-secondary add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%> ><span class="sr-only">' + gettext('Add Token') + '</span></button>',
           '   </div>',
           '  </div>',
           ' </div>',
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 \\.<br>For more information, please see the documentation on %s',
-            '<a href="https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING" target="_blank">libpq connection strings</a>'
+          }, 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 \\.<br>For more information, please see the documentation on <a href="https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING" target="_blank">libpq connection strings</a>.'
           ), 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 @@
         <div><span class="font-weight-bold" >{{ _('Please enter the password for the user \'{0}\' to connect the server - "{1}"').format(username,
             server_label) }}</span></div>
         <div class="input-group row py-2">
-            <label for="password" class="col-sm-2 col-form-label" aria-hidden="true">Password</label>
+            <label for="password" class="col-sm-2 col-form-label" aria-hidden="true">{{ _('Password') }}</label>
             <div class="col-sm-10">
               <input id="password" class="form-control" name="password" type="password">
             </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 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 @@
                     <input class="custom-control-input" id="save_tunnel_password" name="save_tunnel_password" type="checkbox"
                            {% if not config.ALLOW_SAVE_TUNNEL_PASSWORD  %}disabled{% endif %}
                     >
-                    <label class="custom-control-label" for="save_tunnel_password" class="ml-1">Save Password</label>
+                    <label class="custom-control-label" for="save_tunnel_password" class="ml-1">{{ _('Save Password') }}</label>
                 </div>
             </div>
         </div>
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: '<label for="sql-textarea" class="sr-only">SQL Code</label><div class="sql_textarea"><textarea id="sql-textarea" name="sql-textarea" title="'+gettext('SQL Code')+'"></textarea></div>',
+        content: '<label for="sql-textarea" class="sr-only">' + gettext('SQL Code') + '</label><div class="sql_textarea"><textarea id="sql-textarea" name="sql-textarea" title="' + gettext('SQL Code') + '"></textarea></div>',
       }),
       // 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([
             '<div id="multiple-uploads" class="dropzone flex-grow-1 d-flex p-1">'+
             '<div class="dz-default dz-message d-none"></div>'+
             '</div>' +
-            '<div class="prompt-info">Drop files here to upload. ' + lg.file_size_limit +
+            '<div class="prompt-info">' + gettext('Drop files here to upload.') + ' ' + lg.file_size_limit +
             config.upload.fileSizeLimit + ' ' + lg.mb + '.</div>',
             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(
-        '<strong>Join Filter</strong>: ' + _.escape(_planData['Join Filter'])
+        '<strong>' + gettext('Join Filter') + '</strong>: ' + _.escape(_planData['Join Filter'])
       );
     }
 
     if ('Filter' in _planData) {
-      node_extra_info.push('<strong>Filter</strong>: ' + _.escape(_planData['Filter']));
+      node_extra_info.push('<strong>' + gettext('Filter') + '</strong>: ' + _.escape(_planData['Filter']));
     }
 
     if ('Index Cond' in _planData) {
-      node_extra_info.push('<strong>Index Cond</strong>: ' + _.escape(_planData['Index Cond']));
+      node_extra_info.push('<strong>' + gettext('Index Cond') + '</strong>: ' + _.escape(_planData['Index Cond']));
     }
 
     if ('Hash Cond' in _planData) {
-      node_extra_info.push('<strong>Hash Cond</strong>: ' + _.escape(_planData['Hash Cond']));
+      node_extra_info.push('<strong>' + gettext('Hash Cond') + '</strong>: ' + _.escape(_planData['Hash Cond']));
     }
 
     if ('Rows Removed by Filter' in _planData) {
       node_extra_info.push(
-        '<strong>Rows Removed by Filter</strong>: ' +
+        '<strong>' + gettext('Rows Removed by Filter') + '</strong>: ' +
           _.escape(_planData['Rows Removed by Filter'])
       );
     }
 
     if ('Peak Memory Usage' in _planData) {
       var buffer = [
-        '<strong>Buckets</strong>:', _.escape(_planData['Hash Buckets']),
-        '<strong>Batches</strong>:', _.escape(_planData['Hash Batches']),
-        '<strong>Memory Usage</strong>:', _.escape(_planData['Peak Memory Usage']), 'kB',
+        '<strong>' + gettext('Buckets') + '</strong>:', _.escape(_planData['Hash Buckets']),
+        '<strong>' + gettext('Batches') + '</strong>:', _.escape(_planData['Hash Batches']),
+        '<strong>' + gettext('Memory Usage') + '</strong>:', _.escape(_planData['Peak Memory Usage']), 'kB',
       ].join(' ');
       node_extra_info.push(buffer);
     }
 
     if ('Recheck Cond' in _planData) {
-      node_extra_info.push('<strong>Recheck Cond</strong>: ' + _planData['Recheck Cond']);
+      node_extra_info.push('<strong>' + gettext('Recheck Cond') + '</strong>: ' + _planData['Recheck Cond']);
     }
 
     if ('Exact Heap Blocks' in _planData) {
-      node_extra_info.push('<strong>Heap Blocks</strong>: exact=' + _planData['Exact Heap Blocks']);
+      node_extra_info.push('<strong>' + gettext('Heap Blocks') + '</strong>: 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('<label><a><span style=\'font-weight:normal;\'>Array Values</a></span></label> <button class=\'btn-sm btn-secondary add\'>Add</button>');
+      this.$el.html('<label><a><span style=\'font-weight:normal;\'>' + gettext('Array Values') + '</a></span></label> <button class=\'btn-sm btn-secondary add\'>' + gettext('Add') + '</button>');
       this.delegateEvents();
       return this;
     },
@@ -2055,7 +2055,7 @@ define([
         $(`<div class="custom-control custom-checkbox custom-checkbox-no-label ${align_center?'text-center':''}">
           <input tabindex="0" type="checkbox" class="custom-control-input" id="${id}" ${!editable?'disabled':''} ${checked?'checked':''}/>
           <label class="custom-control-label" for="${id}">
-            <span class="sr-only">Select<span>
+            <span class="sr-only">` + gettext('Select') + `<span>
           </label>
         </div>`)
       );
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(
         `<div class='history-error-text'>
-            <span>Error Message</span> ${_.escape(this.parseErrorMessage(this.entry.message))}
+            <span>` + gettext('Error Message') + `</span> ${_.escape(this.parseErrorMessage(this.entry.message))}
         </div>`
       );
     } 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 @@
         '<div class="custom-control custom-checkbox custom-checkbox-no-label">',
         '  <input tabindex="0" type="checkbox" class="custom-control-input" id="'+ id +'" />',
         '  <label class="custom-control-label" for="'+ id +'">',
-        '    <span class="sr-only">Select All<span>',
+        '    <span class="sr-only">' + gettext('Select All') + '<span>',
         '  </label>',
         '</div>'
       ].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') + ' <a class="pref-dialog-link">' + gettext('preferences dialog') + '</a>.',
+          gettext('%s objects are disabled in the browser. You can enable them in the <a class="pref-dialog-link">preferences dialog</a>.', 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()) {


^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgAdmin 4 - next gettext usage fixes
  2020-04-08 15:41 pgAdmin 4 - next gettext usage fixes Libor M. <[email protected]>
  2020-04-10 09:27 ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  2020-04-15 06:08   ` Re: pgAdmin 4 - next gettext usage fixes Aditya Toshniwal <[email protected]>
  2020-04-15 08:03     ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  2020-04-15 09:25       ` Re: pgAdmin 4 - next gettext usage fixes Aditya Toshniwal <[email protected]>
  2020-04-15 11:17         ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  2020-04-15 11:46           ` Re: pgAdmin 4 - next gettext usage fixes Libor M. <[email protected]>
  2020-04-16 07:50             ` Re: pgAdmin 4 - next gettext usage fixes Akshay Joshi <[email protected]>
  2020-04-19 12:20               ` Re: pgAdmin 4 - next gettext usage fixes Libor M. <[email protected]>
@ 2020-04-20 13:47                 ` Akshay Joshi <[email protected]>
  0 siblings, 0 replies; 11+ messages in thread

From: Akshay Joshi @ 2020-04-20 13:47 UTC (permalink / raw)
  To: Libor M. <[email protected]>; +Cc: Aditya Toshniwal <[email protected]>; pgadmin-hackers

Thanks, patch applied.

On Sun, Apr 19, 2020 at 5:50 PM Libor M. <[email protected]> wrote:

> Hi,
> I sending patch for slightly modified the use of gettext:
> - fixed `%` vs. `.format()`
> - unified texts and usage `%s` vs. `{}`/`{0}`
> - improved text sentences for translate
> - added gettext for next texts
>
> Best regards,
>
> Libor M.
>
> E-mail: [email protected]
> GitHub: https://github.com/liborm85
>
> čt 16. 4. 2020 v 9:51 odesílatel Akshay Joshi
> <[email protected]> napsal:
> >
> > Thanks, patch applied.
> >
> > On Wed, Apr 15, 2020 at 5:17 PM Libor M. <[email protected]> wrote:
> >>
> >> Hi,
> >> next minor gettext and format fixes in patch.
> >>
> >> Best regards,
> >>
> >> Libor M.
> >>
> >> E-mail: [email protected]
> >> GitHub: https://github.com/liborm85
> >>
> >> st 15. 4. 2020 v 13:17 odesílatel Akshay Joshi
> >> <[email protected]> napsal:
> >> >
> >> > Thanks, patch applied.
> >> >
> >> > On Wed, Apr 15, 2020 at 2:55 PM Aditya Toshniwal <
> [email protected]> wrote:
> >> >>
> >> >> Hi,
> >> >>
> >> >> Please find the updated patch.
> >> >>
> >> >> On Wed, Apr 15, 2020 at 1:33 PM Akshay Joshi <
> [email protected]> wrote:
> >> >>>
> >> >>> Hi Aditya
> >> >>>
> >> >>> I think the fix is incorrect. .format method should be applied
> after gettext() like gettext().format(). Please check for other places too
> and send the updated patch.
> >> >>>
> >> >>> On Wed, Apr 15, 2020 at 11:38 AM Aditya Toshniwal <
> [email protected]> wrote:
> >> >>>>
> >> >>>> Hi Hackers/Libor,
> >> >>>>
> >> >>>> The changes like below are incorrect. Try "Count rows" from a
> table's context menu.
> >> >>>>
> >> >>>> -            info=gettext("Table rows counted: %s" % count),
> >> >>>>
> >> >>>> +            info=gettext("Table rows counted: %s") % count,
> >> >>>>
> >> >>>>
> >> >>>> Attached is the patch to fix all such changes in pgAdmin, to use
> format() instead.
> >> >>>> Please review.
> >> >>>>
> >> >>>> On Fri, Apr 10, 2020 at 2:57 PM Akshay Joshi <
> [email protected]> wrote:
> >> >>>>>
> >> >>>>> Hi Libor
> >> >>>>>
> >> >>>>> Thanks, patch applied. Please make sure to run the PEP8 checks
> before sending the patch.
> >> >>>>> I have fixed and committed the code.
> >> >>>>>
> >> >>>>> On Wed, Apr 8, 2020 at 9:30 PM Libor M. <[email protected]>
> wrote:
> >> >>>>>>
> >> >>>>>> Hello,
> >> >>>>>> I fixed next gettext usage:
> >> >>>>>>
> >> >>>>>> - fixed gettext usage with .format() only for original text with
> %s
> >> >>>>>> - fixed typos
> >> >>>>>> - fixed translation yes/no buttons in dialog
> >> >>>>>> - improved translating sentences without "connecting" words (eg.
> see
> >> >>>>>> web/pgadmin/dashboard/static/js/dashboard.js, word 'cancel'
> needs to
> >> >>>>>> be translated in Czech language as 'zrušit' but in another
> sentence as
> >> >>>>>> 'zrušení')
> >> >>>>>> - added gettext for text 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 & 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 & Regards
> >> > Akshay Joshi
> >> > Sr. Software Architect
> >> > EnterpriseDB Software India Private Limited
> >> > Mobile: +91 976-788-8246
> >
> >
> >
> > --
> > Thanks & Regards
> > Akshay Joshi
> > Sr. Software Architect
> > EnterpriseDB Software India Private Limited
> > Mobile: +91 976-788-8246
>


-- 
*Thanks & Regards*
*Akshay Joshi*

*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*


^ permalink  raw  reply  [nested|flat] 11+ messages in thread


end of thread, other threads:[~2020-04-20 13:47 UTC | newest]

Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-04-08 15:41 pgAdmin 4 - next gettext usage fixes Libor M. <[email protected]>
2020-04-10 09:27 ` Akshay Joshi <[email protected]>
2020-04-15 06:08   ` Aditya Toshniwal <[email protected]>
2020-04-15 06:17     ` Ashesh Vashi <[email protected]>
2020-04-15 08:03     ` Akshay Joshi <[email protected]>
2020-04-15 09:25       ` Aditya Toshniwal <[email protected]>
2020-04-15 11:17         ` Akshay Joshi <[email protected]>
2020-04-15 11:46           ` Libor M. <[email protected]>
2020-04-16 07:50             ` Akshay Joshi <[email protected]>
2020-04-19 12:20               ` Libor M. <[email protected]>
2020-04-20 13:47                 ` 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