use my ngettext() in other places too

This commit is contained in:
Nikos Kouremenos 2005-08-24 12:23:35 +00:00
parent bc284578f2
commit eba6131a59
3 changed files with 13 additions and 11 deletions

View File

@ -60,8 +60,8 @@ def ngettext(s_sing, s_plural, n, replace_sing = None, replace_plural = None):
in other words this is a hack to ngettext() to support %s %d etc..
'''
text = _translation.ngettext(s_sing, s_plural, n)
if n == 1:
if n == 1 and replace_sing is not None:
text = text % replace_sing
else:
elif n > 1 and replace_plural is not None:
text = text % replace_plural
return text

View File

@ -263,11 +263,11 @@ class SystrayWin32(systray.Systray):
if jid != 'tabbed':
nb += jids[jid].nb_unread[jid]
#FIXME: prepare me for transltaion (ngeetext() and all) for 0.9
if nb > 1:
text = 'Gajim - %s unread messages' % nb
else:
text = 'Gajim - 1 unread message'
text = i18n.ngettext(
'Gajim - one unread message',
'Gajim - %d unread messages',
nb, None, nb)
self.systray_winapi.notify_icon.set_tooltip(text)
def remove_jid(self, jid, account):

View File

@ -207,10 +207,12 @@ class NotificationAreaTooltip(BaseTooltip, StatusTable):
accounts.append({'name': account, 'status_line': single_line,
'show': status, 'message': message})
unread_messages_no = self.plugin.roster.nb_unread
if unread_messages_no > 1:
text = _('Gajim - %s unread messages') % unread_messages_no
elif unread_messages_no == 1:
text = _('Gajim - 1 unread message')
if unread_messages_no > 0:
text = i18n.ngettext(
'Gajim - one unread message',
'Gajim - %d unread messages',
unread_messages_no, None, unread_messages_no)
elif len(accounts) > 1:
text = _('Gajim')
self.current_row = 1