#2657,#1718 use ngettext

svn: r11800
This commit is contained in:
Jérôme Rapinat 2009-02-02 17:13:02 +00:00
parent 1ecbaae622
commit e4f5ad0142
7 changed files with 1386 additions and 1328 deletions

2685
po/fr.po

File diff suppressed because it is too large Load Diff

View File

@ -692,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 = ngettext('Import Complete: 1 second','Import Complete: %d seconds', t ) % t msg = ngettext('Import Complete: %d 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

@ -178,7 +178,7 @@ class GeneWebParser:
self.errmsg(str(err)) self.errmsg(str(err))
t = time.time() - t t = time.time() - t
msg = ngettext('Import Complete: 1 second','Import Complete: %d seconds', t ) % t msg = ngettext('Import Complete: %d 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

@ -142,7 +142,7 @@ class VCardParser:
self.errmsg(str(err)) self.errmsg(str(err))
t = time.time() - t t = time.time() - t
msg = ngettext('Import Complete: 1 second','Import Complete: %d seconds', t ) % t msg = ngettext('Import Complete: %d 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

@ -32,6 +32,7 @@ import DateHandler
import posixpath import posixpath
from gettext import gettext as _ from gettext import gettext as _
from gettext import ngettext
# force translation # force translation
[_('all people'), _('males'), _('females'), _('people with unknown gender'), [_('all people'), _('males'), _('females'), _('people with unknown gender'),
@ -216,7 +217,9 @@ def run(database, document, filter_name, *args, **kwargs):
matches += 1 matches += 1
else: else:
raise AttributeError, ("invalid filter name: '%s'" % filter_name) raise AttributeError, ("invalid filter name: '%s'" % filter_name)
sdoc.paragraph(_("Filter matched %d records.") % matches) sdoc.paragraph(ngettext("Filter matched %d record."
,
"Filter matched %d records.", matches) % matches)
sdoc.paragraph("") sdoc.paragraph("")
if matches > 0: if matches > 0:
stab.write(sdoc) stab.write(sdoc)

View File

@ -26,6 +26,7 @@ Display a people who have a person's same surname or given name
from Simple import SimpleAccess, SimpleDoc, SimpleTable from Simple import SimpleAccess, SimpleDoc, SimpleTable
from gettext import gettext as _ from gettext import gettext as _
from gettext import ngettext
from gen.plug import PluginManager from gen.plug import PluginManager
import gen.lib import gen.lib
from ReportBase import CATEGORY_QR_PERSON, CATEGORY_QR_MISC from ReportBase import CATEGORY_QR_PERSON, CATEGORY_QR_MISC
@ -118,7 +119,10 @@ def run(database, document, person):
stab.row(person, sdb.birth_date_obj(person), stab.row(person, sdb.birth_date_obj(person),
str(person.get_primary_name().get_type())) str(person.get_primary_name().get_type()))
matches += 1 matches += 1
sdoc.paragraph(_("There are %d people with a matching name, or alternate name.\n") % matches) sdoc.paragraph(ngettext("There is %d person with a matching name, or alternate name.\n"
,
"There are %d people with a matching name, or alternate name.\n"
, matches) % matches)
stab.write(sdoc) stab.write(sdoc)
def run_given(database, document, person): def run_given(database, document, person):
@ -154,7 +158,10 @@ def run_given(database, document, person):
stab.row(person, sdb.birth_date_obj(person), stab.row(person, sdb.birth_date_obj(person),
str(person.get_primary_name().get_type())) str(person.get_primary_name().get_type()))
matches += 1 matches += 1
sdoc.paragraph(_("There are %d people with a matching name, or alternate name.\n") % matches) sdoc.paragraph(ngettext("There is %d person with a matching name, or alternate name.\n"
,
"There are %d people with a matching name, or alternate name.\n"
, matches) % matches)
stab.write(sdoc) stab.write(sdoc)
#------------------------------------------------------------------------ #------------------------------------------------------------------------

View File

@ -139,8 +139,11 @@ class ChangeTypes(Tool.BatchTool, ManagedWindow.ManagedWindow):
self.db.enable_signals() self.db.enable_signals()
self.db.request_rebuild() self.db.request_rebuild()
msg = ngettext("1 event record was modified.", \ if modified == 0:
"%d event records were modified.", modified) % modified msg = _("No event record was modified.")
else:
msg = ngettext("%d event record was modified."
, "%d event records were modified.", modified) % modified
if cli: if cli:
print "Done: ", msg print "Done: ", msg