Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2013-07-02 05:28:42 (GMT)
committer Walter Bender <walter@sugarlabs.org>2013-07-02 05:28:42 (GMT)
commit0dd0cc2b2dc001b73a0118b22cd31a48c65dfd4f (patch)
tree0777bc943b25e28b2bdca1223a5c97fc491df56b
parent96157b80a0bcc466b904149cfb66a26ecf75ec24 (diff)
fix problem with label translations
-rw-r--r--sensor_toolbar.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/sensor_toolbar.py b/sensor_toolbar.py
index a3c6fae..b3b4b79 100644
--- a/sensor_toolbar.py
+++ b/sensor_toolbar.py
@@ -32,6 +32,10 @@ log = logging.getLogger('measure-activity')
log.setLevel(logging.DEBUG)
LOG_TIMER_VALUES = [1, 10, 300, 3000, 18000] # In 10th second intervals
+LOG_TIMER_LABELS = {1: _('1/10 second'), 10: _('1 second'),
+ 300: _('30 seconds'), 3000: _('5 minutes'),
+ 30000: _('30 minutes')}
+
def _is_xo(hw):
''' Return True if this is xo hardware '''
@@ -199,14 +203,10 @@ of XO)") + ' '
return tenth_seconds / 10.
def _log_to_string(self, tenth_seconds):
- seconds = tenth_seconds / 10
- if tenth_seconds == 1:
- return _('1/10 second')
- elif seconds < 61:
- return ngettext('%d second', '%d seconds', seconds) % seconds
+ if tenth_seconds in LOG_VALUE_LABELS:
+ return LOG_VALUE_LABELS[tenth_seconds]
else:
- minutes = seconds / 60
- return ngettext('%d minute', '%d minutes', minutes) % minutes
+ return _('1 second')
def _setup_log_palette(self):
self._log_palette = self._log_button.get_palette()
@@ -214,7 +214,7 @@ of XO)") + ' '
for tenth_seconds in LOG_TIMER_VALUES:
text = self._log_to_string(tenth_seconds)
menu_item = MenuItem(icon_name='timer-%d' % (tenth_seconds),
- text_label=text)
+ text_label=_log_to_string(tenth_seconds))
menu_item.connect('activate', self._log_selected_cb, tenth_seconds)
self._log_palette.menu.append(menu_item)
menu_item.show()