From a4bc9b6d2b0191e4bd80eabd7886fadb5f063aae Mon Sep 17 00:00:00 2001 From: "Rob G. Healey" Date: Wed, 24 Feb 2010 06:37:21 +0000 Subject: [PATCH] Added formatted strings for distcheck. svn: r14448 --- src/plugins/tool/Check.py | 58 ++++++++++++++++---------------- src/plugins/tool/MediaManager.py | 4 +-- src/plugins/tool/RelCalc.py | 19 ++++++----- 3 files changed, 41 insertions(+), 40 deletions(-) diff --git a/src/plugins/tool/Check.py b/src/plugins/tool/Check.py index c7ce2f1fc..0150dc6d9 100644 --- a/src/plugins/tool/Check.py +++ b/src/plugins/tool/Check.py @@ -1286,11 +1286,9 @@ class CheckIntegrity(object): self.db.get_number_of_places() + self.db.get_number_of_media_objects() + self.db.get_number_of_sources() + - self.db.get_number_of_repositories() - ) + self.db.get_number_of_repositories() ) - self.progress.set_pass(_('Looking for note reference problems'), - total) + self.progress.set_pass(_('Looking for note reference problems'), total ) for handle in self.db.person_map.keys(): self.progress.step() @@ -1475,8 +1473,9 @@ class CheckIntegrity(object): self.text.write(_("%s was removed from the family of %s\n") % (cn, pn)) if plink > 0: - self.text.write(ngettext("%d broken spouse/family link was fixed\n", \ - "%d broken spouse/family links were found\n", plink) % plink) + self.text.write(ngettext("%(quantity)d broken spouse/family link was fixed\n", \ + "%(quantity)d broken spouse/family links were found\n", plink) % { + 'quantity' : plink } for (person_handle, family_handle) in self.broken_parent_links: person = self.db.get_person_from_handle(person_handle) if person: @@ -1492,8 +1491,9 @@ class CheckIntegrity(object): self.text.write(_("%s was restored to the family of %s\n") % (cn, pn)) if slink > 0: - self.text.write(ngettext("%d duplicate spouse/family link was found\n", \ - "%d duplicate spouse/family links were found\n", slink) % slink) + self.text.write(ngettext("%(dup_spouse_family)d duplicate spouse/family link was found\n", \ + "%(dup_spouse_family)d duplicate spouse/family links were found\n", slink) % { + 'dup_spouse_family' : slink } for (person_handle, family_handle) in self.broken_parent_links: person = self.db.get_person_from_handle(person_handle) if person: @@ -1510,9 +1510,10 @@ class CheckIntegrity(object): if efam == 1: self.text.write(_("%d family with no parents or children found, removed.\n")) - self.text.write("\t%s\n" % self.empty_family[0]) + self.text.write("\t%(empty_family)s\n") % {'empty_family' : self.empty_family[0] } elif efam > 1: - self.text.write(_("%d families with no parents or children, removed.\n") % efam) + self.text.write(_("%(amount)d families with no parents or children, removed.\n") % { + 'amount' : efam} if rel: self.text.write(ngettext("%d corrupted family relationship fixed\n", \ @@ -1579,25 +1580,24 @@ class CheckIntegrity(object): "%d invalid name format references were removed\n", name_format) % name_format) if empty_objs > 0 : - self.text.write(_("%d empty objects removed:\n" - " %d person objects\n" - " %d family objects\n" - " %d event objects\n" - " %d source objects\n" - " %d media objects\n" - " %d place objects\n" - " %d repository objects\n" - " %d note objects\n" - ) % (empty_objs, - len(self.empty_objects['persons']), - len(self.empty_objects['families']), - len(self.empty_objects['events']), - len(self.empty_objects['sources']), - len(self.empty_objects['media']), - len(self.empty_objects['places']), - len(self.empty_objects['repos']), - len(self.empty_objects['notes']) - ) ) + self.text.write(_("%(empty_obj)d empty objects removed:\n" + " %(person)d person objects\n" + " %(family)d family objects\n" + " %(event)d event objects\n" + " %(source)d source objects\n" + " %(media)d media objects\n" + " %(place)d place objects\n" + " %(repo)d repository objects\n" + " %(note)d note objects\n" ) % { + 'empty_obj' : empty_objs, + 'person' : len(self.empty_objects['persons']), + 'family' : len(self.empty_objects['families']), + 'event' : len(self.empty_objects['events']), + 'source' : len(self.empty_objects['sources']), + 'media' : len(self.empty_objects['media']), + 'place' : len(self.empty_objects['places']), + 'repo' : len(self.empty_objects['repos']), + 'note' : len(self.empty_objects['notes']) } ) return errors diff --git a/src/plugins/tool/MediaManager.py b/src/plugins/tool/MediaManager.py index 7a91b4e55..3570e4e58 100644 --- a/src/plugins/tool/MediaManager.py +++ b/src/plugins/tool/MediaManager.py @@ -452,8 +452,8 @@ class PathChange(BatchOp): to_text = unicode(self.to_entry.get_text()) text = _( 'The following action is to be performed:\n\n' - 'Operation:\t%s\nReplace:\t\t%s\nWith:\t\t%s' - ) % (self.title.replace('_',''), from_text, to_text) + 'Operation:\t%(title)s\nReplace:\t\t%(source)s\nWith:\t\t%(dest_text)s') % { + 'title' : self.title.replace('_',''), 'source' : from_text, 'dest_text' : to_text } return text def _prepare(self): diff --git a/src/plugins/tool/RelCalc.py b/src/plugins/tool/RelCalc.py index 31cdad624..08c23bebe 100644 --- a/src/plugins/tool/RelCalc.py +++ b/src/plugins/tool/RelCalc.py @@ -43,7 +43,7 @@ import gtk # GRAMPS modules # #------------------------------------------------------------------------- -from gen.display.name import displayer as name_displayer +from gen.display.name import displayer as _nd import ManagedWindow from gui.views.treemodels import PeopleBaseModel, PersonTreeModel from libpersonview import BasePersonView @@ -100,7 +100,7 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow): uistate.get_active('Person')) name = '' if self.person: - name = name_displayer.display(self.person) + name = _nd.display(self.person) self.title = _('Relationship calculator: %(person_name)s' ) % {'person_name' : name} window = self.glade.toplevel @@ -178,14 +178,15 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow): rel_strings, common_an = self.relationship.get_all_relationships( self.db, self.person, other_person) - p1 = name_displayer.display(self.person) - p2 = name_displayer.display(other_person) + p1 = _nd.display(self.person) + p2 = _nd.display(other_person) text = [] if other_person is None: pass elif self.person.handle == other_person.handle: - rstr = _("%s and %s are the same person.") % (p1, p2) + rstr = _("%(person)s and %(active_person)s are the same person.") % { + 'person' : p1, 'active_person' : p2} text.append((rstr, "")) elif len(rel_strings) == 0: rstr = _("%(person)s and %(active_person)s are not related.") % { @@ -202,13 +203,13 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow): if common[0] in [other_person.handle, self.person.handle]: commontext = '' else : - name = name_displayer.display(person) + name = _nd.display(person) commontext = " " + _("Their common ancestor is %s.") % name elif length == 2: p1c = self.db.get_person_from_handle(common[0]) p2c = self.db.get_person_from_handle(common[1]) - p1str = name_displayer.display(p1c) - p2str = name_displayer.display(p2c) + p1str = _nd.display(p1c) + p2str = _nd.display(p2c) commontext = " " + _("Their common ancestors are %s and %s." ) % (p1str,p2str) elif length > 2: @@ -218,7 +219,7 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow): person = self.db.get_person_from_handle(person_handle) if index: commontext += ", " - commontext += name_displayer.display(person) + commontext += _nd.display(person) index += 1 commontext += "." else: