7596: Translation of plurals does not allow the translator to omit the number

This commit is contained in:
Paul Franklin 2014-04-14 19:17:26 -07:00
parent 99cfe782da
commit f3e378a76a
20 changed files with 333 additions and 203 deletions

View File

@ -404,12 +404,15 @@ class Span(object):
"""
trans_text = dlocale.translation.sgettext
# trans_text is a defined keyword (see po/update_po.py, po/genpot.sh)
ngettext = dlocale.translation.ngettext
ngettext = dlocale.translation.ngettext # to see "nearby" comments
if diff_tuple == (-1, -1, -1): return trans_text("unknown")
retval = ""
detail = 0
if diff_tuple[0] != 0:
retval += ngettext("%d year", "%d years", diff_tuple[0]) % diff_tuple[0]
# translators: leave all/any {...} untranslated
retval += ngettext("{number_of} year", "{number_of} years",
diff_tuple[0]
).format(number_of=diff_tuple[0])
detail += 1
if self.precision == detail:
return retval
@ -417,7 +420,10 @@ class Span(object):
if retval != "":
# translators: needed for Arabic, ignore otherwise
retval += trans_text(", ")
retval += ngettext("%d month", "%d months", diff_tuple[1]) % diff_tuple[1]
# translators: leave all/any {...} untranslated
retval += ngettext("{number_of} month", "{number_of} months",
diff_tuple[1]
).format(number_of=diff_tuple[1])
detail += 1
if self.precision == detail:
return retval
@ -425,7 +431,10 @@ class Span(object):
if retval != "":
# translators: needed for Arabic, ignore otherwise
retval += trans_text(", ")
retval += ngettext("%d day", "%d days", diff_tuple[2]) % diff_tuple[2]
# translators: leave all/any {...} untranslated
retval += ngettext("{number_of} day", "{number_of} days",
diff_tuple[2]
).format(number_of=diff_tuple[2])
detail += 1
if self.precision == detail:
return retval

View File

@ -57,11 +57,12 @@ from gi.repository import GObject
# GRAMPS modules
#
#-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
ngettext = glocale.translation.ngettext # else "nearby" comments are ignored
from ..managedwindow import ManagedWindow
from gramps.gen.errors import UnavailableError, WindowActiveError
from gramps.gen.plug import PluginRegister, PTYPE_STR, load_addon_file
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
from ..utils import open_file_with_default_application
from ..pluginmanager import GuiPluginManager
from . import tool
@ -1203,9 +1204,10 @@ class UpdateAddons(ManagedWindow):
longop.end()
if count:
OkDialog(_("Done downloading and installing addons"),
"%s %s" % (glocale.translation.ngettext("%d addon was installed.",
"%d addons were installed.",
count) % count,
# translators: leave all/any {...} untranslated
"%s %s" % (ngettext("{number_of} addon was installed.",
"{number_of} addons were installed.",
count).format(number_of=count),
_("You need to restart Gramps to see new views.")),
self.window)
else:

View File

@ -37,7 +37,7 @@
#-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
ngettext = glocale.translation.ngettext
ngettext = glocale.translation.ngettext # else "nearby" comments are ignored
from gramps.gen.config import config
from gramps.gen.display.name import displayer as name_displayer
from gramps.gen.filters import GenericFilter, rules
@ -147,8 +147,10 @@ class WriterOptionBox(object):
full_database_row = Gtk.HBox()
full_database_row.pack_start(Gtk.Label(_("Unfiltered Family Tree:")), True, True, 0)
people_count = len(self.dbstate.db.get_person_handles())
button = Gtk.Button(ngettext("%d Person", "%d People", people_count) %
people_count)
# translators: leave all/any {...} untranslated
button = Gtk.Button(ngettext("{number_of} Person",
"{number_of} People", people_count
).format(number_of=people_count) )
button.set_tooltip_text(_("Click to see preview of unfiltered data"))
button.set_size_request(107, -1)
button.connect("clicked", self.show_preview_data)
@ -251,7 +253,10 @@ class WriterOptionBox(object):
# Make a box and put the option in it:
from gi.repository import Gtk
from ...widgets import SimpleButton
button = Gtk.Button(ngettext("%d Person", "%d People", 0) % 0)
# translators: leave all/any {...} untranslated
button = Gtk.Button(ngettext("{number_of} Person",
"{number_of} People", 0
).format(number_of=0) )
button.set_size_request(107, -1)
button.connect("clicked", self.show_preview_data)
button.proxy_name = proxy_name
@ -547,8 +552,10 @@ class WriterOptionBox(object):
self.preview_proxy_button[proxy_name].set_sensitive(1)
people_count = len(dbase.get_person_handles())
self.preview_proxy_button[proxy_name].set_label(
ngettext("%d Person", "%d People", people_count) %
people_count)
# translators: leave all/any {...} untranslated
ngettext("{number_of} Person",
"{number_of} People", people_count
).format(number_of=people_count) )
return dbase
def apply_proxy(self, proxy_name, dbase, progress=None):

View File

@ -314,7 +314,7 @@ class Calendar(Report):
db.get_number_of_people()) as step:
people = self.filter.apply(self.database, people, step)
ngettext = self._locale.translation.ngettext
ngettext = self._locale.translation.ngettext # to see "nearby" comments
with self._user.progress(_('Calendar Report'),
_('Reading database...'),
@ -365,10 +365,11 @@ class Calendar(Report):
text = self._('%(person)s, birth') % {
'person' : short_name }
else:
text = (ngettext('%(person)s, %(age)d',
'%(person)s, %(age)d', nyears)
% {'person' : short_name,
'age' : nyears })
# translators: leave all/any {...} untranslated
text = ngettext('{person}, {age}',
'{person}, {age}',
nyears).format(person=short_name,
age=nyears)
self.add_day_item(text, month, day, marks=[mark])
if self.anniversaries:
family_list = person.get_family_handle_list()
@ -426,11 +427,10 @@ class Calendar(Report):
'person' : short_name,
}
else:
text = (ngettext("%(spouse)s and\n %(person)s, %(nyears)d",
"%(spouse)s and\n %(person)s, %(nyears)d", nyears)
% {'spouse' : spouse_name,
'person' : short_name,
'nyears' : nyears})
# translators: leave all/any {...} untranslated
text = ngettext("{spouse} and\n {person}, {nyears}",
"{spouse} and\n {person}, {nyears}",
nyears).format(spouse=spouse_name, person=short_name, nyears=nyears)
alive1 = probably_alive(person,
self.database,

View File

@ -33,9 +33,10 @@ import cgi
# GRAMPS modules
#
#------------------------------------------------------------------------
from gramps.gen.plug import Gramplet
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext
ngettext = glocale.translation.ngettext # else "nearby" comments are ignored
from gramps.gen.plug import Gramplet
from gramps.gen.display.name import displayer as name_displayer
from gramps.gen.datehandler import get_date
from gramps.gen.lib import EventType
@ -267,16 +268,22 @@ class PedigreeGramplet(Gramplet):
self.link(_("Generation %d") % g, 'PersonList', handles,
tooltip=_("Double-click to see people in generation %d") % g)
percent = glocale.format('%.2f', float(count)/2**(g-1) * 100) + percent_sign
self.append_text(glocale.translation.ngettext(
" has %(count_person)d of %(max_count_person)d individuals (%(percent)s complete)\n",
" has %(count_person)d of %(max_count_person)d individuals (%(percent)s complete)\n",
2**(g-1)) % {'count_person': count, 'max_count_person': 2**(g-1), 'percent': percent})
self.append_text(
# translators: leave all/any {...} untranslated
ngettext(" has {count_person} of {max_count_person} "
"individuals ({percent} complete)\n",
" has {count_person} of {max_count_person} "
"individuals ({percent} complete)\n", 2**(g-1)
).format(count_person=count,
max_count_person=2**(g-1),
percent=percent) )
self.link(_("All generations"), 'PersonList', all,
tooltip=_("Double-click to see all generations"))
self.append_text(glocale.translation.ngettext(
" have %d individual\n",
" have %d individuals\n",
len(all)) % len(all))
self.append_text(
# translators: leave all/any {...} untranslated
ngettext(" have {number_of} individual\n",
" have {number_of} individuals\n", len(all)
).format(number_of=len(all)) )
# Set to a fixed font
if self.box_mode == "UTF":
start, end = self.gui.buffer.get_bounds()

View File

@ -895,6 +895,7 @@ class FamilyLinesReport(Report):
def writeFamilies(self):
self.doc.add_comment('')
ngettext = self._locale.translation.ngettext # to see "nearby" comments
# loop through all the families we need to output
for family_handle in self._families:
@ -936,8 +937,10 @@ class FamilyLinesReport(Report):
if self._incchildcount:
child_count = len(family.get_child_ref_list())
if child_count >= 1:
childrenStr = self._locale.translation.ngettext(
"%d child", "%d children", child_count) % child_count
# translators: leave all/any {...} untranslated
childrenStr = ngettext("{number_of} child",
"{number_of} children", child_count
).format(number_of=child_count)
label = ''
if weddingDate:

View File

@ -50,6 +50,7 @@ LOG = logging.getLogger(".ImportCSV")
#-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext
ngettext = glocale.translation.ngettext # else "nearby" comments are ignored
from gramps.gen.lib import ChildRef, Citation, Event, EventRef, EventType, Family, FamilyRelType, Name, NameType, Note, NoteType, Person, Place, Source, Surname, Tag
from gramps.gen.db import DbTxn
from gramps.gen.plug.utils import OpenFileOrStdin
@ -340,8 +341,10 @@ class CSVParser(object):
self.db.enable_signals()
self.db.request_rebuild()
tym = time.time() - tym
msg = glocale.translation.ngettext('Import Complete: %d second',
'Import Complete: %d seconds', tym ) % tym
# translators: leave all/any {...} untranslated
msg = ngettext('Import Complete: {number_of} second',
'Import Complete: {number_of} seconds', tym
).format(number_of=tym)
LOG.debug(msg)
LOG.debug("New Families: %d" % self.fam_count)
LOG.debug("New Individuals: %d" % self.indi_count)

View File

@ -32,8 +32,6 @@ from __future__ import print_function
import re
import time
import sys
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#------------------------------------------------------------------------
#
@ -48,6 +46,9 @@ LOG = logging.getLogger(".ImportGeneWeb")
# GRAMPS modules
#
#-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
ngettext = glocale.translation.ngettext # else "nearby" comments are ignored
from gramps.gen.errors import GedcomError
from gramps.gen.lib import (Attribute, AttributeType, ChildRef, Citation,
Date, DateError, Event, EventRef, EventRoleType, EventType,
@ -190,7 +191,10 @@ class GeneWebParser(object):
self.errmsg(str(err))
t = time.time() - t
msg = glocale.translation.ngettext('Import Complete: %d second','Import Complete: %d seconds', t ) % t
# translators: leave all/any {...} untranslated
msg = ngettext('Import Complete: {number_of} second',
'Import Complete: {number_of} seconds', t
).format(number_of=t)
self.db.enable_signals()
self.db.request_rebuild()

View File

@ -30,8 +30,6 @@
import sys
import re
import time
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#------------------------------------------------------------------------
#
@ -46,6 +44,9 @@ LOG = logging.getLogger(".ImportVCard")
# GRAMPS modules
#
#-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
ngettext = glocale.translation.ngettext # else "nearby" comments are ignored
from gramps.gen.errors import GrampsImportError
from gramps.gen.lib import (Address, Date, DateError, Event, EventRef,
EventType, Name, NameType, Person, Surname, Url, UrlType)
@ -227,8 +228,10 @@ class VCardParser(object):
self.database.enable_signals()
self.database.request_rebuild()
tym = time.time() - tym
msg = glocale.translation.ngettext('Import Complete: %d second',
'Import Complete: %d seconds', tym ) % tym
# translators: leave all/any {...} untranslated
msg = ngettext('Import Complete: {number_of} second',
'Import Complete: {number_of} seconds', tym
).format(number_of=tym)
LOG.debug(msg)
def _parse_vCard_file(self, filehandle):

View File

@ -38,6 +38,7 @@ import posixpath
from collections import defaultdict
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext
ngettext = glocale.translation.ngettext # else "nearby" comments are ignored
fname_map = {'all': _('Filtering_on|all'),
'Inverse Person': _('Filtering_on|Inverse Person'),
@ -392,9 +393,10 @@ def run(database, document, filter_name, *args, **kwargs):
else:
raise AttributeError("invalid filter name: '%s'" % filter_name)
sdoc.paragraph(glocale.translation.ngettext("Filter matched %d record."
,
"Filter matched %d records.", matches) % matches)
# translators: leave all/any {...} untranslated
sdoc.paragraph(ngettext("Filter matched {number_of} record.",
"Filter matched {number_of} records.", matches
).format(number_of=matches) )
sdoc.paragraph("")
document.has_data = matches > 0
if matches > 0:

View File

@ -27,10 +27,11 @@
Display a people who have a person's same surname or given name.
"""
from gramps.gen.simple import SimpleAccess, SimpleDoc
from gramps.gui.plug.quick import QuickTable
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
ngettext = glocale.translation.ngettext # else "nearby" comments are ignored
from gramps.gen.simple import SimpleAccess, SimpleDoc
from gramps.gui.plug.quick import QuickTable
from gramps.gen.lib import Person
from gramps.gen.filters.rules import Rule
from gramps.gen.filters import GenericFilterFactory
@ -131,10 +132,13 @@ def run(database, document, person):
matches += 1
document.has_data = matches > 0
sdoc.paragraph(glocale.translation.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)
sdoc.paragraph(
# translators: leave all/any {...} untranslated
ngettext("There is {number_of} person "
"with a matching name, or alternate name.\n",
"There are {number_of} people "
"with a matching name, or alternate name.\n", matches
).format(number_of=matches) )
stab.write(sdoc)
def run_given(database, document, person):
@ -173,8 +177,11 @@ def run_given(database, document, person):
matches += 1
document.has_data = matches > 0
sdoc.paragraph(glocale.translation.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)
sdoc.paragraph(
# translators: leave all/any {...} untranslated
ngettext("There is {number_of} person "
"with a matching name, or alternate name.\n",
"There are {number_of} people "
"with a matching name, or alternate name.\n", matches
).format(number_of=matches) )
stab.write(sdoc)

