replace remained arg() with format()

This commit is contained in:
Kashiko Koibumi 2024-05-22 10:08:47 +09:00
parent 218cc9723c
commit b12c7cd9bb
No known key found for this signature in database
GPG Key ID: 8F06E069E37C40C4
4 changed files with 15 additions and 15 deletions

View File

@ -64,8 +64,8 @@ class IconGlossaryDialog(QtWidgets.QDialog):
self.labelPortNumber.setText(_translate( self.labelPortNumber.setText(_translate(
"iconGlossaryDialog", "iconGlossaryDialog",
"You are using TCP port %1. (This can be changed in the settings)." "You are using TCP port {0}. (This can be changed in the settings)."
).arg(config.getint('bitmessagesettings', 'port'))) ).format(config.getint('bitmessagesettings', 'port')))
self.setFixedSize(QtWidgets.QWidget.sizeHint(self)) self.setFixedSize(QtWidgets.QWidget.sizeHint(self))

View File

@ -96,8 +96,8 @@ class namecoinConnection(object):
res = res["reply"] res = res["reply"]
if not res: if not res:
return (_translate( return (_translate(
"MainWindow", "The name %1 was not found." "MainWindow", "The name {0} was not found."
).arg(identity.decode("utf-8", "ignore")), None) ).format(identity.decode("utf-8", "ignore")), None)
else: else:
assert False assert False
except RPCError as exc: except RPCError as exc:
@ -107,12 +107,12 @@ class namecoinConnection(object):
else: else:
errmsg = exc.error errmsg = exc.error
return (_translate( return (_translate(
"MainWindow", "The namecoin query failed (%1)" "MainWindow", "The namecoin query failed ({0})"
).arg(errmsg.decode("utf-8", "ignore")), None) ).format(errmsg.decode("utf-8", "ignore")), None)
except AssertionError: except AssertionError:
return (_translate( return (_translate(
"MainWindow", "Unknown namecoin interface type: %1" "MainWindow", "Unknown namecoin interface type: {0}"
).arg(self.nmctype.decode("utf-8", "ignore")), None) ).format(self.nmctype.decode("utf-8", "ignore")), None)
except Exception: except Exception:
logger.exception("Namecoin query exception") logger.exception("Namecoin query exception")
return (_translate( return (_translate(
@ -135,8 +135,8 @@ class namecoinConnection(object):
) if valid else ( ) if valid else (
_translate( _translate(
"MainWindow", "MainWindow",
"The name %1 has no associated Bitmessage address." "The name {0} has no associated Bitmessage address."
).arg(identity.decode("utf-8", "ignore")), None) ).format(identity.decode("utf-8", "ignore")), None)
def test(self): def test(self):
""" """
@ -164,7 +164,7 @@ class namecoinConnection(object):
"success", "success",
_translate( _translate(
"MainWindow", "MainWindow",
"Success! Namecoind version %1 running.").arg( "Success! Namecoind version {0} running.").format(
versStr.decode("utf-8", "ignore"))) versStr.decode("utf-8", "ignore")))
elif self.nmctype == "nmcontrol": elif self.nmctype == "nmcontrol":

View File

@ -138,9 +138,9 @@ class TCPConnection(BMProto, TLSDispatcher):
'updateStatusBar', 'updateStatusBar',
_translate( _translate(
"MainWindow", "MainWindow",
"The time on your computer, %1, may be wrong. " "The time on your computer, {0}, may be wrong. "
"Please verify your settings." "Please verify your settings."
).arg(l10n.formatTimestamp()))) ).format(l10n.formatTimestamp())))
def state_connection_fully_established(self): def state_connection_fully_established(self):
""" """

View File

@ -269,8 +269,8 @@ class uPnPThread(StoppableThread):
knownnodes.addKnownNode( knownnodes.addKnownNode(
1, self_peer, is_self=True) 1, self_peer, is_self=True)
queues.UISignalQueue.put(('updateStatusBar', tr._translate( queues.UISignalQueue.put(('updateStatusBar', tr._translate(
"MainWindow", 'UPnP port mapping established on port %1' "MainWindow", 'UPnP port mapping established on port {0}'
).arg(str(self.extPort)))) ).format(self.extPort)))
break break
except socket.timeout: except socket.timeout:
pass pass