Ticket #1543: 0001-Use-ngettext-for-plural-suport.patch

File 0001-Use-ngettext-for-plural-suport.patch, 1.1 KB (added by khaled, 13 years ago)

Use ngettext

  • src/model.py

    From ecce232b7bf18b339c1bed5e5d27728bb6dea759 Mon Sep 17 00:00:00 2001
    From: Khaled Hosny <khaledhosny@eglug.org>
    Date: Tue, 10 Nov 2009 13:11:27 +0200
    Subject: [PATCH] Use ngettext (for plural suport)
    
    ---
     src/model.py |    8 +++++---
     1 files changed, 5 insertions(+), 3 deletions(-)
    
    diff --git a/src/model.py b/src/model.py
    index dbb51a5..844df2f 100755
    a b def print_available_updates(): 
    742742        else:
    743743            print '*', row[DESCRIPTION_BIG] + opt(row[DESCRIPTION_SMALL])
    744744    print
    745     print _('%(number)d updates available.  Size: %(size)s') % \
    746           { 'number': ul.updates_available(),
    747             'size': _humanize_size(ul.updates_size()) }
     745    print gettext.ngettext('%(number)d updates available.  Size: %(size)s',
     746                           '%(number)d updates available.  Size: %(size)s',
     747                            ul.updates_available()) % \
     748                         { 'number': ul.updates_available(),
     749                           'size': _humanize_size(ul.updates_size()) }
    748750
    749751def set_available_updates():
    750752    # NOTE slightly odd way to document this control panel key