diff --git a/gramps/cli/clidbman.py b/gramps/cli/clidbman.py index e21d826c5..b6c3b410c 100644 --- a/gramps/cli/clidbman.py +++ b/gramps/cli/clidbman.py @@ -190,7 +190,7 @@ class CLIDbManager: dbname == name) for dbname in database_names])): summary = self.get_dbdir_summary(dirpath, name) - print(_("Family Tree \"%s\":") % summary[_("Family Tree")]) + print(_('Family Tree "%s":') % summary[_("Family Tree")]) for item in sorted(summary): if item != "Family Tree": # translators: needed for French, ignore otherwise diff --git a/gramps/gen/const.py b/gramps/gen/const.py index de2658221..8c04a94d7 100644 --- a/gramps/gen/const.py +++ b/gramps/gen/const.py @@ -253,6 +253,7 @@ NO_GIVEN = "(%s)" % _("given-name|none") ARABIC_COMMA = "،" ARABIC_SEMICOLON = "؛" DOCGEN_OPTIONS = 'Docgen Options' +COLON = _(':') # translators: needed for French, ignore otherwise #------------------------------------------------------------------------- # diff --git a/gramps/gen/utils/place.py b/gramps/gen/utils/place.py index 6ead3601f..7283f9711 100644 --- a/gramps/gen/utils/place.py +++ b/gramps/gen/utils/place.py @@ -720,7 +720,7 @@ if __name__ == '__main__': print(lat1, lon1, "in format", format8, "is", res1, res2, "\n") def test_formats_fail(lat1, lon1, text=''): - print("This test should make conv_lat_lon function fail, "+text+":") + print("This test should make conv_lat_lon function fail, %s:") % text res1, res2 = conv_lat_lon(lat1, lon1) print(lat1, lon1, " fails to convert, result=", res1, res2, "\n") diff --git a/gramps/gui/plug/export/_exportoptions.py b/gramps/gui/plug/export/_exportoptions.py index 9703f0689..3dcbc3d66 100644 --- a/gramps/gui/plug/export/_exportoptions.py +++ b/gramps/gui/plug/export/_exportoptions.py @@ -33,7 +33,7 @@ # Gramps modules # #------------------------------------------------------------------------- -from gramps.gen.const import GRAMPS_LOCALE as glocale +from gramps.gen.const import COLON, GRAMPS_LOCALE as glocale _ = glocale.translation.gettext ngettext = glocale.translation.ngettext # else "nearby" comments are ignored from gramps.gen.config import config @@ -277,11 +277,10 @@ class WriterOptionBox: button.set_size_request(107, -1) button.connect("clicked", self.show_preview_data) button.proxy_name = proxy_name - colon = _(':') # translators: needed for French, ignore otherwise if proxy_name == "person": # Frame Person: self.filter_obj = Gtk.ComboBox() - label = Gtk.Label(label=_('_Person Filter') + colon) + label = Gtk.Label(label=_('_Person Filter') + COLON) label.set_halign(Gtk.Align.START) label.set_size_request(120, -1) label.set_padding(5, 0) @@ -299,7 +298,7 @@ class WriterOptionBox: # Frame Note: # Objects for choosing a Note filter: self.filter_note = Gtk.ComboBox() - label_note = Gtk.Label(label=_('_Note Filter') + colon) + label_note = Gtk.Label(label=_('_Note Filter') + COLON) label_note.set_halign(Gtk.Align.START) label_note.set_size_request(120, -1) label_note.set_padding(5, 0) @@ -315,7 +314,7 @@ class WriterOptionBox: button.set_tooltip_text(_("Click to see preview after note filter")) elif proxy_name == "privacy": # Frame 3: - label = Gtk.Label(label=_("Privacy Filter") + colon) + label = Gtk.Label(label=_("Privacy Filter") + COLON) label.set_halign(Gtk.Align.START) label.set_size_request(120, -1) label.set_padding(5, 0) @@ -325,7 +324,7 @@ class WriterOptionBox: button.set_tooltip_text(_("Click to see preview after privacy filter")) elif proxy_name == "living": # Frame 4: - label = Gtk.Label(label=_("Living Filter") + colon) + label = Gtk.Label(label=_("Living Filter") + COLON) label.set_halign(Gtk.Align.START) label.set_size_request(120, -1) label.set_padding(5, 0) @@ -337,7 +336,7 @@ class WriterOptionBox: elif proxy_name == "reference": # Frame 5: self.reference_filter = Gtk.ComboBox() - label = Gtk.Label(label=_('Reference Filter') + colon) + label = Gtk.Label(label=_('Reference Filter') + COLON) label.set_halign(Gtk.Align.START) label.set_size_request(120, -1) label.set_padding(5, 0) diff --git a/gramps/gui/widgets/grampletpane.py b/gramps/gui/widgets/grampletpane.py index 05b66f24b..748fbaf7e 100644 --- a/gramps/gui/widgets/grampletpane.py +++ b/gramps/gui/widgets/grampletpane.py @@ -45,7 +45,7 @@ LOG = logging.getLogger(".") # #------------------------------------------------------------------------- from gramps.gen.errors import WindowActiveError -from gramps.gen.const import URL_MANUAL_PAGE, VERSION_DIR +from gramps.gen.const import URL_MANUAL_PAGE, VERSION_DIR, COLON from ..editors import EditPerson, EditFamily from ..managedwindow import ManagedWindow from ..utils import is_right_click, rgb_to_hex @@ -580,7 +580,7 @@ class GuiGramplet: hbox.pack_start(options, True, True, 0) topbox.pack_start(hbox, False, False, 0) for item in self.pui.option_order: - label = Gtk.Label(label=item + ":") + label = Gtk.Label(label=item + COLON) label.set_halign(Gtk.Align.END) labels.pack_start(label, True, True, 0) options.pack_start(self.pui.option_dict[item][0], True, True, 0) # widget diff --git a/gramps/plugins/gramplet/ageondategramplet.py b/gramps/plugins/gramplet/ageondategramplet.py index f3c9cc573..6b179c492 100644 --- a/gramps/plugins/gramplet/ageondategramplet.py +++ b/gramps/plugins/gramplet/ageondategramplet.py @@ -29,7 +29,7 @@ on a particular date. from gramps.gen.plug import Gramplet from gramps.gen.datehandler import parser from gramps.gui.plug.quick import run_quick_report_by_name -from gramps.gen.const import GRAMPS_LOCALE as glocale +from gramps.gen.const import COLON, GRAMPS_LOCALE as glocale _ = glocale.translation.sgettext #------------------------------------------------------------------------ @@ -63,7 +63,7 @@ class AgeOnDateGramplet(Gramplet): " that date. You can then sort by the age column," " and double-click the row to view or edit.")) label = Gtk.Label() - label.set_text(_("Date") + ":") + label.set_text(_("Date") + COLON) self.entry = Gtk.Entry() button = Gtk.Button(label=_("Run")) button.connect("clicked", self.run) diff --git a/gramps/plugins/gramplet/persondetails.py b/gramps/plugins/gramplet/persondetails.py index 797684125..26c6c929e 100644 --- a/gramps/plugins/gramplet/persondetails.py +++ b/gramps/plugins/gramplet/persondetails.py @@ -38,7 +38,7 @@ from gramps.gen.display.name import displayer as name_displayer from gramps.gen.display.place import displayer as place_displayer from gramps.gen.datehandler import get_date from gramps.gen.utils.file import media_path_full -from gramps.gen.const import GRAMPS_LOCALE as glocale +from gramps.gen.const import COLON, GRAMPS_LOCALE as glocale _ = glocale.translation.gettext class PersonDetails(Gramplet): @@ -74,7 +74,7 @@ class PersonDetails(Gramplet): """ Add a row to the table. """ - label = Gtk.Label(label=title + ':', halign=Gtk.Align.END, + label = Gtk.Label(label=title + COLON, halign=Gtk.Align.END, valign=Gtk.Align.START) label.show() value = Gtk.Label(label=value, halign=Gtk.Align.START) diff --git a/gramps/plugins/gramplet/placedetails.py b/gramps/plugins/gramplet/placedetails.py index 6d1fc10be..76e654e25 100644 --- a/gramps/plugins/gramplet/placedetails.py +++ b/gramps/plugins/gramplet/placedetails.py @@ -35,7 +35,7 @@ from gramps.gui.widgets import Photo from gramps.gen.utils.place import conv_lat_lon from gramps.gen.utils.file import media_path_full from gramps.gen.display.place import displayer as place_displayer -from gramps.gen.const import GRAMPS_LOCALE as glocale +from gramps.gen.const import COLON, GRAMPS_LOCALE as glocale _ = glocale.translation.gettext class PlaceDetails(Gramplet): @@ -69,7 +69,7 @@ class PlaceDetails(Gramplet): """ Add a row to the table. """ - label = Gtk.Label(label=title + ':', halign=Gtk.Align.END, + label = Gtk.Label(label=title + COLON, halign=Gtk.Align.END, valign=Gtk.Align.START) label.show() value = Gtk.Label(label=value, halign=Gtk.Align.START) diff --git a/gramps/plugins/gramplet/repositorydetails.py b/gramps/plugins/gramplet/repositorydetails.py index a131d696a..840703fdf 100644 --- a/gramps/plugins/gramplet/repositorydetails.py +++ b/gramps/plugins/gramplet/repositorydetails.py @@ -32,7 +32,7 @@ from gi.repository import Pango #------------------------------------------------------------------------- from gramps.gen.lib import UrlType from gramps.gen.plug import Gramplet -from gramps.gen.const import GRAMPS_LOCALE as glocale +from gramps.gen.const import COLON, GRAMPS_LOCALE as glocale _ = glocale.translation.gettext class RepositoryDetails(Gramplet): @@ -64,7 +64,7 @@ class RepositoryDetails(Gramplet): """ Add a row to the table. """ - label = Gtk.Label(label=title + ':', halign=Gtk.Align.END, + label = Gtk.Label(label=title + COLON, halign=Gtk.Align.END, valign=Gtk.Align.START) label.show() value = Gtk.Label(label=value, halign=Gtk.Align.START) diff --git a/gramps/plugins/gramplet/statsgramplet.py b/gramps/plugins/gramplet/statsgramplet.py index f33fbce94..439ddef1a 100644 --- a/gramps/plugins/gramplet/statsgramplet.py +++ b/gramps/plugins/gramplet/statsgramplet.py @@ -32,7 +32,7 @@ from gramps.gen.plug import Gramplet from gramps.gen.utils.file import media_path_full from gramps.gen.datehandler import get_date from gramps.gen.lib import Person -from gramps.gen.const import GRAMPS_LOCALE as glocale +from gramps.gen.const import COLON, GRAMPS_LOCALE as glocale _ = glocale.translation.sgettext #------------------------------------------------------------------------ @@ -98,7 +98,7 @@ class StatsGramplet(Gramplet): self.clear_text() self.append_text(_("Individuals") + "\n") self.append_text("----------------------------\n") - self.link(_("Number of individuals") + ":", + self.link(_("Number of individuals") + COLON, 'Filter', 'all people') self.append_text(" %s" % database.get_number_of_people()) self.append_text("\n") diff --git a/gramps/plugins/importer/importxml.py b/gramps/plugins/importer/importxml.py index 7ccc5fd5e..4f0c4ddc8 100644 --- a/gramps/plugins/importer/importxml.py +++ b/gramps/plugins/importer/importxml.py @@ -1766,11 +1766,11 @@ class GrampsParser(UpdateCallback): val = attrs['value'] match = self.grampsuri.match(val) if match: - target = {"Person":"person", "Family":"family", - "Event":"event", "Place":"place", "Source":"source", - "Citation":"citation", - "Repository":"repository", "Media":"media", - "Note":"note"}[str(match.group('object_class'))] + target = {"Person" : "person", "Family" : "family", + "Event" : "event", "Place" : "place", + "Source" : "source", "Citation" : "citation", + "Repository" : "repository", "Media" : "media", + "Note" : "note"}[str(match.group('object_class'))] if match.group('handle') in self.import_handles: if target in self.import_handles[match.group('handle')]: val = "gramps://%s/handle/%s" % ( diff --git a/gramps/plugins/textreport/indivcomplete.py b/gramps/plugins/textreport/indivcomplete.py index ab1d680ab..0c043ef68 100644 --- a/gramps/plugins/textreport/indivcomplete.py +++ b/gramps/plugins/textreport/indivcomplete.py @@ -184,7 +184,7 @@ class IndivCompleteReport(Report): place_name = _pd.display_event(self._db, event) place_endnote = self._cite_endnote(place) # make sure it's translated, so it can be used below, in "combine" - ignore = _('%(str1)s in %(str2)s. ') % {'str1':'', 'str2':''} + ignore = _('%(str1)s in %(str2)s. ') % {'str1' : '', 'str2' : ''} date_place = self.combine('%(str1)s in %(str2)s. ', '%s. ', date, place_name) @@ -195,7 +195,7 @@ class IndivCompleteReport(Report): column_1 = column_1 + ' (' + self._(role.xml_str()) + ')' # translators: needed for Arabic, ignore otherwise # make sure it's translated, so it can be used below, in "combine" - ignore = _('%(str1)s, %(str2)s') % {'str1':'', 'str2':''} + ignore = _('%(str1)s, %(str2)s') % {'str1' : '', 'str2' : ''} column_2 = self.combine('%(str1)s, %(str2)s', '%s', description, date_place) else: @@ -203,7 +203,7 @@ class IndivCompleteReport(Report): column_1 = date # translators: needed for Arabic, ignore otherwise # make sure it's translated, so it can be used below, in "combine" - ignore = _('%(str1)s, %(str2)s') % {'str1':'', 'str2':''} + ignore = _('%(str1)s, %(str2)s') % {'str1' : '', 'str2' : ''} column_2 = self.combine('%(str1)s, %(str2)s', '%s', description, place_name) diff --git a/gramps/plugins/tool/populatesources.py b/gramps/plugins/tool/populatesources.py index 6a72473d9..d88a4d1b1 100644 --- a/gramps/plugins/tool/populatesources.py +++ b/gramps/plugins/tool/populatesources.py @@ -40,7 +40,7 @@ from gi.repository import Gtk # gramps modules # #------------------------------------------------------------------------- -from gramps.gen.const import GRAMPS_LOCALE as glocale +from gramps.gen.const import COLON, GRAMPS_LOCALE as glocale _ = glocale.translation.gettext from gramps.gui.utils import ProgressMeter from gramps.gui.plug import tool @@ -96,14 +96,14 @@ class PopulateSources(tool.Tool, ManagedWindow): label.set_line_wrap(True) hbox1 = Gtk.Box() - label_sources = Gtk.Label(label="Number of sources" + ":") + label_sources = Gtk.Label(label="Number of sources" + COLON) self.sources_entry = Gtk.Entry() self.sources_entry.set_text("%d" % num_sources) hbox1.pack_start(label_sources, False, True, 0) hbox1.pack_start(self.sources_entry, True, True, 0) hbox2 = Gtk.Box() - label_citations = Gtk.Label(label="Number of citations" + ":") + label_citations = Gtk.Label(label="Number of citations" + COLON) self.citations_entry = Gtk.Entry() self.citations_entry.set_text("%d" % num_citations) hbox2.pack_start(label_citations, False, True, 0) diff --git a/gramps/plugins/webreport/narrativeweb.py b/gramps/plugins/webreport/narrativeweb.py index d66d56023..aacb0c712 100644 --- a/gramps/plugins/webreport/narrativeweb.py +++ b/gramps/plugins/webreport/narrativeweb.py @@ -537,6 +537,8 @@ class BasePage: lang = report.options['trans'] self.rlocale = report.set_locale(lang) self._ = self.rlocale.translation.sgettext + self.COLON = self._(':') # translators: needed for French, else ignore + if report.options['securesite']: self.secure_mode = HTTPS else: @@ -8116,54 +8118,55 @@ class StatisticsPage(BasePage): sec11 += Html("h4", self._("Individuals"), inline=True) body += sec11 with Html("div", class_="content", id='subsection narrative') as sec1: - sec1 += Html("br", self._("Number of individuals") + ":" + + sec1 += Html("br", self._("Number of individuals") + self.COLON + "%d" % npersons, inline=True) - sec1 += Html("br", self._("Males") + ":" + + sec1 += Html("br", self._("Males") + self.COLON + "%d" % males, inline=True) - sec1 += Html("br", self._("Females") + ":" + + sec1 += Html("br", self._("Females") + self.COLON + "%d" % females, inline=True) - sec1 += Html("br", self._("Individuals with unknown gender") + ":" + - "%d" % unknown, inline=True) + sec1 += Html("br", self._("Individuals with unknown gender") + + self.COLON + "%d" % unknown, inline=True) body += sec1 with Html("div", class_="content", id='subsection narrative') as sec2: sec2 += Html("h4", self._("Family Information"), inline=True) - sec2 += Html("br", self._("Number of families") + ":" + + sec2 += Html("br", self._("Number of families") + self.COLON + "%d" % nfamilies, inline=True) - sec2 += Html("br", self._("Unique surnames") + ":" + + sec2 += Html("br", self._("Unique surnames") + self.COLON + "%d" % nsurnames, inline=True) body += sec2 with Html("div", class_="content", id='subsection narrative') as sec3: sec3 += Html("h4", self._("Media Objects"), inline=True) sec3 += Html("br", self._("Total number of media object references") + - ":" + "%d" % total_media, inline=True) + self.COLON + "%d" % total_media, inline=True) sec3 += Html("br", self._("Number of unique media objects") + - ":" + "%d" % mobjects, inline=True) + self.COLON + "%d" % mobjects, inline=True) sec3 += Html("br", self._("Total size of media objects") + - ":" + "%8s %s" % (mbytes, self._("Megabyte|MB")), + self.COLON + + "%8s %s" % (mbytes, self._("Megabyte|MB")), inline=True) sec3 += Html("br", self._("Missing Media Objects") + - ":" + "%d" % len(notfound), inline=True) + self.COLON + "%d" % len(notfound), inline=True) body += sec3 with Html("div", class_="content", id='subsection narrative') as sec4: sec4 += Html("h4", self._("Miscellaneous"), inline=True) - sec4 += Html("br", self._("Number of events") + - ":" + "%d" % report.database.get_number_of_events(), + sec4 += Html("br", self._("Number of events") + self.COLON + + "%d" % report.database.get_number_of_events(), inline=True) - sec4 += Html("br", self._("Number of places") + - ":" + "%d" % report.database.get_number_of_places(), + sec4 += Html("br", self._("Number of places") + self.COLON + + "%d" % report.database.get_number_of_places(), inline=True) nsources = report.database.get_number_of_sources() sec4 += Html("br", self._("Number of sources") + - ":" + "%d" % nsources, + self.COLON + "%d" % nsources, inline=True) ncitations = report.database.get_number_of_citations() sec4 += Html("br", self._("Number of citations") + - ":" + "%d" % ncitations, + self.COLON + "%d" % ncitations, inline=True) nrepo = report.database.get_number_of_repositories() sec4 += Html("br", self._("Number of repositories") + - ":" + "%d" % nrepo, + self.COLON + "%d" % nrepo, inline=True) body += sec4 @@ -8181,38 +8184,38 @@ class StatisticsPage(BasePage): body += section with Html("div", class_="content", id='subsection narrative') as sec5: sec5 += Html("h4", self._("Individuals"), inline=True) - sec5 += Html("br", self._("Number of individuals") + ":" + + sec5 += Html("br", self._("Number of individuals") + self.COLON + "%d" % len(self.report.bkref_dict[Person]), inline=True) - sec5 += Html("br", self._("Males") + ":" + + sec5 += Html("br", self._("Males") + self.COLON + "%d" % males, inline=True) - sec5 += Html("br", self._("Females") + ":" + + sec5 += Html("br", self._("Females") + self.COLON + "%d" % females, inline=True) - sec5 += Html("br", self._("Individuals with unknown gender") + ":" + - "%d" % unknown, inline=True) + sec5 += Html("br", self._("Individuals with unknown gender") + + self.COLON + "%d" % unknown, inline=True) body += sec5 with Html("div", class_="content", id='subsection narrative') as sec6: sec6 += Html("h4", self._("Family Information"), inline=True) - sec6 += Html("br", self._("Number of families") + ":" + + sec6 += Html("br", self._("Number of families") + self.COLON + "%d" % len(self.report.bkref_dict[Family]), inline=True) body += sec6 with Html("div", class_="content", id='subsection narrative') as sec7: sec7 += Html("h4", self._("Miscellaneous"), inline=True) - sec7 += Html("br", self._("Number of events") + - ":" + "%d" % len(self.report.bkref_dict[Event]), + sec7 += Html("br", self._("Number of events") + self.COLON + + "%d" % len(self.report.bkref_dict[Event]), inline=True) - sec7 += Html("br", self._("Number of places") + - ":" + "%d" % len(self.report.bkref_dict[Place]), + sec7 += Html("br", self._("Number of places") + self.COLON + + "%d" % len(self.report.bkref_dict[Place]), inline=True) - sec7 += Html("br", self._("Number of sources") + - ":" + "%d" % len(self.report.bkref_dict[Source]), + sec7 += Html("br", self._("Number of sources") + self.COLON + + "%d" % len(self.report.bkref_dict[Source]), inline=True) - sec7 += Html("br", self._("Number of citations") + - ":" + "%d" % len(self.report.bkref_dict[Citation]), + sec7 += Html("br", self._("Number of citations") + self.COLON + + "%d" % len(self.report.bkref_dict[Citation]), inline=True) - sec7 += Html("br", self._("Number of repositories") + - ":" + "%d" % len(self.report.bkref_dict[Repository]), + sec7 += Html("br", self._("Number of repositories") + self.COLON + + "%d" % len(self.report.bkref_dict[Repository]), inline=True) body += sec7