Browse Source

Shorter elapsed time messages (also, don't show seconds, since it tends

to keep changing all the time, but only when the user interacts with
mitter, which is kinda weird sometimes.)
master
Julio Biason 14 years ago
parent
commit
fcfade8b62
  1. 16
      mitterlib/ui/helpers/timesince.py

16
mitterlib/ui/helpers/timesince.py

@ -57,7 +57,7 @@ def timesince(timestamp):
if since <= 0:
return _('just now')
result = []
result = None
for (seconds, name) in chunks:
part = since / seconds
if part < 1:
@ -65,13 +65,11 @@ def timesince(timestamp):
# all divs in Python 2.x are integers; we'll have to check this again
# when we change to Python 3.
elapsed = '%s %s' % (part, name(part))
result = _('%s ago') % (elapsed)
break
result.append('%s %s' % (part, name(part)))
since -= (seconds * part)
if not result:
result = _('less than a minute ago')
# since now only have seconds (which are out of our "chunks")
seconds = N_('second', 'seconds', since)
result.append('%d %s' % (since, seconds))
whole_message = ', '.join(result)
return _('%s ago') % (whole_message)
return result

Loading…
Cancel
Save