View File

@ -266,7 +266,7 @@ class BirthdayReport(Report):
rel_calc = get_relationship_calculator(reinit=True,
clocale=self._locale)
ngettext = self._locale.translation.ngettext
ngettext = self._locale.translation.ngettext # to see "nearby" comments
with self._user.progress(_('Birthday and Anniversary Report'),
_('Reading database...'), len(people)) as step:
@ -330,11 +330,12 @@ class BirthdayReport(Report):
'person' : short_name,
'relation' : comment}
else:
text = (ngettext('%(person)s, %(age)d%(relation)s',
'%(person)s, %(age)d%(relation)s', nyears)
% {'person' : short_name,
'age' : nyears,
'relation' : comment})
# translators: leave all/any {...} untranslated
text = ngettext('{person}, {age}{relation}',
'{person}, {age}{relation}',
nyears).format(person=short_name,
age=nyears,
relation=comment)
self.add_day_item(text, month, day, person)
if self.anniversaries:
@ -382,11 +383,10 @@ class BirthdayReport(Report):
'spouse' : spouse_name,
'person' : short_name}
else:
text = (ngettext("%(spouse)s and\n %(person)s, %(nyears)d",
"%(spouse)s and\n %(person)s, %(nyears)d", nyears)
% {'spouse' : spouse_name,
'person' : short_name,
'nyears' : nyears})
# translators: leave all/any {...} untranslated
text = ngettext("{spouse} and\n {person}, {nyears}",
"{spouse} and\n {person}, {nyears}",
nyears).format(spouse=spouse_name, person=short_name, nyears=nyears)
prob_alive_date = Date(self.year, month, day)
alive1 = probably_alive(person, self.database,

View File

@ -101,6 +101,7 @@ class NumberOfAncestorsReport(Report):
all_people = {}
total_theoretical = 0
thisgen[self.__person.get_handle()]=1
ngettext = self._locale.translation.ngettext # to see "nearby" comments
self.doc.start_paragraph("NOA-Title")
name = self._name_display.display(self.__person)
@ -124,15 +125,13 @@ class NumberOfAncestorsReport(Report):
# TC # English return something like:
# Generation 3 has 2 individuals. (50.00%)
text = self._locale.translation.ngettext(
"Generation %(generation)d has %(count)d individual. "
"%(percent)s",
"Generation %(generation)d has %(count)d individuals. "
"%(percent)s",
thisgensize) % {
'generation': gen,
'count': thisgensize,
'percent': percent}
# translators: leave all/any {...} untranslated
text = ngettext(
"Generation {number} has {count} individual. {percent}",
"Generation {number} has {count} individuals. {percent}",
thisgensize).format(number=gen,
count=thisgensize,
percent=percent)
self.doc.start_paragraph('NOA-Normal')
self.doc.write_text(text)

View File

@ -36,9 +36,10 @@ from __future__ import print_function
# GRAMPS modules
#
#------------------------------------------------------------------------
from gramps.gui.utils import ProgressMeter
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
ngettext = glocale.translation.ngettext # else "nearby" comments are ignored
from gramps.gui.utils import ProgressMeter
from gramps.gui.managedwindow import ManagedWindow
from gramps.gui.autocomp import fill_combo
from gramps.gen.lib import EventType
@ -130,8 +131,10 @@ class ChangeTypes(tool.BatchTool, ManagedWindow):
if modified == 0:
msg = _("No event record was modified.")
else:
msg = glocale.translation.ngettext("%d event record was modified."
, "%d event records were modified.", modified) % modified
# translators: leave all/any {...} untranslated
msg = ngettext("{number_of} event record was modified.",
"{number_of} event records were modified.", modified
).format(number_of=modified)
self.user.info(_('Change types'), msg, parent_window)
return (bool(modified),msg)

View File

@ -60,6 +60,9 @@ from gi.repository import Gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
ngettext = glocale.translation.ngettext # else "nearby" comments are ignored
from gramps.gen.lib import (Citation, Event, EventType, Family, MediaObject,
Name, Note, Person, Place, Repository, Source,
StyledText, Tag)
@ -77,9 +80,6 @@ from gramps.gui.dialog import OkDialog, MissingMediaDialog
from gramps.gen.display.name import displayer as _nd
from gramps.gui.glade import Glade
from gramps.gen.constfunc import UNITYPE, cuni, handle2internal
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
ngettext = glocale.translation.ngettext
# table for handling control chars in notes.
# All except 09, 0A, 0D are replaced with space.
@ -2103,10 +2103,11 @@ class CheckIntegrity(object):
self.text = StringIO()
if blink > 0:
self.text.write(
ngettext("%(quantity)d broken child/family link was fixed\n",
"%(quantity)d broken child-family links were fixed\n",
blink) % {'quantity': blink}
)
# translators: leave all/any {...} untranslated
ngettext("{quantity} broken child/family link was fixed\n",
"{quantity} broken child/family links were fixed\n",
blink).format(quantity=blink)
)
for (person_handle, family_handle) in self.broken_links:
person = self.db.get_person_from_handle(person_handle)
if person:
@ -2126,9 +2127,10 @@ class CheckIntegrity(object):
if plink > 0:
self.text.write(
ngettext("%(quantity)d broken spouse/family link was fixed\n",
"%(quantity)d broken spouse/family links were fixed\n",
plink) % {'quantity' : plink}
# translators: leave all/any {...} untranslated
ngettext("{quantity} broken spouse/family link was fixed\n",
"{quantity} broken spouse/family links were fixed\n",
plink).format(quantity=plink)
)
for (person_handle, family_handle) in self.broken_parent_links:
person = self.db.get_person_from_handle(person_handle)
@ -2149,9 +2151,12 @@ class CheckIntegrity(object):
if slink > 0:
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}
# translators: leave all/any {...} untranslated
ngettext("{quantity} duplicate "
"spouse/family link was found\n",
"{quantity} duplicate "
"spouse/family links were found\n",
slink).format(quantity=slink)
)
for (person_handle, family_handle) in self.broken_parent_links:
person = self.db.get_person_from_handle(person_handle)
@ -2183,143 +2188,195 @@ class CheckIntegrity(object):
if rel:
self.text.write(
ngettext("%d corrupted family relationship fixed\n",
"%d corrupted family relationship fixed\n",
rel) % rel
# translators: leave all/any {...} untranslated
ngettext("{quantity} corrupted family relationship fixed\n",
"{quantity} corrupted family relationships fixed\n",
rel).format(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
# translators: leave all/any {...} untranslated
ngettext(
"{quantity} person was referenced but not found\n",
"{quantity} persons were referenced, but not found\n",
person_references).format(quantity=person_references)
)
if family_references:
self.text.write(
ngettext("%d family was referenced but not found\n",
"%d families were referenced, but not found\n",
family_references) % family_references
# translators: leave all/any {...} untranslated
ngettext("{quantity} family was "
"referenced but not found\n",
"{quantity} families were "
"referenced, but not found\n",
family_references).format(quantity=family_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(
# translators: leave all/any {...} untranslated
ngettext("{quantity} date was corrected\n",
"{quantity} dates were corrected\n",
invalid_dates).format(quantity=invalid_dates)
)
if 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})
# translators: leave all/any {...} untranslated
ngettext(
"{quantity} repository was "
"referenced but not found\n",
"{quantity} repositories were "
"referenced, but not found\n",
repo_references).format(quantity=repo_references)
)
if 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}
# translators: leave all/any {...} untranslated
ngettext("{quantity} media object was "
"referenced but not found\n",
"{quantity} media objects were "
"referenced, but not found\n",
photos).format(quantity=photos)
)
if 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}
# translators: leave all/any {...} untranslated
ngettext(
"Reference to {quantity} missing media object was kept\n",
"References to {quantity} media objects were kept\n",
bad_photos).format(quantity=bad_photos)
)
if 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}
# translators: leave all/any {...} untranslated
ngettext("{quantity} missing media object was replaced\n",
"{quantity} missing media objects were replaced\n",
replaced_photos).format(quantity=replaced_photos)
)
if 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}
# translators: leave all/any {...} untranslated
ngettext("{quantity} missing media object was removed\n",
"{quantity} missing media objects were removed\n",
removed_photos).format(quantity=removed_photos)
)
if event_invalid:
self.text.write(
ngettext("%(quantity)d event was referenced but not found\n",
"%(quantity)d events were referenced, but not found\n",
event_invalid) % {'quantity': event_invalid}
# translators: leave all/any {...} untranslated
ngettext("{quantity} event was referenced but not found\n",
"{quantity} events were referenced, but not found\n",
event_invalid).format(quantity=event_invalid)
)
if 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}
# translators: leave all/any {...} untranslated
ngettext("{quantity} invalid birth event name was fixed\n",
"{quantity} invalid birth event names were fixed\n",
birth_invalid).format(quantity=birth_invalid)
)
if 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}
# translators: leave all/any {...} untranslated
ngettext("{quantity} invalid death event name was fixed\n",
"{quantity} invalid death event names were fixed\n",
death_invalid).format(quantity=death_invalid)
)
if 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}
# translators: leave all/any {...} untranslated
ngettext("{quantity} place was referenced but not found\n",
"{quantity} places were referenced, but not found\n",
place_references).format(quantity=place_references)
)
if citation_references:
self.text.write(
ngettext("%(quantity)d citation was referenced but not found\n",
"%(quantity)d citations were referenced, but not found\n",
citation_references) % {'quantity': citation_references}
# translators: leave all/any {...} untranslated
ngettext("{quantity} citation was "
"referenced but not found\n",
"{quantity} citations were "
"referenced, but not found\n",
citation_references
).format(quantity=citation_references)
)
if 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}
# translators: leave all/any {...} untranslated
ngettext("{quantity} source was "
"referenced but not found\n",
"{quantity} sources were "
"referenced, but not found\n",
source_references).format(quantity=source_references)
)
if media_references:
self.text.write(
ngettext("%(quantity)d media object was referenced but not found\n",
"%(quantity)d media objects were referenced but not found\n",
media_references) % {'quantity': media_references}
# translators: leave all/any {...} untranslated
ngettext("{quantity} media object was "
"referenced but not found\n",
"{quantity} media objects were "
"referenced, but not found\n",
media_references).format(quantity=media_references)
)
if 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})
# translators: leave all/any {...} untranslated
ngettext("{quantity} note object was "
"referenced but not found\n",
"{quantity} note objects were "
"referenced, but not found\n",
note_references).format(quantity=note_references)
)
if tag_references:
self.text.write(
ngettext("%(quantity)d tag object was referenced but not found\n",
"%(quantity)d tag objects were referenced but not found\n",
tag_references) % {'quantity': tag_references})
# translators: leave all/any {...} untranslated
ngettext("{quantity} tag object was "
"referenced but not found\n",
"{quantity} tag objects were "
"referenced, but not found\n",
tag_references).format(quantity=tag_references)
)
if tag_references:
self.text.write(
ngettext("%(quantity)d tag object was referenced but not found\n",
"%(quantity)d tag objects were referenced but not found\n",
tag_references) % {'quantity': tag_references})
# translators: leave all/any {...} untranslated
ngettext("{quantity} tag object was "
"referenced but not found\n",
"{quantity} tag objects were "
"referenced, but not found\n",
tag_references).format(quantity=tag_references)
)
if 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}
# translators: leave all/any {...} untranslated
ngettext("{quantity} invalid name format "
"reference was removed\n",
"{quantity} invalid name format "
"references were removed\n",
name_format).format(quantity=name_format)
)
if replaced_sourcerefs:
self.text.write(
ngettext("%(quantity)d invalid source citation was fixed\n",
"%(quantity)d invalid source citations were fixed\n",
replaced_sourcerefs) % {'quantity' : replaced_sourcerefs}
# translators: leave all/any {...} untranslated
ngettext("{quantity} invalid source citation was fixed\n",
"{quantity} invalid source citations were fixed\n",
replaced_sourcerefs
).format(quantity=replaced_sourcerefs)
)
if empty_objs > 0 :

