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.. in other words this is a hack to ngettext() to support %s %d etc..
''' '''
text = _translation.ngettext(s_sing, s_plural, n) text = _translation.ngettext(s_sing, s_plural, n)
if n == 1: if n == 1 and replace_sing is not None:
text = text % replace_sing text = text % replace_sing
else: elif n > 1 and replace_plural is not None:
text = text % replace_plural text = text % replace_plural
return text return text

View File

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

View File

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