From 2ac7c5baa760a87fb29b026754ed5fee984c86f5 Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Wed, 27 Apr 2016 22:27:25 -0700 Subject: [PATCH] add deferred translation to "living people" option --- gramps/gen/plug/report/stdoptions.py | 19 ++++++++++++++----- gramps/plugins/drawreport/statisticschart.py | 2 +- gramps/plugins/drawreport/timeline.py | 2 +- gramps/plugins/textreport/placereport.py | 2 +- gramps/plugins/textreport/recordsreport.py | 2 +- gramps/plugins/textreport/tagreport.py | 2 +- 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/gramps/gen/plug/report/stdoptions.py b/gramps/gen/plug/report/stdoptions.py index c6be1b10f..8d39acbfc 100644 --- a/gramps/gen/plug/report/stdoptions.py +++ b/gramps/gen/plug/report/stdoptions.py @@ -36,6 +36,10 @@ from gramps.gen.plug.menu import (EnumeratedListOption, BooleanOption, NumberOption) from gramps.gen.proxy import PrivateProxyDb, LivingProxyDb +# _T_ is a gramps-defined keyword -- see po/update_po.py and po/genpot.sh +def _T_(value): # enable deferred translations (see Python docs 22.1.3.4) + return value + #------------------------------------------------------------------------- # # StandardReportOptions @@ -162,16 +166,21 @@ def add_living_people_option(menu, category, living_people = EnumeratedListOption(_("Living People"), mode) living_people.add_item(LivingProxyDb.MODE_INCLUDE_ALL, - _("Include living people and their data")) + _T_("Include living people and their data"), + xml_item=True) if process_names: living_people.add_item(LivingProxyDb.MODE_INCLUDE_FULL_NAME_ONLY, - _("Include full names but no data")) + _T_("Include full names but no data"), + xml_item=True) living_people.add_item(LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY, - _("Replace given names and include no data")) + _T_("Replace given names and include no data"), + xml_item=True) living_people.add_item(LivingProxyDb.MODE_REPLACE_COMPLETE_NAME, - _("Replace complete names and include no data")) + _T_("Replace complete names and include no data"), + xml_item=True) living_people.add_item(LivingProxyDb.MODE_EXCLUDE_ALL, - _("Do not include living people")) + _T_("Do not include living people"), + xml_item=True) living_people.set_help(_("How to handle living people")) menu.add_option(category, "living_people", living_people) living_people.connect('value-changed', living_people_changed) diff --git a/gramps/plugins/drawreport/statisticschart.py b/gramps/plugins/drawreport/statisticschart.py index 8dcf26db6..e35f7264e 100644 --- a/gramps/plugins/drawreport/statisticschart.py +++ b/gramps/plugins/drawreport/statisticschart.py @@ -759,7 +759,7 @@ class StatisticsChart(Report): gender = get_value('gender') living_value = get_value('living_people') - for (value, description) in living_opt.get_items(): + for (value, description) in living_opt.get_items(xml_items=True): if value == living_value: self.living_desc = '(%s)' % self._(description) break diff --git a/gramps/plugins/drawreport/timeline.py b/gramps/plugins/drawreport/timeline.py index aeca7e586..f91a642ab 100644 --- a/gramps/plugins/drawreport/timeline.py +++ b/gramps/plugins/drawreport/timeline.py @@ -112,7 +112,7 @@ class TimeLine(Report): self.fil_name = self.filter.get_name(rlocale) living_value = menu.get_option_by_name('living_people').get_value() - for (value, description) in living_opt.get_items(): + for (value, description) in living_opt.get_items(xml_items=True): if value == living_value: self.living_desc = self._(description) break diff --git a/gramps/plugins/textreport/placereport.py b/gramps/plugins/textreport/placereport.py index b7ff8d23b..f12973c74 100644 --- a/gramps/plugins/textreport/placereport.py +++ b/gramps/plugins/textreport/placereport.py @@ -90,7 +90,7 @@ class PlaceReport(Report): living_opt = stdoptions.run_living_people_option(self, menu, rlocale) self._lv = menu.get_option_by_name('living_people').get_value() - for (value, description) in living_opt.get_items(): + for (value, description) in living_opt.get_items(xml_items=True): if value == self._lv: self.living_desc = '(%s)' % self._(description) break diff --git a/gramps/plugins/textreport/recordsreport.py b/gramps/plugins/textreport/recordsreport.py index 61274cdfc..c8449c2ad 100644 --- a/gramps/plugins/textreport/recordsreport.py +++ b/gramps/plugins/textreport/recordsreport.py @@ -79,7 +79,7 @@ class RecordsReport(Report): self._locale) self._lv = menu.get_option_by_name('living_people').get_value() - for (value, description) in living_opt.get_items(): + for (value, description) in living_opt.get_items(xml_items=True): if value == self._lv: self.living_desc = self._(description) break diff --git a/gramps/plugins/textreport/tagreport.py b/gramps/plugins/textreport/tagreport.py index 4369eac7e..09edfe63a 100644 --- a/gramps/plugins/textreport/tagreport.py +++ b/gramps/plugins/textreport/tagreport.py @@ -90,7 +90,7 @@ class TagReport(Report): living_opt = stdoptions.run_living_people_option(self, menu, rlocale) self._lv = menu.get_option_by_name('living_people').get_value() - for (value, description) in living_opt.get_items(): + for (value, description) in living_opt.get_items(xml_items=True): if value == self._lv: self.living_desc = '(%s)' % self._(description) break