Changeset 4047

Show
Ignore:
Timestamp:
02/15/09 13:45:47 (4 years ago)
Author:
gpolo
Message:

Making xgettext happy now

Location:
branch/NetworkInventory
Files:
1 added
4 modified

Legend:

Unmodified
Added
Removed
  • branch/NetworkInventory/umitDB/InventoryChanges.py

    r4046 r4047  
    250250                ports_only = True 
    251251 
    252             verb, plural = self.conjugate(info_changes, False) 
     252            word, verb = self.conjugate(_("Port"), info_changes, False) 
    253253            ports_str = ', '.join([str(p) for p in info_changes]) 
    254254            this_port_diff = ' '.join([ 
    255                 _("Port") + plural, ports_str, verb, _("changed info")]) 
     255                word, ports_str, verb, _("changed info")]) 
    256256            host_diff = ''.join([host_diff, this_port_diff]) 
    257257 
     
    310310 
    311311 
    312     def conjugate(self, alist, toBe=True): 
     312    def conjugate(self, word, alist, toBe=True): 
    313313        """ 
    314314        Do conjugation based on alist size. 
     
    322322        if len(alist) > 1: 
    323323            verb = verbs[0] 
    324             plural = _("s") 
     324            word += _("s") 
    325325        else: 
    326326            verb = verbs[1] 
    327             plural = _("") 
    328  
    329         return verb, plural 
     327 
     328        return word, verb 
    330329 
    331330 
     
    376375        text = '' 
    377376        if closed_ports: 
    378             verb, plural = self.conjugate(closed_ports) 
     377            word, verb = self.conjugate(port_text, closed_ports) 
    379378            closed_ports = ', '.join([str(p) for p in closed_ports]) 
    380             closed_ports = "%s%s %s %s %s %s." % (port_text, plural, 
     379            closed_ports = "%s %s %s %s %s." % (word, 
    381380                closed_ports, verb, closed_text, now_text) 
    382381 
    383382        if open_ports: 
    384             verb, plural = self.conjugate(open_ports) 
     383            word, verb = self.conjugate(port_text, open_ports) 
    385384            open_ports = ', '.join([str(p) for p in open_ports]) 
    386             open_ports = "%s%s %s %s %s %s." % (port_text, plural, 
     385            open_ports = "%s %s %s %s %s." % (word, 
    387386                open_ports, verb, open_text, now_text) 
    388387 
  • branch/NetworkInventory/umitInventory/HostDiscovery.py

    r4034 r4047  
    3030from umitCore.Paths import Path 
    3131from umitCore.I18N import _ 
     32 
     33from umitInventory.Utils import append_s 
    3234 
    3335from higwidgets.higbuttons import HIGButton 
     
    323325        self.target_model.clear() 
    324326        self.hostdetect_btn.set_sensitive(False) 
    325         p = (self.scount > 1) and 's' or '' 
     327        self._adjust_target_label() 
     328        gobject.timeout_add(500, self._check_scans) 
     329 
     330 
     331    def _adjust_target_label(self): 
     332        """Update target_lbl according to the current scount (assumes that 
     333        scount > 0).""" 
     334        word = append_s(_("scan"), self.scount) 
    326335        self.target_lbl.set_label( 
    327             _("Target list (%d scan%s running)") % (self.scount, p)) 
    328         gobject.timeout_add(500, self._check_scans) 
     336                _("Target list") + 
     337                (" (%d " % self.scount) + word + 
     338                _("running")) 
    329339 
    330340 
     
    350360                self.scount -= 1 
    351361                if self.scount: 
    352                     p = (self.scount > 1) and 's' or '' 
    353                     self.target_lbl.set_label( 
    354                         _("Target list (%d scan%s running)") % (self.scount, p)) 
     362                    self._adjust_target_label() 
    355363 
    356364                # clean up temp files 
  • branch/NetworkInventory/umitInventory/InventoryTree.py

    r4034 r4047  
    3838from umitInventory.InventoryLoad import InventoryLoad 
    3939from umitInventory.InventoryCommonDialog import NoScheduleDlg 
     40from umitInventory.Utils import append_s 
    4041 
    4142INVENTORY_INFO = _("Info") 
     
    5253    factory.add(NI_INVENTORY_ROOT_ICON, gtk.IconSet(pixbuf)) 
    5354    factory.add_default() 
    54  
    55 def get_plural(count): 
    56     if count == 0 or count > 1: 
    57         return _("s") 
    58     else: 
    59         return _("") 
    6055 
    6156class InventoryTree(gtk.Notebook): 
     
    269264            self.running_scans[scan] = inv 
    270265            running_scans = len(self.running_scans) 
    271             plural = get_plural(running_scans) 
    272266            self.daddy._write_statusbar(("%d " % running_scans) + 
    273                     _("scan") + plural + _(" running")) 
     267                    append_s(_("scan"), running_scans) + _(" running")) 
    274268 
    275269    def _check_scans(self): 
     
    322316 
    323317        running_scans = len(self.running_scans) 
    324         plural = get_plural(running_scans) 
     318        word = append_s(_("scan"), running_scans) 
    325319        self.daddy._write_statusbar( 
    326                 ("%d " % running_scans) + _("scan") + plural + _(" running")) 
     320                ("%d " % running_scans) + word + _(" running")) 
    327321 
    328322        if not self.running_scans: 
  • branch/NetworkInventory/umitInventory/Viewer.py

    r4034 r4047  
    5555from umitInventory.About import About 
    5656from umitInventory.InventoryException import NoInventory 
     57from umitInventory.Utils import append_s 
     58 
    5759 
    5860umitdb = Path.umitdb_ng 
     
    543545            # layout 
    544546            matches = len(args[1]) 
    545             if matches > 1 or matches == 0: 
    546                 plural = _("s") 
    547             else: 
    548                 plural = _("") 
     547            word = append_s(_("result"), matches) 
    549548            upper_title = gtk.Label() 
    550549            upper_title.set_markup( 
    551                     ("<b>%d " % plural) + _("result") + plural + _(" found.") + 
     550                    ("<b>%d " % matches) + word + _(" found.") + 
    552551                    "</b>") 
    553552            hutbox = HIGHBox()