Add an option to show years in the birthday report
Added an option to the birthday report that allows for the year of birth (or in the case of a wedding it's year) to be printed in the report. Resolves #5948
This commit is contained in:
parent
3bac4a1036
commit
d6e9d62fad
@ -102,6 +102,7 @@ class BirthdayReport(Report):
|
|||||||
self.deadtxt = mgobn('deadtxt')
|
self.deadtxt = mgobn('deadtxt')
|
||||||
self.filter_option = menu.get_option_by_name('filter')
|
self.filter_option = menu.get_option_by_name('filter')
|
||||||
self.filter = self.filter_option.get_filter()
|
self.filter = self.filter_option.get_filter()
|
||||||
|
self.showyear = mgobn('showyear')
|
||||||
pid = mgobn('pid')
|
pid = mgobn('pid')
|
||||||
|
|
||||||
self.set_locale(menu.get_option_by_name('trans').get_value())
|
self.set_locale(menu.get_option_by_name('trans').get_value())
|
||||||
@ -321,15 +322,19 @@ class BirthdayReport(Report):
|
|||||||
deadtxt = ""
|
deadtxt = ""
|
||||||
if (not alive):
|
if (not alive):
|
||||||
deadtxt = self.deadtxt
|
deadtxt = self.deadtxt
|
||||||
|
yeartxt = ""
|
||||||
|
if self.showyear:
|
||||||
|
yeartxt = "(%s) " % year
|
||||||
if nyears == 0:
|
if nyears == 0:
|
||||||
text = self._('* %(person)s, birth%(relation)s') % {
|
text = self._('* %(person)s, birth%(relation)s') % {
|
||||||
'person' : short_name,
|
'person' : short_name,
|
||||||
'relation' : comment}
|
'relation' : comment}
|
||||||
else:
|
else:
|
||||||
# translators: leave all/any {...} untranslated
|
# translators: leave all/any {...} untranslated
|
||||||
text = ngettext('* {person}{dead}, {age}{relation}',
|
text = ngettext('* {year}{person}{dead}, {age}{relation}',
|
||||||
'* {person}{dead}, {age}{relation}',
|
'* {year}{person}{dead}, {age}{relation}',
|
||||||
nyears).format(person=short_name,
|
nyears).format(year=yeartxt,
|
||||||
|
person=short_name,
|
||||||
dead=deadtxt,
|
dead=deadtxt,
|
||||||
age=nyears,
|
age=nyears,
|
||||||
relation=comment)
|
relation=comment)
|
||||||
@ -386,15 +391,18 @@ class BirthdayReport(Report):
|
|||||||
deadtxt1 = self.deadtxt
|
deadtxt1 = self.deadtxt
|
||||||
if (not alive2):
|
if (not alive2):
|
||||||
deadtxt2 = self.deadtxt
|
deadtxt2 = self.deadtxt
|
||||||
|
yeartxt = ""
|
||||||
|
if self.showyear:
|
||||||
|
yeartxt = "(%s) " % year
|
||||||
if nyears == 0:
|
if nyears == 0:
|
||||||
text = self._("⚭ %(spouse)s and\n %(person)s, wedding") % {
|
text = self._("⚭ %(spouse)s and\n %(person)s, wedding") % {
|
||||||
'spouse' : spouse_name,
|
'spouse' : spouse_name,
|
||||||
'person' : short_name}
|
'person' : short_name}
|
||||||
else:
|
else:
|
||||||
# translators: leave all/any {...} untranslated
|
# translators: leave all/any {...} untranslated
|
||||||
text = ngettext("⚭ {spouse}{deadtxt2} and\n {person}{deadtxt1}, {nyears}",
|
text = ngettext("⚭ {year}{spouse}{deadtxt2} and\n {person}{deadtxt1}, {nyears}",
|
||||||
"⚭ {spouse}{deadtxt2} and\n {person}{deadtxt1}, {nyears}",
|
"⚭ {year}{spouse}{deadtxt2} and\n {person}{deadtxt1}, {nyears}",
|
||||||
nyears).format(spouse=spouse_name, deadtxt2=deadtxt2, person=short_name, deadtxt1=deadtxt1, nyears=nyears)
|
nyears).format(year=yeartxt, spouse=spouse_name, deadtxt2=deadtxt2, person=short_name, deadtxt1=deadtxt1, nyears=nyears)
|
||||||
if (self.alive and alive1 and alive2) or not self.alive:
|
if (self.alive and alive1 and alive2) or not self.alive:
|
||||||
self.add_day_item(text, month, day, spouse)
|
self.add_day_item(text, month, day, spouse)
|
||||||
|
|
||||||
@ -465,6 +473,10 @@ class BirthdayOptions(MenuReportOptions):
|
|||||||
|
|
||||||
stdoptions.add_localization_option(menu, category_name)
|
stdoptions.add_localization_option(menu, category_name)
|
||||||
|
|
||||||
|
showyear = BooleanOption(_("Show event year"), True)
|
||||||
|
showyear.set_help(_("Prints the year the event took place in the report"))
|
||||||
|
menu.add_option(category_name, "showyear", showyear)
|
||||||
|
|
||||||
category_name = _("Content")
|
category_name = _("Content")
|
||||||
|
|
||||||
year = NumberOption(_("Year of report"), time.localtime()[0],
|
year = NumberOption(_("Year of report"), time.localtime()[0],
|
||||||
|
Loading…
Reference in New Issue
Block a user