mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-27 15:31:31 +00:00
translations: add note that f-strings cannot be translated
and replace current usage
This commit is contained in:
parent
08118ca167
commit
9a88c13b3d
5 changed files with 11 additions and 8 deletions
|
@ -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()
|
||||
|
||||
|
||||
|
|
|
@ -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.')
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue