Fixed gettext usage: 

- fixed gettext usage with .format() only for original text with %s
  - fixed typos
  - fixed translation yes/no buttons in the dialog.
  - improved translating sentences without "connecting" words (eg. see web/pgadmin/dashboard/static/js/dashboard.js,
     word 'cancel' needs to be translated in the Czech language as 'zrušit' but in another sentence as 'zrušení')
  - added gettext for text translations.
This commit is contained in:
Libor M
2020-04-10 14:52:41 +05:30
committed by Akshay Joshi
parent e238ecf182
commit 6a9af07f7a
81 changed files with 231 additions and 269 deletions

View File

@@ -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:

View File

@@ -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