use proper pluralization, commas in countdown output
This commit is contained in:
parent
e6c9747dad
commit
d5c4750dd8
@ -62,17 +62,35 @@ class Countdown(Module):
|
||||
relstr = whats[1] + ' will occur in '
|
||||
if rdelta.years != 0:
|
||||
relstr += str(rdelta.years) + ' years '
|
||||
if rdelta.years > 1:
|
||||
relstr += 's'
|
||||
relstr += ', '
|
||||
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:
|
||||
relstr += str(rdelta.days) + ' days '
|
||||
relstr += str(rdelta.days) + ' day'
|
||||
if rdelta.days > 1:
|
||||
relstr += 's'
|
||||
relstr += ', '
|
||||
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:
|
||||
relstr += str(rdelta.minutes) + ' minutes '
|
||||
relstr += str(rdelta.minutes) + ' minute'
|
||||
if rdelta.minutes > 1:
|
||||
relstr += 's'
|
||||
relstr += ', '
|
||||
if rdelta.seconds != 0:
|
||||
relstr += str(rdelta.seconds) + ' seconds'
|
||||
return self.reply(connection, replypath, relstr)
|
||||
relstr += str(rdelta.seconds) + ' second'
|
||||
if rdelta.seconds > 1:
|
||||
relstr += 's'
|
||||
relstr += ', '
|
||||
return self.reply(connection, replypath, relstr[0:-2])
|
||||
except NoOptionError: pass
|
||||
|
||||
# vi:tabstop=4:expandtab:autoindent
|
||||
|
Loading…
Reference in New Issue
Block a user