some strings were untranslated; fixes #100
This commit is contained in:
parent
5af1719384
commit
5faecbf4f3
|
@ -147,7 +147,7 @@ def _process_hidpp10_notification(device, status, n):
|
|||
device.status = None
|
||||
if device.number in device.receiver:
|
||||
del device.receiver[device.number]
|
||||
status.changed(active=False, alert=_ALERT.ALL, reason='unpaired')
|
||||
status.changed(active=False, alert=_ALERT.ALL, reason=_("unpaired"))
|
||||
else:
|
||||
_log.warn("%s: disconnection with unknown type %02X: %s", device, n.address, n)
|
||||
return True
|
||||
|
|
|
@ -140,13 +140,9 @@ class DeviceStatus(dict):
|
|||
self.updated = 0
|
||||
|
||||
def __str__(self):
|
||||
def _item(name, format):
|
||||
value = self.get(name)
|
||||
if value is not None:
|
||||
return format % value
|
||||
|
||||
def _items():
|
||||
# TODO properly string approximative battery levels
|
||||
comma = False
|
||||
|
||||
battery_level = self.get(KEYS.BATTERY_LEVEL)
|
||||
if battery_level is not None:
|
||||
if isinstance(battery_level, _NamedInt):
|
||||
|
@ -154,20 +150,24 @@ class DeviceStatus(dict):
|
|||
else:
|
||||
yield _("Battery") + ': ' + ('%d%%' % battery_level)
|
||||
|
||||
battery_status = _item(KEYS.BATTERY_STATUS, ' (%s)')
|
||||
if battery_status:
|
||||
yield battery_status
|
||||
battery_status = self.get(KEYS.BATTERY_STATUS)
|
||||
if battery_status is not None:
|
||||
yield ' (%s)' % _(str(battery_status))
|
||||
|
||||
light_level = _item(KEYS.LIGHT_LEVEL, _("Lighting") + ': %d ' + _("lux"))
|
||||
if light_level:
|
||||
if battery_level:
|
||||
yield ', '
|
||||
yield light_level
|
||||
comma = True
|
||||
|
||||
light_level = self.get(KEYS.LIGHT_LEVEL)
|
||||
if light_level is not None:
|
||||
if comma: yield ', '
|
||||
yield _("Lighting") + (': %d ' % light_level) + _("lux")
|
||||
|
||||
return ''.join(i for i in _items())
|
||||
|
||||
__unicode__ = __str__
|
||||
|
||||
def __repr__(self):
|
||||
return '{' + ', '.join('\'%s\': %r' % (k, v) for k, v in self.items()) + '}'
|
||||
|
||||
def __bool__(self):
|
||||
return bool(self._active)
|
||||
__nonzero__ = __bool__
|
||||
|
|
|
@ -627,7 +627,7 @@ def _update_device_panel(device, panel, buttons, full=False):
|
|||
panel._battery._icon.set_sensitive(True)
|
||||
|
||||
if isinstance(battery_level, _NamedInt):
|
||||
text = str(battery_level)
|
||||
text = _(str(battery_level))
|
||||
else:
|
||||
text = '%d%%' % battery_level
|
||||
if is_online:
|
||||
|
|
Loading…
Reference in New Issue