#2657,#1718 use ngettext

svn: r11773
This commit is contained in:
Jérôme Rapinat 2009-01-31 11:29:44 +00:00
parent 3d257ea84a
commit 1e6da8730c
8 changed files with 408 additions and 434 deletions

677
po/fr.po

File diff suppressed because it is too large Load Diff

View File

@ -28,6 +28,7 @@
#
#-------------------------------------------------------------------------
from TransUtils import sgettext as _
from gettext import ngettext
from cgi import escape
import math
@ -1393,7 +1394,7 @@ class PedigreeView(PageView.PersonNavView):
size_menu.append(entry)
for n in range(2,6):
entry = gtk.ImageMenuItem(_("%d generations") % n)
entry = gtk.ImageMenuItem(ngettext("1 generation", "%d generations", n) %n)
if self.force_size == n:
entry.set_image(current_size_image)
entry.connect("activate", self.change_force_size_cb, n)

View File

@ -29,6 +29,7 @@ Relationship View
#
#-------------------------------------------------------------------------
from TransUtils import sgettext as _
from gettext import ngettext
import cgi
#-------------------------------------------------------------------------
@ -790,7 +791,7 @@ class RelationshipView(PageView.PersonNavView):
else:
count = 0
if count > 1 :
childmsg = _(" (%d siblings)") % count
childmsg = ngettext(" (1 sibling)", " (%d siblings)", count) % count
elif count == 1 :
gender = self.dbstate.db.get_person_from_handle(\
child_list[0]).gender
@ -846,7 +847,7 @@ class RelationshipView(PageView.PersonNavView):
else:
count = 0
if count > 1 :
childmsg = _(" (%d siblings)") % count
childmsg = ngettext(" (1 sibling)"," (%d siblings)", count) % count
elif count == 1 :
gender = self.dbstate.db.get_person_from_handle(\
child_list[0]).gender
@ -1265,10 +1266,8 @@ class RelationshipView(PageView.PersonNavView):
count = len(child_list)
else:
count = 0
if count > 1 :
childmsg = _(" (%d children)") % count
elif count == 1 :
childmsg = _(" (1 child)")
if count >= 1 :
childmsg = ngettext(" (1 child)"," (%d children)", count) % count
else :
childmsg = _(" (no children)")
box = self.get_people_box(handle, post_msg=childmsg)
@ -1313,10 +1312,8 @@ class RelationshipView(PageView.PersonNavView):
count = len(child_list)
else:
count = 0
if count > 1 :
childmsg = _(" (%d children)") % count
elif count == 1 :
childmsg = _(" (1 child)")
if count >= 1 :
childmsg = ngettext(" (1 child)"," (%d children)", count) % count
else :
childmsg = _(" (no children)")
box = self.get_people_box(post_msg=childmsg)

View File

@ -31,6 +31,7 @@
#-------------------------------------------------------------------------
import time
from gettext import gettext as _
from gettext import ngettext
import csv
import codecs
import cStringIO
@ -691,7 +692,7 @@ class CSVParser:
else:
print "Warning: ignoring line %d" % line_number
t = time.time() - t
msg = _('Import Complete: %d seconds') % t
msg = ngettext('Import Complete: 1 second','Import Complete: %d seconds', t ) % t
self.db.transaction_commit(self.trans,_("CSV import"))
self.db.enable_signals()
self.db.request_rebuild()

View File

@ -31,6 +31,7 @@
import re
import time
from gettext import gettext as _
from gettext import ngettext
#------------------------------------------------------------------------
#
@ -177,7 +178,7 @@ class GeneWebParser:
self.errmsg(str(err))
t = time.time() - t
msg = _('Import Complete: %d seconds') % t
msg = ngettext('Import Complete: 1 second','Import Complete: %d seconds', t ) % t
self.db.transaction_commit(self.trans,_("GeneWeb import"))
self.db.enable_signals()

View File

