Adding named variables to format strings for errors in 'make distcheck' to work.

svn: r14454
This commit is contained in:
Rob G. Healey 2010-02-24 22:54:03 +00:00
parent 69e08ceafb
commit 51ff6e4569

View File

@ -1453,13 +1453,13 @@ class CheckIntegrity(object):
_('The database has passed internal checks'),
parent=uistate.window)
else:
print "No errors were found: the database has passed internal checks."
print("No errors were found: the database has passed internal checks.")
return 0
self.text = cStringIO.StringIO()
if blink > 0:
self.text.write(ngettext("%d broken child/family link was fixed\n", \
"%d broken child-family links were found\n", blink) % blink)
self.text.write(ngettext("%(quantity)d broken child/family link was fixed\n", \
"%(quantity)d broken child-family links were found\n", blink)) % ('quantity' : blink }
for (person_handle, family_handle) in self.broken_links:
person = self.db.get_person_from_handle(person_handle)
if person:
@ -1472,11 +1472,12 @@ class CheckIntegrity(object):
except:
pn = _("Unknown")
self.text.write('\t')
self.text.write(_("%s was removed from the family of %s\n") % (cn, pn))
self.text.write(_("%(person)s was removed from the family of %(family)s\n")) % {
'person' : cn, 'family' : 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:
@ -1489,11 +1490,12 @@ class CheckIntegrity(object):
else:
pn = family_handle
self.text.write('\t')
self.text.write(_("%s was restored to the family of %s\n") % (cn, pn))
self.text.write(_("%(person)s was restored to the family of %(family)s\n")) % {
'person' : cn, 'family' : 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("%(quantity)d duplicate spouse/family link was found\n", \
"%(quantity)d duplicate spouse/family links were found\n", slink)) % { 'quantity' : slink }
for (person_handle, family_handle) in self.broken_parent_links:
person = self.db.get_person_from_handle(person_handle)
if person:
@ -1506,98 +1508,111 @@ class CheckIntegrity(object):
else:
pn = _("None")
self.text.write('\t')
self.text.write(_("%s was restored to the family of %s\n") % (cn, pn))
self.text.write(_("%(person)s was restored to the family of %(family)s\n")) % {
'person' : cn, 'family' : pn }
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])
elif efam > 1:
self.text.write(_("%d families with no parents or children, removed.\n") % efam)
self.text.write(_("%(quantity)d families with no parents or children, removed.\n")) % {
'quantity' : efam }
if rel:
self.text.write(ngettext("%d corrupted family relationship fixed\n", \
"%d corrupted family relationship fixed\n", rel) % rel )
self.text.write(ngettext("%(quantity)d corrupted family relationship fixed\n", \
"%(quantity)d corrupted family relationship fixed\n", rel)) % { 'quantity' : rel }
if person_references:
self.text.write(ngettext("%d person was referenced but not found\n", \
"%d persons were referenced, but not found\n", person_references) % person_references)
self.text.write(ngettext("%(quantity)d person was referenced but not found\n", \
"%(quantity)d persons were referenced, but not found\n", person_references)) % {
'quantity' : person_references }
if invalid_dates:
self.text.write(ngettext("%d date was corrected\n", \
"%d dates were corrected\n", invalid_dates) % invalid_dates)
self.text.write(ngettext("%(quantity)d date was corrected\n", \
"%(quantity)d dates were corrected\n", invalid_dates)) % { 'quantity' : invalid_dates }
if repo_references:
self.text.write(ngettext("%d repository was referenced but not found\n", \
"%d repositories were referenced, but not found\n", repo_references) % repo_references)
self.text.write(ngettext("%(quantity)d repository was referenced but not found\n", \
"%(quantity)d repositories were referenced, but not found\n", repo_references)) % {
'quantity' : repo_references }
if photos:
self.text.write(ngettext("%d media object was referenced, but not found\n", \
"%d media objects were referenced, but not found\n", photos) % photos)
self.text.write(ngettext("%(quantity)d media object was referenced, but not found\n", \
"%(quantity)d media objects were referenced, but not found\n", photos)) % { 'quantity' : photos }
if bad_photos:
self.text.write(ngettext("Reference to %d missing media object was kept\n", \
"References to %d media objects were kept\n", bad_photos) % bad_photos)
self.text.write(ngettext("Reference to %(quantity)d missing media object was kept\n", \
"References to %(quantity)d media objects were kept\n", bad_photos)) % {
'quantity' : bad_photos }
if replaced_photos:
self.text.write(ngettext("%d missing media object was replaced\n", \
"%d missing media objects were replaced\n", replaced_photos) % replaced_photos)
self.text.write(ngettext("%(quantity)d missing media object was replaced\n", \
"%(quantity)d missing media objects were replaced\n", replaced_photos)) % {
'quantity' : replaced_photos }
if removed_photos:
self.text.write(ngettext("%d missing media object was removed\n", \
"%d missing media objects were removed\n", removed_photos) % removed_photos)
self.text.write(ngettext("%(quantity)d missing media object was removed\n", \
"%(quantity)d missing media objects were removed\n", removed_photos)) % {
'quantity' : removed_photos }
if event_invalid:
self.text.write(ngettext("%d invalid event reference was removed\n", \
"%d invalid event references were removed\n", event_invalid) % event_invalid)
self.text.write(ngettext("%(quantity)d invalid event reference was removed\n", \
"%(quantity)d invalid event references were removed\n", event_invalid)) % {
'quantity' : event_invalid }
if birth_invalid:
self.text.write(ngettext("%d invalid birth event name was fixed\n", \
"%d invalid birth event names were fixed\n", birth_invalid) % birth_invalid)
self.text.write(ngettext("%(quantity)d invalid birth event name was fixed\n", \
"%(quantity)d invalid birth event names were fixed\n", birth_invalid)) % {
'quantity' : birth_invalid }
if death_invalid:
self.text.write(ngettext("%d invalid death event name was fixed\n", \
"%d invalid death event names were fixed\n", death_invalid) % death_invalid)
self.text.write(ngettext("%(quantity)d invalid death event name was fixed\n", \
"%(quantity)d invalid death event names were fixed\n", death_invalid)) % {
'quantity' : death_invalid }
if place_references:
self.text.write(ngettext("%d place was referenced but not found\n", \
"%d places were referenced, but not found\n", place_references) % place_references)
self.text.write(ngettext("%(quantity)d place was referenced but not found\n", \
"%(quantity)d places were referenced, but not found\n", place_references)) % {
'quantity' : place_references }
if source_references:
self.text.write(ngettext("%d source was referenced but not found\n", \
"%d sources were referenced, but not found\n", source_references) % source_references)
self.text.write(ngettext("%(quantity)d source was referenced but not found\n", \
"%(quantity)d sources were referenced, but not found\n", source_references)) % {
'quantity' : source_references }
if media_references:
self.text.write(ngettext("%d media object was referenced but not found\n", \
"%d media objects were referenced but not found\n", media_references) % media_references)
if note_references:
self.text.write(ngettext("%d note object was referenced but not found\n", \
"%d note objects were referenced but not found\n", note_references) % note_references)
self.text.write(ngettext("%(quantity)d note object was referenced but not found\n", \
"%(quantity)d note objects were referenced but not found\n", note_references)) % {
'quantity' : note_references }
if name_format:
self.text.write(ngettext("%d invalid name format reference was removed\n", \
"%d invalid name format references were removed\n", name_format) % name_format)
self.text.write(ngettext("%(quantity)d invalid name format reference was removed\n", \
"%(quantity)d invalid name format references were removed\n", name_format)) % {
'quantity' : 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