#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 TransUtils import sgettext as _
from gettext import ngettext
from cgi import escape from cgi import escape
import math import math
@ -1393,7 +1394,7 @@ class PedigreeView(PageView.PersonNavView):
size_menu.append(entry) size_menu.append(entry)
for n in range(2,6): 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: if self.force_size == n:
entry.set_image(current_size_image) entry.set_image(current_size_image)
entry.connect("activate", self.change_force_size_cb, n) entry.connect("activate", self.change_force_size_cb, n)

View File

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

View File

@ -31,6 +31,7 @@
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import time import time
from gettext import gettext as _ from gettext import gettext as _
from gettext import ngettext
import csv import csv
import codecs import codecs
import cStringIO import cStringIO
@ -691,7 +692,7 @@ class CSVParser:
else: else:
print "Warning: ignoring line %d" % line_number print "Warning: ignoring line %d" % line_number
t = time.time() - t 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.transaction_commit(self.trans,_("CSV import"))
self.db.enable_signals() self.db.enable_signals()
self.db.request_rebuild() self.db.request_rebuild()

View File

@ -31,6 +31,7 @@
import re import re
import time import time
from gettext import gettext as _ from gettext import gettext as _
from gettext import ngettext
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -177,7 +178,7 @@ class GeneWebParser:
self.errmsg(str(err)) self.errmsg(str(err))
t = time.time() - t 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.transaction_commit(self.trans,_("GeneWeb import"))
self.db.enable_signals() self.db.enable_signals()

View File

@ -31,6 +31,7 @@
import re import re
import time import time
from gettext import gettext as _ from gettext import gettext as _
from gettext import ngettext
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -141,7 +142,7 @@ class VCardParser:
self.errmsg(str(err)) self.errmsg(str(err))
t = time.time() - t 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.transaction_commit(self.trans,_("vCard import"))
self.db.enable_signals() self.db.enable_signals()

View File

@ -30,6 +30,7 @@
#------------------------------------------------------------------------ #------------------------------------------------------------------------
import os import os
from gettext import gettext as _ 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.enable_signals()
self.db.request_rebuild() self.db.request_rebuild()
if modified == 0: msg = ngettext("1 event record was modified.", \
msg = _("No event record was modified.") "%d event records were modified.", modified) % modified
elif modified == 1:
msg = _("1 event record was modified.")
else:
msg = _("%d event records were modified.") % modified
if cli: if cli:
print "Done: ", msg print "Done: ", msg

View File

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