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:
parent
8d8541015c
commit
7adbf3ead8
1 changed files with 823 additions and 601 deletions
|
|
@ -61,7 +61,7 @@ class Get(base.CommandBase):
|
|||
self.getPubsubExtra(),
|
||||
self.profile,
|
||||
),
|
||||
type_check=list
|
||||
type_check=list,
|
||||
)
|
||||
except Exception as e:
|
||||
self.disp(f"can't get lists: {e}", error=True)
|
||||
|
|
@ -72,7 +72,6 @@ class Get(base.CommandBase):
|
|||
|
||||
|
||||
class Set(base.CommandBase):
|
||||
|
||||
def __init__(self, host):
|
||||
base.CommandBase.__init__(
|
||||
self,
|
||||
|
|
@ -128,10 +127,10 @@ class Set(base.CommandBase):
|
|||
self.args.service,
|
||||
self.args.node,
|
||||
values,
|
||||
'',
|
||||
"",
|
||||
self.args.item,
|
||||
data_format.serialise(extra),
|
||||
self.profile
|
||||
self.profile,
|
||||
)
|
||||
except Exception as e:
|
||||
self.disp(f"can't set list item: {e}", error=True)
|
||||
|
|
@ -142,7 +141,6 @@ class Set(base.CommandBase):
|
|||
|
||||
|
||||
class Delete(base.CommandBase):
|
||||
|
||||
def __init__(self, host):
|
||||
base.CommandBase.__init__(
|
||||
self,
|
||||
|
|
@ -183,10 +181,10 @@ class Delete(base.CommandBase):
|
|||
self.profile,
|
||||
)
|
||||
except Exception as e:
|
||||
self.disp(_(f"can't delete item: {e}"), error=True)
|
||||
self.disp(_("can't delete item: {e}").format(e=e), error=True)
|
||||
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
|
||||
else:
|
||||
self.disp(_(f"item {self.args.item} has been deleted"))
|
||||
self.disp(_("item {item} has been deleted").format(item=self.args.item))
|
||||
self.host.quit(C.EXIT_OK)
|
||||
|
||||
|
||||
|
|
@ -262,7 +260,10 @@ class Import(base.CommandBase):
|
|||
self.disp(_("Tickets uploaded successfully"), 2)
|
||||
|
||||
async def onProgressError(self, error_msg):
|
||||
self.disp(_(f"Error while uploading tickets: {error_msg}"), error=True)
|
||||
self.disp(
|
||||
_("Error while uploading tickets: {error_msg}").format(error_msg=error_msg),
|
||||
error=True,
|
||||
)
|
||||
|
||||
async def start(self):
|
||||
if self.args.location is None:
|
||||
|
|
@ -270,7 +271,10 @@ class Import(base.CommandBase):
|
|||
for name in ("option", "service", "node"):
|
||||
if getattr(self.args, name):
|
||||
self.parser.error(
|
||||
_(f"{name} argument can't be used without location argument"))
|
||||
_(
|
||||
"{name} argument can't be used without location argument"
|
||||
).format(name=name)
|
||||
)
|
||||
if self.args.importer is None:
|
||||
self.disp(
|
||||
"\n".join(
|
||||
|
|
@ -297,8 +301,14 @@ class Import(base.CommandBase):
|
|||
if self.args.progress:
|
||||
# we use a custom progress bar template as we want a counter
|
||||
self.pbar_template = [
|
||||
_("Progress: "), ["Percentage"], " ", ["Bar"], " ",
|
||||
["Counter"], " ", ["ETA"]
|
||||
_("Progress: "),
|
||||
["Percentage"],
|
||||
" ",
|
||||
["Bar"],
|
||||
" ",
|
||||
["Counter"],
|
||||
" ",
|
||||
["ETA"],
|
||||
]
|
||||
|
||||
options = {key: value for key, value in self.args.option}
|
||||
|
|
@ -306,8 +316,10 @@ class Import(base.CommandBase):
|
|||
if fields_map:
|
||||
if FIELDS_MAP in options:
|
||||
self.parser.error(
|
||||
_("fields_map must be specified either preencoded in --option or "
|
||||
"using --map, but not both at the same time")
|
||||
_(
|
||||
"fields_map must be specified either preencoded in --option or "
|
||||
"using --map, but not both at the same time"
|
||||
)
|
||||
)
|
||||
options[FIELDS_MAP] = json.dumps(fields_map)
|
||||
|
||||
|
|
@ -322,7 +334,7 @@ class Import(base.CommandBase):
|
|||
)
|
||||
except Exception as e:
|
||||
self.disp(
|
||||
_(f"Error while trying to import tickets: {e}"),
|
||||
_("Error while trying to import tickets: {e}").format(e=e),
|
||||
error=True,
|
||||
)
|
||||
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
|
||||
|
|
|
|||
Loading…
Reference in a new issue