use proper pluralization, commas in countdown output

This commit is contained in:
Brian S. Stephan 2010-09-08 21:39:56 -05:00
parent e6c9747dad
commit d5c4750dd8

View File

@ -62,17 +62,35 @@ class Countdown(Module):
relstr = whats[1] + ' will occur in ' relstr = whats[1] + ' will occur in '
if rdelta.years != 0: if rdelta.years != 0:
relstr += str(rdelta.years) + ' years ' relstr += str(rdelta.years) + ' years '
if rdelta.years > 1:
relstr += 's'
relstr += ', '
if rdelta.months != 0: if rdelta.months != 0:
relstr += str(rdelta.months) + ' months ' relstr += str(rdelta.months) + ' month'
if rdelta.months > 1:
relstr += 's'
relstr += ', '
if rdelta.days != 0: if rdelta.days != 0:
relstr += str(rdelta.days) + ' days ' relstr += str(rdelta.days) + ' day'
if rdelta.days > 1:
relstr += 's'
relstr += ', '
if rdelta.hours != 0: if rdelta.hours != 0:
relstr += str(rdelta.hours) + ' hours ' relstr += str(rdelta.hours) + ' hour'
if rdelta.hours > 1:
relstr += 's'
relstr += ', '
if rdelta.minutes != 0: if rdelta.minutes != 0:
relstr += str(rdelta.minutes) + ' minutes ' relstr += str(rdelta.minutes) + ' minute'
if rdelta.minutes > 1:
relstr += 's'
relstr += ', '
if rdelta.seconds != 0: if rdelta.seconds != 0:
relstr += str(rdelta.seconds) + ' seconds' relstr += str(rdelta.seconds) + ' second'
return self.reply(connection, replypath, relstr) if rdelta.seconds > 1:
relstr += 's'
relstr += ', '
return self.reply(connection, replypath, relstr[0:-2])
except NoOptionError: pass except NoOptionError: pass
# vi:tabstop=4:expandtab:autoindent # vi:tabstop=4:expandtab:autoindent