9041: Father/mother's age attributes are not translated on reports
This commit is contained in:
parent
4640ad39a1
commit
df90ef58fd
@ -2,6 +2,7 @@
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||
# Copyright (C) 2015 Paul Franklin
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -58,25 +59,32 @@ class AttributeType(GrampsType):
|
||||
_CUSTOM = CUSTOM
|
||||
_DEFAULT = ID
|
||||
|
||||
_DATAMAP = [
|
||||
(UNKNOWN , _("Unknown"), "Unknown"),
|
||||
(CUSTOM , _("Custom"), "Custom"),
|
||||
(CASTE , _("Caste"), "Caste"),
|
||||
(DESCRIPTION , _("Description"), "Description"),
|
||||
(ID , _("Identification Number"), "Identification Number"),
|
||||
(NATIONAL , _("National Origin"), "National Origin"),
|
||||
(NUM_CHILD , _("Number of Children"), "Number of Children"),
|
||||
(SSN , _("Social Security Number"), "Social Security Number"),
|
||||
(NICKNAME , _("Nickname"), "Nickname"),
|
||||
(CAUSE , _("Cause"), "Cause"),
|
||||
(AGENCY , _("Agency"), "Agency"),
|
||||
(AGE , _("Age"), "Age"),
|
||||
(FATHER_AGE , _("Father's Age"), "Father Age"),
|
||||
(MOTHER_AGE , _("Mother's Age"), "Mother Age"),
|
||||
(WITNESS , _("Witness"), "Witness"),
|
||||
(TIME , _("Time"), "Time"),
|
||||
# _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
|
||||
|
||||
_BASEMAP = [ # allow deferred translation of attribute UI strings
|
||||
(UNKNOWN , _T_("Unknown"), "Unknown"),
|
||||
(CUSTOM , _T_("Custom"), "Custom"),
|
||||
(CASTE , _T_("Caste"), "Caste"),
|
||||
(DESCRIPTION , _T_("Description"), "Description"),
|
||||
(ID , _T_("Identification Number"), "Identification Number"),
|
||||
(NATIONAL , _T_("National Origin"), "National Origin"),
|
||||
(NUM_CHILD , _T_("Number of Children"), "Number of Children"),
|
||||
(SSN , _T_("Social Security Number"),
|
||||
"Social Security Number"),
|
||||
(NICKNAME , _T_("Nickname"), "Nickname"),
|
||||
(CAUSE , _T_("Cause"), "Cause"),
|
||||
(AGENCY , _T_("Agency"), "Agency"),
|
||||
(AGE , _T_("Age"), "Age"),
|
||||
(FATHER_AGE , _T_("Father's Age"), "Father Age"),
|
||||
(MOTHER_AGE , _T_("Mother's Age"), "Mother Age"),
|
||||
(WITNESS , _T_("Witness"), "Witness"),
|
||||
(TIME , _T_("Time"), "Time"),
|
||||
]
|
||||
|
||||
_DATAMAP = [(base[0], _(base[1]), base[2]) for base in _BASEMAP]
|
||||
|
||||
def __init__(self, value=None):
|
||||
GrampsType.__init__(self, value)
|
||||
|
||||
@ -95,3 +103,14 @@ class AttributeType(GrampsType):
|
||||
|
||||
"""
|
||||
return []
|
||||
|
||||
def type2base(self):
|
||||
"""
|
||||
Return the untranslated string suitable for UI (once translated).
|
||||
"""
|
||||
if self.value == self.CUSTOM:
|
||||
return str(self)
|
||||
elif self._BASEMAP[self.value+1]: # UNKNOWN is before CUSTOM, sigh
|
||||
return self._BASEMAP[self.value+1][1]
|
||||
else:
|
||||
return self.UNKNOWN
|
||||
|
@ -190,26 +190,8 @@ class IndivCompleteReport(Report):
|
||||
self.doc.end_superscript()
|
||||
self.doc.end_paragraph()
|
||||
|
||||
attr_list = event.get_attribute_list()
|
||||
if len(attr_list):
|
||||
for attr in attr_list:
|
||||
attr_type = self._get_type(attr.get_type())
|
||||
# translators: needed for French, ignore otherwise
|
||||
text = self._("%(type)s: %(value)s") % {
|
||||
'type' : self._(attr_type),
|
||||
'value' : attr.get_value() }
|
||||
endnotes = self._cite_endnote(attr)
|
||||
self.write_paragraph(text, endnotes)
|
||||
|
||||
attr_list = event_ref.get_attribute_list()
|
||||
if len(attr_list):
|
||||
for attr in attr_list:
|
||||
# translators: needed for French, ignore otherwise
|
||||
text = self._("%(type)s: %(value)s") % {
|
||||
'type' : self._(str(attr.get_type())),
|
||||
'value' : attr.get_value() }
|
||||
endnotes = self._cite_endnote(attr)
|
||||
self.write_paragraph(text, endnotes)
|
||||
self.do_attributes(event.get_attribute_list() +
|
||||
event_ref.get_attribute_list() )
|
||||
|
||||
for notehandle in event.get_note_list():
|
||||
note = self._db.get_note_from_handle(notehandle)
|
||||
@ -413,7 +395,7 @@ class IndivCompleteReport(Report):
|
||||
self.doc.end_row()
|
||||
|
||||
for attr in attr_list:
|
||||
attr_type = self._get_type(attr.get_type())
|
||||
attr_type = attr.get_type().type2base()
|
||||
self.doc.start_row()
|
||||
self.write_cell(self._(attr_type))
|
||||
text = attr.get_value()
|
||||
@ -547,6 +529,8 @@ class IndivCompleteReport(Report):
|
||||
self.write_paragraph(description, style='IDS-ImageCaptionCenter')
|
||||
ReportUtils.insert_image(self._db, self.doc, media_ref, self._user,
|
||||
align='center', w_cm=5.0, h_cm=5.0)
|
||||
self.do_attributes(media.get_attribute_list() +
|
||||
media_ref.get_attribute_list() )
|
||||
self.doc.end_cell()
|
||||
if image_count % cells == cells - 1:
|
||||
self.doc.end_row()
|
||||
@ -620,14 +604,7 @@ class IndivCompleteReport(Report):
|
||||
self.doc.start_row()
|
||||
self.write_cell(self._("Attributes"))
|
||||
self.doc.start_cell("IDS-ListCell")
|
||||
for attr in attr_list:
|
||||
attr_type = self._get_type(attr.get_type())
|
||||
# translators: needed for French, ignore otherwise
|
||||
text = self._("%(type)s: %(value)s") % {
|
||||
'type' : self._(attr_type),
|
||||
'value' : attr.get_value() }
|
||||
endnotes = self._cite_endnote(attr)
|
||||
self.write_paragraph(text, endnotes)
|
||||
self.do_attributes(attr_list)
|
||||
self.doc.end_cell()
|
||||
self.doc.end_row()
|
||||
|
||||
@ -859,7 +836,7 @@ class IndivCompleteReport(Report):
|
||||
text = _('(image)')
|
||||
else:
|
||||
for attr in attr_list:
|
||||
attr_type = self._get_type(attr.get_type())
|
||||
attr_type = attr.get_type().type2base()
|
||||
# translators: needed for French, ignore otherwise
|
||||
text = self._("%(str1)s: %(str2)s") % {
|
||||
'str1' : self._(attr_type),
|
||||
@ -923,6 +900,16 @@ class IndivCompleteReport(Report):
|
||||
txt = self._('%(str1)s, %(str2)s') % {'str1':prior, 'str2':txt}
|
||||
return txt
|
||||
|
||||
def do_attributes(self, attr_list):
|
||||
for attr in attr_list:
|
||||
attr_type = attr.get_type().type2base()
|
||||
# translators: needed for French, ignore otherwise
|
||||
text = self._("%(type)s: %(value)s") % {
|
||||
'type' : self._(attr_type),
|
||||
'value' : attr.get_value() }
|
||||
endnotes = self._cite_endnote(attr)
|
||||
self.write_paragraph(text, endnotes)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# IndivCompleteOptions
|
||||
|
Loading…
Reference in New Issue
Block a user