View File

@ -29,8 +29,6 @@
# python modules
#
#-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#-------------------------------------------------------------------------
@ -44,6 +42,9 @@ _ = glocale.translation.gettext
# gramps modules
#
#-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
ngettext = glocale.translation.ngettext # else "nearby" comments are ignored
from gramps.gen.lib import EventRoleType
from gramps.gen.db import DbTxn
from gramps.gen.utils.db import family_name
@ -113,12 +114,14 @@ class EventNames(tool.BatchTool):
self.db.request_rebuild()
if self.change == True:
self.user.info(_('Modifications made'),
glocale.translation.ngettext("%s event description has been added",
"%s event descriptions have been added", counter) % counter)
# translators: leave all/any {...} untranslated
message = ngettext("{quantity} event description has been added",
"{quantity} event descriptions have been added",
counter).format(quantity=counter)
self.user.info(_('Modifications made'), message)
else:
self.user.info(_('No modifications made'),
_("No event description has been added."))
_("No event description has been added."))
#-------------------------------------------------------------------------
#

View File

@ -47,6 +47,9 @@ from gi.repository import Gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext
ngettext = glocale.translation.ngettext # else "nearby" comments are ignored
from gramps.gen.utils.string import conf_strings
from gramps.gen.const import URL_MANUAL_PAGE
from gramps.gui.utils import ProgressMeter
@ -55,9 +58,7 @@ from gramps.gui.dialog import OkDialog
from gramps.gui.display import display_help
from gramps.gen.datehandler import get_date
from gramps.gui.managedwindow import ManagedWindow
from gramps.gen.const import GRAMPS_LOCALE as glocale
from gramps.gen.merge import MergeCitationQuery
_ = glocale.translation.sgettext
from gramps.gui.glade import Glade
from gramps.gen.db import DbTxn
@ -227,10 +228,11 @@ class MergeCitations(tool.BatchTool,ManagedWindow):
db.enable_signals()
db.request_rebuild()
self.progress.close()
OkDialog(
_("Number of merges done"),
glocale.translation.ngettext("%(num)d citation merged",
"%(num)d citations merged", num_merges) % {'num': num_merges})
OkDialog(_("Number of merges done"),
# translators: leave all/any {...} untranslated
ngettext("{number_of} citation merged",
"{number_of} citations merged", num_merges
).format(number_of=num_merges) )
self.close(obj)
#------------------------------------------------------------------------

