electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 9a88c13b3de000fa3a65e1039cf19c5635d83c9f
parent 08118ca1674f58860b5a5a639372c95bc012eb80
Author: SomberNight <somber.night@protonmail.com>
Date:   Sat, 11 Apr 2020 16:33:45 +0200

translations: add note that f-strings cannot be translated

and replace current usage

Diffstat:
Melectrum/gui/kivy/uix/screens.py | 4++--
Melectrum/gui/qt/channels_list.py | 2+-
Melectrum/gui/qt/lightning_dialog.py | 8++++----
Melectrum/i18n.py | 3+++
Melectrum/lnworker.py | 2+-
5 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/electrum/gui/kivy/uix/screens.py b/electrum/gui/kivy/uix/screens.py @@ -404,7 +404,7 @@ class SendScreen(CScreen): self.app.wallet.delete_invoice(key) self.update() n = len(invoices) - d = Question(_(f'Delete {n} invoices?'), callback) + d = Question(_('Delete {} invoices?').format(n), callback) d.open() @@ -522,7 +522,7 @@ class ReceiveScreen(CScreen): self.app.wallet.delete_request(key) self.update() n = len(requests) - d = Question(_(f'Delete {n} requests?'), callback) + d = Question(_('Delete {} requests?').format(n), callback) d.open() diff --git a/electrum/gui/qt/channels_list.py b/electrum/gui/qt/channels_list.py @@ -108,7 +108,7 @@ class ChannelsList(MyTreeView): chan = self.lnworker.channels[channel_id] to_self_delay = chan.config[REMOTE].to_self_delay msg = _('Force-close channel?') + '\n\n'\ - + _(f'Funds retrieved from this channel will not be available before {to_self_delay} blocks after forced closure.') + ' '\ + + _('Funds retrieved from this channel will not be available before {} blocks after forced closure.').format(to_self_delay) + ' '\ + _('After that delay, funds will be sent to an address derived from your wallet seed.') + '\n\n'\ + _('In the meantime, channel funds will not be recoverable from your seed, and might be lost if you lose your wallet.') + ' '\ + _('To prevent that, you should have a backup of this channel on another device.') diff --git a/electrum/gui/qt/lightning_dialog.py b/electrum/gui/qt/lightning_dialog.py @@ -66,14 +66,14 @@ class LightningDialog(QDialog): self.set_unknown_channels('', len(self.network.lngossip.unknown_ids)) def on_channel_db(self, event, num_nodes, num_channels, num_policies): - self.num_nodes.setText(_(f'{num_nodes} nodes')) - self.num_channels.setText(_(f'{num_channels} channels')) + self.num_nodes.setText(_('{} nodes').format(num_nodes)) + self.num_channels.setText(_('{} channels').format(num_channels)) def set_num_peers(self, event, num_peers): - self.num_peers.setText(_(f'Connected to {num_peers} peers')) + self.num_peers.setText(_('Connected to {} peers').format(num_peers)) def set_unknown_channels(self, event, unknown): - self.status.setText(_(f'Requesting {unknown} channels...') if unknown else '') + self.status.setText(_('Requesting {} channels...').format(unknown) if unknown else '') def is_hidden(self): return self.isMinimized() or self.isHidden() diff --git a/electrum/i18n.py b/electrum/i18n.py @@ -30,6 +30,9 @@ LOCALE_DIR = os.path.join(os.path.dirname(__file__), 'locale') language = gettext.translation('electrum', LOCALE_DIR, fallback=True) +# note: f-strings cannot be translated! see https://stackoverflow.com/q/49797658 +# So this does not work: _(f"My name: {name}") +# instead use .format: _("My name: {}").format(name) def _(x): global language return language.gettext(x) diff --git a/electrum/lnworker.py b/electrum/lnworker.py @@ -819,7 +819,7 @@ class LNWallet(LNWorker): if success: break else: - reason = _(f'Failed after {attempts} attempts') + reason = _('Failed after {} attempts').format(attempts) self.network.trigger_callback('invoice_status', key) if success: self.network.trigger_callback('payment_succeeded', key)