ui: use ngettext for translatable strings with number dependencies
This commit is contained in:
parent
e763aeadb4
commit
fd02b33971
|
@ -186,7 +186,7 @@ class ReceiverListener(_listener.EventsListener):
|
|||
# a device notification
|
||||
if not (0 < n.devnumber <= self.receiver.max_devices):
|
||||
if _log.isEnabledFor(_WARNING):
|
||||
_log.warning(_('Unexpected device number (%s) in notification %s.' % (n.devnumber, n)))
|
||||
_log.warning('Unexpected device number (%s) in notification %s.', n.devnumber, n)
|
||||
return
|
||||
already_known = n.devnumber in self.receiver
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ from logging import getLogger
|
|||
|
||||
from gi.repository import GLib, Gtk
|
||||
from logitech_receiver.status import KEYS as _K
|
||||
from solaar.i18n import _
|
||||
from solaar.i18n import _, ngettext
|
||||
|
||||
from . import icons as _icons
|
||||
|
||||
|
@ -137,7 +137,7 @@ def _pairing_failed(assistant, receiver, error):
|
|||
elif str(error) == 'device not supported':
|
||||
text = _('A new device was detected, but it is not compatible with this receiver.')
|
||||
elif 'many' in str(error):
|
||||
text = _('The receiver only supports %d paired device(s).')
|
||||
text = _('More paired devices than receiver can support.')
|
||||
else:
|
||||
text = _('No further details are available about the error.')
|
||||
_create_page(assistant, Gtk.AssistantPageType.SUMMARY, header, 'dialog-error', text)
|
||||
|
@ -205,7 +205,10 @@ def create(receiver):
|
|||
|
||||
page_text = _('If the device is already turned on, turn if off and on again.')
|
||||
if receiver.remaining_pairings() and receiver.remaining_pairings() >= 0:
|
||||
page_text += _('\n\nThis receiver has %d pairing(s) remaining.') % receiver.remaining_pairings()
|
||||
page_text += ngettext(
|
||||
'\n\nThis receiver has %d pairing remaining.', '\n\nThis receiver has %d pairings remaining.',
|
||||
receiver.remaining_pairings()
|
||||
) % receiver.remaining_pairings()
|
||||
page_text += _('\nCancelling at this point will not use up a pairing.')
|
||||
|
||||
page_intro = _create_page(
|
||||
|
|
|
@ -610,7 +610,10 @@ def _update_receiver_panel(receiver, panel, buttons, full=False):
|
|||
paired_text += '\n\n<small>%s</small>' % _('Only one device can be paired to this receiver.')
|
||||
pairings = receiver.remaining_pairings(False)
|
||||
if (pairings is not None and pairings >= 0):
|
||||
paired_text += '\n<small>%s</small>' % _('This receiver has %d pairing(s) remaining.') % pairings
|
||||
paired_text += '\n<small>%s</small>' % (
|
||||
ngettext('This receiver has %d pairing remaining.', 'This receiver has %d pairings remaining.', pairings) %
|
||||
pairings
|
||||
)
|
||||
|
||||
panel._count.set_markup(paired_text)
|
||||
|
||||
|
|
Loading…
Reference in New Issue