View File

@ -38,6 +38,9 @@ from gi.repository import GObject
# GRAMPS modules
#
#------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext
ngettext = glocale.translation.ngettext # else "nearby" comments are ignored
from gramps.gen.const import URL_MANUAL_PAGE
from gramps.gui.plug import tool
from gramps.gen.plug.report import utils as ReportUtils
@ -45,9 +48,6 @@ from gramps.gui.editors import EditPerson, EditFamily
from gramps.gui.managedwindow import ManagedWindow
from gramps.gui.utils import ProgressMeter
from gramps.gui.display import display_help
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext
ngettext = glocale.translation.ngettext
from gramps.gui.glade import Glade
from gramps.gen.lib import Tag
from gramps.gen.db import DbTxn
@ -255,10 +255,13 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow) :
# if more than 1 person is selected, use a progress indicator
if rows > 1:
progress = ProgressMeter(self.title,_('Starting'))
#TRANS: no singular form needed, as rows is always > 1
progress.set_pass(ngettext("Setting tag for %d person",
"Setting tag for %d people",
rows) % rows, rows)
progress.set_pass(
# translators: leave all/any {...} untranslated
#TRANS: no singular form needed, as rows is always > 1
ngettext("Setting tag for {number_of} person",
"Setting tag for {number_of} people",
rows).format(number_of=rows),
rows)
# iterate through all of the selected rows
@ -295,12 +298,13 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow) :
def findRelatedPeople(self) :
#TRANS: No singular form is needed.
self.progress.set_pass(
ngettext("Finding relationships between %d person",
"Finding relationships between %d people",
self.numberOfPeopleInDatabase) %
self.numberOfPeopleInDatabase,
# translators: leave all/any {...} untranslated
#TRANS: No singular form is needed.
ngettext("Finding relationships between {number_of} person",
"Finding relationships between {number_of} people",
self.numberOfPeopleInDatabase
).format(number_of=self.numberOfPeopleInDatabase),
self.numberOfPeopleInDatabase)
# as long as we have people we haven't processed yet, keep looping
@ -376,10 +380,12 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow) :
# we have at least 1 "unrelated" person to find
self.progress.set_pass(
ngettext("Looking for %d person", "Looking for %d people",
self.numberOfUnrelatedPeople) %
self.numberOfUnrelatedPeople,
self.numberOfPeopleInDatabase)
# translators: leave all/any {...} untranslated
ngettext("Looking for {number_of} person",
"Looking for {number_of} people",
self.numberOfUnrelatedPeople
).format(number_of=self.numberOfUnrelatedPeople),
self.numberOfPeopleInDatabase)
# loop through everyone in the database
for handle in self.db.iter_person_handles():
@ -402,11 +408,12 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow) :
def populateModel(self) :
self.progress.set_pass(
ngettext("Looking up the name of %d person",
"Looking up the names of %d people",
self.numberOfUnrelatedPeople) %
self.numberOfUnrelatedPeople,
self.numberOfUnrelatedPeople)
# translators: leave all/any {...} untranslated
ngettext("Looking up the name of {number_of} person",
"Looking up the names of {number_of} people",
self.numberOfUnrelatedPeople
).format(number_of=self.numberOfUnrelatedPeople),
self.numberOfUnrelatedPeople)
# loop through the entire list of unrelated people
for handle in self.handlesOfPeopleNotRelated:

