Add the '<empty>' feature to nItems, and changed ChannelStats localization in order to use it as bug fixer

This commit is contained in:
Valentin Lorentz 2010-10-28 15:18:06 +02:00
parent 8864a7fc71
commit f3a579f3da
2 changed files with 13 additions and 2 deletions

View File

@ -45,7 +45,7 @@ msgstr "Je ne peux vous trouver dans ma base de données."
#: plugin.py:272
msgid "%s has sent %n; a total of %n, %n, %n, and %n; %s of those messages %s. %s has joined %n, parted %n, quit %n, kicked someone %n, been kicked %n, changed the topic %n, and changed the mode %n."
msgstr "%s a envoyé %n ; un total de %n, %n, %n, et %n ; %s de ces messages %s. %s est arrivé %nfois, est parti %nfois, a quitté %nfois, a kické %nfois, a été kické %nfois, a changé le topic %nfois, et a changé les modes %nfois."
msgstr "%s a envoyé %n ; un total de %n, %n, %n, et %n ; %s de ces messages %s. %s est arrivé %n fois, est parti %n fois, a quitté %n fois, a kické %n fois, a été kické %n fois, a changé le topic %n fois, et a changé les modes %n fois."
#: plugin.py:279
msgid "character"
@ -84,7 +84,7 @@ msgstr "étaient des ACTIONs"
#: plugin.py:292
#: plugin.py:293
msgid "time"
msgstr " fois"
msgstr "<empty>"
#: plugin.py:296
msgid "I have no stats for that %s in %s."

View File

@ -294,17 +294,28 @@ def depluralize(s):
def nItems(n, item, between=None):
"""Works like this:
>>> nItems(4, '<empty>')
'4'
>>> nItems(1, 'clock')
'1 clock'
>>> nItems(10, 'clock')
'10 clocks'
>>> nItems(4, '<empty>', between='grandfather')
'4 grandfather'
>>> nItems(10, 'clock', between='grandfather')
'10 grandfather clocks'
"""
assert isinstance(n, int) or isinstance(n, long), \
'The order of the arguments to nItems changed again, sorry.'
if item == '<empty>':
if between is None:
return format('%s', n)
else:
return format('%s %s', n, item)
if between is None:
if n != 1:
return format('%s %p', n, item)