core, frontends: fix invalid translatable strings.

Some f-strings where used in translatable text, this has been fixed by using explicit
`format()` call (using a script based on `tokenize`).

As tokenize messes with spaces, a reformating tool (`black`) has been applied to some
files afterwards.
This commit is contained in:
Goffi 2021-06-14 18:35:12 +02:00
commit 7adbf3ead8

View file

@ -25,14 +25,11 @@ __commands__ = ["Ping"]
class Ping(base.CommandBase):
def __init__(self, host):
super(Ping, self).__init__(host, 'ping', help=_('ping XMPP entity'))
super(Ping, self).__init__(host, "ping", help=_("ping XMPP entity"))
def add_parser_options(self):
self.parser.add_argument(
"jid", help=_("jid to ping")
)
self.parser.add_argument("jid", help=_("jid to ping"))
self.parser.add_argument(
"-d", "--delay-only", action="store_true", help=_("output delay only (in s)")
)
@ -41,9 +38,9 @@ class Ping(base.CommandBase):
try:
pong_time = await self.host.bridge.ping(self.args.jid, self.profile)
except Exception as e:
self.disp(msg=_(f"can't do the ping: {e}"), error=True)
self.disp(msg=_("can't do the ping: {e}").format(e=e), error=True)
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
else:
msg = pong_time if self.args.delay_only else f"PONG ({pong_time} s)"
msg = pong_time if self.args.delay_only else f"PONG ({pong_time} s)"
self.disp(msg)
self.host.quit()