View File

@ -32,7 +32,7 @@ from __future__ import unicode_literals
#-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext
ngettext = glocale.translation.ngettext
ngettext = glocale.translation.ngettext # else "nearby" comments are ignored
import cgi
#-------------------------------------------------------------------------
@ -880,7 +880,10 @@ class RelationshipView(NavigationView):
else:
count = 0
if count > 1 :
childmsg = ngettext(" (%d sibling)", " (%d siblings)", count) % count
# translators: leave all/any {...} untranslated
childmsg = ngettext(" ({number_of} sibling)",
" ({number_of} siblings)", count
).format(number_of=count)
elif count == 1 :
gender = self.dbstate.db.get_person_from_handle(
child_list[0]).gender
@ -936,7 +939,10 @@ class RelationshipView(NavigationView):
else:
count = 0
if count > 1 :
childmsg = ngettext(" (%d sibling)"," (%d siblings)", count) % count
# translators: leave all/any {...} untranslated
childmsg = ngettext(" ({number_of} sibling)",
" ({number_of} siblings)", count
).format(number_of=count)
elif count == 1 :
gender = self.dbstate.db.get_person_from_handle(
child_list[0]).gender
@ -1348,7 +1354,10 @@ class RelationshipView(NavigationView):
else:
count = 0
if count >= 1 :
childmsg = ngettext(" (%d child)"," (%d children)", count) % count
# translators: leave all/any {...} untranslated
childmsg = ngettext(" ({number_of} child)",
" ({number_of} children)", count
).format(number_of=count)
else :
childmsg = _(" (no children)")
box = self.get_people_box(handle, post_msg=childmsg)
@ -1395,7 +1404,10 @@ class RelationshipView(NavigationView):
else:
count = 0
if count >= 1 :
childmsg = ngettext(" (%d child)"," (%d children)", count) % count
# translators: leave all/any {...} untranslated
childmsg = ngettext(" ({number_of} child)",
" ({number_of} children)", count
).format(number_of=count)
else :
childmsg = _(" (no children)")
box = self.get_people_box(post_msg=childmsg)

