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

@ -30,7 +30,6 @@ __commands__ = ["MergeRequest"]
class Set(base.CommandBase):
def __init__(self, host):
base.CommandBase.__init__(
self,
@ -74,11 +73,12 @@ class Set(base.CommandBase):
await common.fill_well_known_uri(self, self.repository, "merge requests")
if not self.args.force:
message = _(
f"You are going to publish your changes to service "
f"[{self.args.service}], are you sure ?"
)
"You are going to publish your changes to service "
"[{service}], are you sure ?"
).format(service=self.args.service)
await self.host.confirmOrQuit(
message, _("merge request publication cancelled"))
message, _("merge request publication cancelled")
)
extra = {"update": True} if self.args.item else {}
values = {}
@ -101,7 +101,11 @@ class Set(base.CommandBase):
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
if published_id:
self.disp(_(f"Merge request published at {published_id}"))
self.disp(
_("Merge request published at {published_id}").format(
published_id=published_id
)
)
else:
self.disp(_("Merge request published"))
@ -125,8 +129,7 @@ class Get(base.CommandBase):
pass
async def start(self):
await common.fill_well_known_uri(
self, os.getcwd(), "merge requests", meta_map={})
await common.fill_well_known_uri(self, os.getcwd(), "merge requests", meta_map={})
extra = {}
try:
requests_data = data_format.deserialise(
@ -148,7 +151,7 @@ class Get(base.CommandBase):
whitelist = None
else:
whitelist = {"id", "title", "body"}
for request_xmlui in requests_data['items']:
for request_xmlui in requests_data["items"]:
xmlui = xmlui_manager.create(self.host, request_xmlui, whitelist=whitelist)
await xmlui.show(values_only=True)
self.disp("")
@ -179,7 +182,8 @@ class Import(base.CommandBase):
async def start(self):
self.repository = os.path.expanduser(os.path.abspath(self.args.repository))
await common.fill_well_known_uri(
self, self.repository, "merge requests", meta_map={})
self, self.repository, "merge requests", meta_map={}
)
extra = {}
try:
await self.host.bridge.mergeRequestsImport(