fix comma in translated-output Ancestor and Descendant Tree reports

This commit is contained in:
Paul Franklin 2014-04-27 16:17:41 -07:00
parent 4927422d7e
commit a5d7532ba5
4 changed files with 15 additions and 15 deletions

View File

@ -51,7 +51,7 @@ from gramps.gen.plug.menu import (TextOption, NumberOption, BooleanOption,
PersonOption)
from gramps.gen.plug.report import Report, MenuReportOptions, stdoptions
from gramps.gen.plug.report import utils as ReportUtils
from gramps.gen.display.name import displayer as name_displayer
from gramps.gen.display.name import NameDisplay
from gramps.gen.plug.docgen import (FontStyle, ParagraphStyle, GraphicsStyle,
FONT_SANS_SERIF, PARA_ALIGN_CENTER)
from gramps.plugins.lib.libtreebase import *
@ -136,6 +136,7 @@ class TitleN(TitleNoDisplay):
class TitleA(TitleBox):
"""Title class for the report """
def __init__(self, doc, locale):
self._locale = locale
TitleBox.__init__(self, doc, "AC2-Title")
self._ = locale.translation.sgettext
@ -143,7 +144,7 @@ class TitleA(TitleBox):
"""Calculate the title of the report"""
name = ""
if center is not None:
name = name_displayer.display(center)
name = NameDisplay(self._locale).display(center)
# feature request 2356: avoid genitive form
self.text = self._("Ancestor Graph for %s") % name

View File

@ -130,6 +130,7 @@ class PlaceHolderBox(BoxBase):
#------------------------------------------------------------------------
class DescendantTitleBase(TitleBox):
def __init__(self, dbase, doc, locale, boxstr = "CG2-Title"):
self._locale = locale
TitleBox.__init__(self, doc, boxstr)
self.database = dbase
self._ = locale.translation.sgettext
@ -345,10 +346,10 @@ class TitleC(DescendantTitleBase):
#ok we have the children. Make a title off of them
# translators: needed for Arabic, ignore otherwise
cousin_names = _(', ').join(self._get_names(kids))
cousin_names = self._(', ').join(self._get_names(kids))
# FIXME it should be reformatted, but that would mean new translations
self.text = self._("Cousin Chart for ") + cousin_names
self.text = self._("Cousin Chart for %(names)s") % {
'names' : cousin_names}
self.set_box_height_width()

View File

@ -40,7 +40,7 @@ from __future__ import print_function
# Gramps modules
#
#------------------------------------------------------------------------
from gramps.gen.display.name import displayer as name_displayer
from gramps.gen.display.name import NameDisplay
from gramps.gen.lib import EventType, PlaceType, Location
from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback
from gramps.gen.constfunc import STRTYPE, cuni
@ -157,7 +157,7 @@ class NameFormat(GenericFormat):
def _default_format(self, name):
""" display the name as set in preferences """
return name_displayer.sorted_name(name)
return NameDisplay(self._locale).sorted_name(name)
def parse_format(self, name):
""" Parse the name """
@ -861,7 +861,7 @@ class VariableParse(object):
return place_f.parse_format(self.database, place)
def __parse_name(self, person):
name_format = NameFormat(self._in)
name_format = NameFormat(self._in, self._locale)
name = name_format.get_name(person)
return name_format.parse_format(name)

View File

@ -36,7 +36,7 @@ from __future__ import division
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext
from gramps.gen.plug.report import utils as ReportUtils
from gramps.gen.display.name import displayer as name_displayer
from gramps.gen.display.name import NameDisplay
from gramps.plugins.lib.libsubstkeyword import SubstKeywords
from gramps.gen.plug.docgen import (IndexMark, INDEX_TYPE_TOC)
@ -681,7 +681,8 @@ class TitleBox(BoxBase):
def _get_names(self, persons):
""" A helper function that receives a list of persons and
returns their names in a list """
return [name_displayer.display(person) for person in persons]
return [NameDisplay(self._locale).display(person)
for person in persons]
def display(self):
""" display the title box. """
@ -711,9 +712,7 @@ class PageNumberBox(BoxBase):
def __calc_position(self, page):
""" calculate where I am to print on the page(s) """
# translators: needed for Arabic, ignore otherwise
# make sure it's translated, so it can be used below, in "display"
ignore1 = _("(%(x)d,%(y)d)") % {'x':0, 'y':0}
self.text = "(%(x)d,%(y)d)"
self.text = "(%d" + self._(',') + "%d)"
style_sheet = self.doc.get_style_sheet()
style_name = style_sheet.get_draw_style(self.boxstr)
@ -746,10 +745,9 @@ class PageNumberBox(BoxBase):
then display the page number """
if self.text == "":
self.__calc_position(page)
self.text = self._(self.text)
self.doc.draw_text(self.boxstr,
self.text % {'x':page.x_page_num+1, 'y':page.y_page_num+1},
self.text % (page.x_page_num+1, page.y_page_num+1),
self.x_cm, self.y_cm)
class NoteType(object):