View File

@ -36,8 +36,6 @@ Web Calendar generator.
from functools import partial
import os, codecs, shutil, re, sys
import datetime, calendar
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext
#------------------------------------------------------------------------
# Set up logging
@ -48,6 +46,9 @@ log = logging.getLogger(".WebPage")
#------------------------------------------------------------------------
# GRAMPS module
#------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext
ngettext = glocale.translation.ngettext # else "nearby" comments are ignored
from gramps.gen.lib import Date, Name, NameType, Person
from gramps.gen.lib.date import Today
from gramps.gen.const import PROGRAM_NAME, URL_HOMEPAGE, USER_HOME
@ -1716,12 +1717,11 @@ def get_day_list(event_date, holiday_list, bday_anniv_list):
txt_str = _('%(couple)s, <em>wedding</em>') % {
'couple' : text}
else:
txt_str = (glocale.translation.ngettext(
'%(couple)s, <em>%(years)d'
'</em> year anniversary',
'%(couple)s, <em>%(years)d'
'</em> year anniversary', nyears)
% {'couple' : text, 'years' : nyears})
years_str = '<em>' + nyears + '</em>'
# translators: leave all/any {...} untranslated
txt_str = ngettext("{couple}, {years} year anniversary",
"{couple}, {years} year anniversary",
nyears).format(couple=text, years=years_str)
txt_str = Html('span', txt_str, class_ = "yearsmarried")
day_list.append((nyears, date, txt_str, event))