@ -31,6 +31,7 @@
import re
import time
from gettext import gettext as _
from gettext import ngettext
#------------------------------------------------------------------------
#
@ -141,7 +142,7 @@ class VCardParser:
self.errmsg(str(err))
t = time.time() - t
msg = _('Import Complete: %d seconds') % t
msg = ngettext('Import Complete: 1 second','Import Complete: %d seconds', t ) % t
self.db.transaction_commit(self.trans,_("vCard import"))
self.db.enable_signals()

View File

@ -30,6 +30,7 @@
#------------------------------------------------------------------------
import os
from gettext import gettext as _
from gettext import ngettext
#------------------------------------------------------------------------
#
@ -138,12 +139,8 @@ class ChangeTypes(Tool.BatchTool, ManagedWindow.ManagedWindow):
self.db.enable_signals()
self.db.request_rebuild()
if modified == 0:
msg = _("No event record was modified.")
elif modified == 1:
msg = _("1 event record was modified.")
else:
msg = _("%d event records were modified.") % modified
msg = ngettext("1 event record was modified.", \
"%d event records were modified.", modified) % modified
if cli:
print "Done: ", msg

View File

@ -33,6 +33,7 @@ import sys
import cStringIO
from gettext import gettext as _
from gettext import ngettext
#------------------------------------------------------------------------
#
@ -1296,10 +1297,8 @@ class CheckIntegrity:
self.text = cStringIO.StringIO()
if blink > 0:
if blink == 1:
self.text.write(_("1 broken child/family link was fixed\n"))
else:
self.text.write(_("%d broken child/family links were found\n") % blink)
self.text.write(ngettext("1 broken child/family link was fixed\n", \
"%d broken child-family links were found\n", blink) % blink)
for (person_handle,family_handle) in self.broken_links:
person = self.db.get_person_from_handle(person_handle)
if person:
@ -1315,10 +1314,8 @@ class CheckIntegrity:
self.text.write(_("%s was removed from the family of %s\n") % (cn,pn))
if plink > 0:
if plink == 1:
self.text.write(_("1 broken spouse/family link was fixed\n"))
else:
self.text.write(_("%d broken spouse/family links were found\n") % plink)
self.text.write(ngettext("1 broken spouse/family link was fixed\n", \
"%d broken spouse/family links were found\n", plink) % plink)
for (person_handle,family_handle) in self.broken_parent_links:
person = self.db.get_person_from_handle(person_handle)
if person:
@ -1334,10 +1331,8 @@ class CheckIntegrity:
self.text.write(_("%s was restored to the family of %s\n") % (cn,pn))
if slink > 0:
if slink == 1:
self.text.write(_("1 duplicate spouse/family link was found\n"))
else:
self.text.write(_("%d duplicate spouse/family links were found\n") % slink)
self.text.write(ngettext("1 duplicate spouse/family link was found\n", \
"%d duplicate spouse/family links were found\n", slink) % slink)
for (person_handle,family_handle) in self.broken_parent_links:
person = self.db.get_person_from_handle(person_handle)
if person:
@ -1358,83 +1353,65 @@ class CheckIntegrity:
elif efam > 1:
self.text.write(_("%d families with no parents or children, removed.\n") % efam)
if rel == 1:
self.text.write(_("1 corrupted family relationship fixed\n"))
elif rel > 1:
self.text.write(_("%d corrupted family relationship fixed\n") % rel)
if rel:
self.text.write(ngettext("1 corrupted family relationship fixed\n", \
"%d corrupted family relationship fixed\n", rel) % rel )
if person_references == 1:
self.text.write(_("1 person was referenced but not found\n"))
elif person_references > 1:
self.text.write(_("%d persons were referenced, but not found\n") % person_references)
if person_references:
self.text.write(ngettext("1 person was referenced but not found\n", \
"%d persons were referenced, but not found\n", person_references) % person_references)
if repo_references == 1:
self.text.write(_("1 repository was referenced but not found\n"))
elif repo_references > 1:
self.text.write(_("%d repositories were referenced, but not found\n") % repo_references)
if repo_references:
self.text.write(ngettext("1 repository was referenced but not found\n", \
"%d repositories were referenced, but not found\n", repo_references) % repo_references)
if photos == 1:
self.text.write(_("1 media object was referenced, but not found\n"))
elif photos > 1:
self.text.write(_("%d media objects were referenced, but not found\n") % photos)
if photos:
self.text.write(ngettext("1 media object was referenced, but not found\n", \
"%d media objects were referenced, but not found\n", photos) % photos)
if bad_photos == 1:
self.text.write(_("Reference to 1 missing media object was kept\n"))
elif bad_photos > 1:
self.text.write(_("References to %d media objects were kept\n") % bad_photos)
if bad_photos:
self.text.write(ngettext("Reference to 1 missing media object was kept\n", \
"References to %d media objects were kept\n", bad_photos) % bad_photos)
if replaced_photos == 1:
self.text.write(_("1 missing media object was replaced\n"))
elif replaced_photos > 1:
self.text.write(_("%d missing media objects were replaced\n") % replaced_photos)
if replaced_photos:
self.text.write(ngettext("1 missing media object was replaced\n", \
"%d missing media objects were replaced\n", replaced_photos) % replaced_photos)
if removed_photos == 1:
self.text.write(_("1 missing media object was removed\n"))
elif removed_photos > 1:
self.text.write(_("%d missing media objects were removed\n") % removed_photos)
if removed_photos:
self.text.write(ngettext("1 missing media object was removed\n", \
"%d missing media objects were removed\n", removed_photos) % removed_photos)
if event_invalid == 1:
self.text.write(_("1 invalid event reference was removed\n"))
elif event_invalid > 1:
self.text.write(_("%d invalid event references were removed\n") % event_invalid)
if event_invalid:
self.text.write(ngettext("1 invalid event reference was removed\n", \
"%d invalid event references were removed\n", event_invalid) % event_invalid)
if birth_invalid == 1:
self.text.write(_("1 invalid birth event name was fixed\n"))
elif birth_invalid > 1:
self.text.write(_("%d invalid birth event names were fixed\n") % birth_invalid)
if birth_invalid:
self.text.write(ngettext("1 invalid birth event name was fixed\n", \
"%d invalid birth event names were fixed\n", birth_invalid) % birth_invalid)
if death_invalid == 1:
self.text.write(_("1 invalid death event name was fixed\n"))
elif death_invalid > 1:
self.text.write(_("%d invalid death event names were fixed\n") % death_invalid)
if death_invalid:
self.text.write(ngettext("1 invalid death event name was fixed\n", \
"%d invalid death event names were fixed\n", death_invalid) % death_invalid)
if place_references == 1:
self.text.write(_("1 place was referenced but not found\n"))
elif place_references > 1:
self.text.write(_("%d places were referenced, but not found\n") % place_references)
if place_references:
self.text.write(ngettext("1 place was referenced but not found\n", \
"%d places were referenced, but not found\n", place_references) % place_references)
if source_references == 1:
self.text.write(_("1 source was referenced but not found\n"))
elif source_references > 1:
self.text.write(_("%d sources were referenced, but not found\n") % source_references)
if source_references:
self.text.write(ngettext("1 source was referenced but not found\n", \
"%d sources were referenced, but not found\n", source_references) % source_references)
if media_references == 1:
self.text.write(_("1 media object was referenced but not found\n"))
elif media_references > 1:
self.text.write(_("%d media objects were referenced, "
"but not found\n") % media_references)
if media_references:
self.text.write(ngettext("1 media object was referenced but not found\n", \
"%d media objects were referenced but not found\n", media_references) % media_references)
if note_references == 1:
self.text.write(_("1 note object was referenced but not found\n"))
elif note_references > 1:
self.text.write(_("%d note objects were referenced, "
"but not found\n") % note_references)
if note_references:
self.text.write(ngettext("1 note object was referenced but not found\n", \
"%d note objects were referenced but not found\n", note_references) % note_references)
if name_format == 1:
self.text.write(_("1 invalid name format reference was removed\n"))
elif name_format > 1:
self.text.write(_("%d invalid name format references were removed\n")
% name_format)
if name_format:
self.text.write(ngettext("1 invalid name format reference was removed\n", \
"%d invalid name format references were removed\n", name_format) % name_format)
if empty_objs > 0 :
self.text.write(_("%d empty objects removed:\n"