add Gramps type name on translator class
svn: r16113
This commit is contained in:
parent
bf042a6934
commit
2c37a2c7bb
@ -40,6 +40,7 @@ _ = gettext.gettext
|
|||||||
import TransUtils
|
import TransUtils
|
||||||
import DateHandler
|
import DateHandler
|
||||||
import config
|
import config
|
||||||
|
from gen.lib.grampstype import GrampsType
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -221,3 +222,14 @@ class Translator:
|
|||||||
:rtype: unicode
|
:rtype: unicode
|
||||||
"""
|
"""
|
||||||
return self.__dd.display(date)
|
return self.__dd.display(date)
|
||||||
|
|
||||||
|
def get_type(self, name):
|
||||||
|
"""
|
||||||
|
Return a string representing the name appropriate for the language being
|
||||||
|
translated.
|
||||||
|
|
||||||
|
:param name: The name type to be represented.
|
||||||
|
:returns: The name as text in the proper language.
|
||||||
|
:rtype: unicode
|
||||||
|
"""
|
||||||
|
return GrampsType.xml_str(name)
|
||||||
|
@ -157,6 +157,8 @@ class DetAncestorReport(Report):
|
|||||||
|
|
||||||
self.__get_date = translator.get_date
|
self.__get_date = translator.get_date
|
||||||
|
|
||||||
|
self.__get_type = translator.get_type
|
||||||
|
|
||||||
self.bibli = Bibliography(Bibliography.MODE_PAGE)
|
self.bibli = Bibliography(Bibliography.MODE_PAGE)
|
||||||
|
|
||||||
def apply_filter(self, person_handle, index):
|
def apply_filter(self, person_handle, index):
|
||||||
@ -219,6 +221,7 @@ class DetAncestorReport(Report):
|
|||||||
if self.inc_sources:
|
if self.inc_sources:
|
||||||
if self.pgbrkenotes:
|
if self.pgbrkenotes:
|
||||||
self.doc.page_break()
|
self.doc.page_break()
|
||||||
|
# it ignores language set for Note type (use locale)
|
||||||
endnotes.write_endnotes(self.bibli, self.database, self.doc,
|
endnotes.write_endnotes(self.bibli, self.database, self.doc,
|
||||||
printnotes=self.inc_srcnotes)
|
printnotes=self.inc_srcnotes)
|
||||||
|
|
||||||
@ -314,10 +317,10 @@ class DetAncestorReport(Report):
|
|||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
first = False
|
first = False
|
||||||
self.doc.start_paragraph('DAR-MoreDetails')
|
self.doc.start_paragraph('DAR-MoreDetails')
|
||||||
atype = str( alt_name.get_type() )
|
atype = self.__get_type(alt_name.get_type())
|
||||||
self.doc.write_text_citation(
|
self.doc.write_text_citation(
|
||||||
self._('%(name_kind)s: %(name)s%(endnotes)s') % {
|
self._('%(name_kind)s: %(name)s%(endnotes)s') % {
|
||||||
'name_kind' : atype,
|
'name_kind' : self._(atype),
|
||||||
'name' : alt_name.get_regular_name(),
|
'name' : alt_name.get_regular_name(),
|
||||||
'endnotes' : self.endnotes(alt_name),
|
'endnotes' : self.endnotes(alt_name),
|
||||||
})
|
})
|
||||||
@ -374,7 +377,7 @@ class DetAncestorReport(Report):
|
|||||||
|
|
||||||
for attr in attrs:
|
for attr in attrs:
|
||||||
self.doc.start_paragraph('DAR-MoreDetails')
|
self.doc.start_paragraph('DAR-MoreDetails')
|
||||||
attrName = str(attr.get_type())
|
attrName = self.__get_type(attr.get_type())
|
||||||
text = self._("%(type)s: %(value)s%(endnotes)s") % {
|
text = self._("%(type)s: %(value)s%(endnotes)s") % {
|
||||||
'type' : self._(attrName),
|
'type' : self._(attrName),
|
||||||
'value' : attr.get_value(),
|
'value' : attr.get_value(),
|
||||||
@ -400,7 +403,7 @@ class DetAncestorReport(Report):
|
|||||||
place = u''
|
place = u''
|
||||||
|
|
||||||
self.doc.start_paragraph('DAR-MoreDetails')
|
self.doc.start_paragraph('DAR-MoreDetails')
|
||||||
evtName = str( event.get_type() )
|
evtName = self.__get_type(event.get_type())
|
||||||
if date and place:
|
if date and place:
|
||||||
text += self._('%(date)s, %(place)s') % {
|
text += self._('%(date)s, %(place)s') % {
|
||||||
'date' : date, 'place' : place }
|
'date' : date, 'place' : place }
|
||||||
@ -432,7 +435,7 @@ class DetAncestorReport(Report):
|
|||||||
for attr in attr_list:
|
for attr in attr_list:
|
||||||
if text:
|
if text:
|
||||||
text += "; "
|
text += "; "
|
||||||
attrName = str(attr.get_type())
|
attrName = self.__get_type(attr.get_type())
|
||||||
text += self._("%(type)s: %(value)s%(endnotes)s") % {
|
text += self._("%(type)s: %(value)s%(endnotes)s") % {
|
||||||
'type' : self._(attrName),
|
'type' : self._(attrName),
|
||||||
'value' : attr.get_value(),
|
'value' : attr.get_value(),
|
||||||
|
@ -174,6 +174,8 @@ class DetDescendantReport(Report):
|
|||||||
|
|
||||||
self.__get_date = translator.get_date
|
self.__get_date = translator.get_date
|
||||||
|
|
||||||
|
self.__get_type = translator.get_type
|
||||||
|
|
||||||
self.bibli = Bibliography(Bibliography.MODE_PAGE)
|
self.bibli = Bibliography(Bibliography.MODE_PAGE)
|
||||||
|
|
||||||
def apply_henry_filter(self,person_handle, index, pid, cur_gen=1):
|
def apply_henry_filter(self,person_handle, index, pid, cur_gen=1):
|
||||||
@ -292,6 +294,7 @@ class DetDescendantReport(Report):
|
|||||||
if self.inc_sources:
|
if self.inc_sources:
|
||||||
if self.pgbrkenotes:
|
if self.pgbrkenotes:
|
||||||
self.doc.page_break()
|
self.doc.page_break()
|
||||||
|
# it ignores language set for Note type (use locale)
|
||||||
endnotes.write_endnotes(self.bibli, self.database, self.doc,
|
endnotes.write_endnotes(self.bibli, self.database, self.doc,
|
||||||
printnotes=self.inc_srcnotes)
|
printnotes=self.inc_srcnotes)
|
||||||
|
|
||||||
@ -399,7 +402,7 @@ class DetDescendantReport(Report):
|
|||||||
place = u''
|
place = u''
|
||||||
|
|
||||||
self.doc.start_paragraph('DDR-MoreDetails')
|
self.doc.start_paragraph('DDR-MoreDetails')
|
||||||
event_name = str( event.get_type() )
|
event_name = self.__get_type(event.get_type())
|
||||||
if date and place:
|
if date and place:
|
||||||
text += self._('%(date)s, %(place)s') % {
|
text += self._('%(date)s, %(place)s') % {
|
||||||
'date' : date, 'place' : place }
|
'date' : date, 'place' : place }
|
||||||
@ -431,7 +434,7 @@ class DetDescendantReport(Report):
|
|||||||
for attr in attr_list:
|
for attr in attr_list:
|
||||||
if text:
|
if text:
|
||||||
text += "; "
|
text += "; "
|
||||||
attrName = str(attr.get_type())
|
attrName = self.__get_type(attr.get_type())
|
||||||
text += self._("%(type)s: %(value)s%(endnotes)s") % {
|
text += self._("%(type)s: %(value)s%(endnotes)s") % {
|
||||||
'type' : self._(attrName),
|
'type' : self._(attrName),
|
||||||
'value' : attr.get_value(),
|
'value' : attr.get_value(),
|
||||||
@ -659,7 +662,7 @@ class DetDescendantReport(Report):
|
|||||||
|
|
||||||
for attr in attrs:
|
for attr in attrs:
|
||||||
self.doc.start_paragraph('DDR-MoreDetails')
|
self.doc.start_paragraph('DDR-MoreDetails')
|
||||||
attrName = str(attr.get_type())
|
attrName = self.__get_type(attr.get_type())
|
||||||
text = self._("%(type)s: %(value)s%(endnotes)s") % {
|
text = self._("%(type)s: %(value)s%(endnotes)s") % {
|
||||||
'type' : self._(attrName),
|
'type' : self._(attrName),
|
||||||
'value' : attr.get_value(),
|
'value' : attr.get_value(),
|
||||||
@ -737,10 +740,10 @@ class DetDescendantReport(Report):
|
|||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
first = False
|
first = False
|
||||||
self.doc.start_paragraph('DDR-MoreDetails')
|
self.doc.start_paragraph('DDR-MoreDetails')
|
||||||
atype = str( alt_name.get_type() )
|
atype = self.__get_type(alt_name.get_type())
|
||||||
aname = alt_name.get_regular_name()
|
aname = alt_name.get_regular_name()
|
||||||
self.doc.write_text_citation(self._('%(name_kind)s: %(name)s%(endnotes)s') % {
|
self.doc.write_text_citation(self._('%(name_kind)s: %(name)s%(endnotes)s') % {
|
||||||
'name_kind' : atype,
|
'name_kind' : self._(atype),
|
||||||
'name' : aname,
|
'name' : aname,
|
||||||
'endnotes' : self.endnotes(alt_name),
|
'endnotes' : self.endnotes(alt_name),
|
||||||
})
|
})
|
||||||
@ -792,8 +795,9 @@ class DetDescendantReport(Report):
|
|||||||
|
|
||||||
for attr in attrs:
|
for attr in attrs:
|
||||||
self.doc.start_paragraph('DDR-MoreDetails')
|
self.doc.start_paragraph('DDR-MoreDetails')
|
||||||
|
attrName = self.__get_type(attr.get_type())
|
||||||
text = self._("%(type)s: %(value)s%(endnotes)s") % {
|
text = self._("%(type)s: %(value)s%(endnotes)s") % {
|
||||||
'type' : attr.get_type(),
|
'type' : self._(attrName),
|
||||||
'value' : attr.get_value(),
|
'value' : attr.get_value(),
|
||||||
'endnotes' : self.endnotes(attr) }
|
'endnotes' : self.endnotes(attr) }
|
||||||
self.doc.write_text_citation( text )
|
self.doc.write_text_citation( text )
|
||||||
|
Loading…
Reference in New Issue
Block a user