Compare commits

..

10 Commits

Author SHA1 Message Date
romjerome
fe0f125ad6 test if 'lmodern' exists 2019-12-14 19:10:51 +01:00
romjerome
e8b63987ac pylint ... 2019-12-14 19:04:48 +01:00
romjerome
461ee4fe5c pylint 2019-12-14 18:55:39 +01:00
romjerome
d571516212 better variable name for lang 2019-12-09 20:53:24 +01:00
romjerome
9208b8a3a8 polish, use LATIN group 2019-12-07 09:06:06 +01:00
romjerome
9e013f6781 do not need to load 'lmodern' every time 2019-12-07 09:00:54 +01:00
romjerome
c460506e4f Need 'lmodern' for some non-ASCII char 2019-12-07 08:56:12 +01:00
romjerome
3fcb9411dc typo 2019-12-07 08:41:54 +01:00
romjerome
f7a50a0e74 limit locale set to supported lang (genealogytree) 2019-12-07 08:39:42 +01:00
romjerome
6709d37526 fix issues around localization
* specific non-ASCII characters related to our locale are not displayed on PDF
* date cannot be parsed (one calendar format and in english)
genealogytree macro needs a lang set in english
2019-12-06 22:49:37 +01:00

View File

@@ -46,8 +46,14 @@ from ..menu import NumberOption, TextOption, EnumeratedListOption
from ...constfunc import win
from ...config import config
from ...const import GRAMPS_LOCALE as glocale
from ...utils.grampslocale import GrampsLocale
_ = glocale.translation.gettext
LOCALE = GrampsLocale(lang='en')
LATIN = ['french', 'italian', 'spanish']
LANG_SUPPORT = ['danish', 'dutch', 'german', 'swedish'] + LATIN
#-------------------------------------------------------------------------
#
# set up logging
@@ -69,12 +75,6 @@ _MARRIAGE = [{'name': _("Default"), 'value': ""},
{'name': _("Below"), 'value': "marriage below"},
{'name': _("Not shown"), 'value': "no marriage"}]
_OCCUPATION = [{'name': _("Do not include"), 'value': "no"},
{'name': _("Only description"), 'value': "basic"},
{'name': _("Use date"), 'value': "date"},
{'name': _("Use place"), 'value': "place"},
{'name': _("Use date and place"), 'value': "date place"}]
_COLOR = [{'name': _("None"), 'value': "none"},
{'name': _("Default"), 'value': "default"},
{'name': _("Preferences"), 'value': "preferences"}]
@@ -159,12 +159,6 @@ class TreeOptions:
marriage.set_help(_("Position of marriage information."))
menu.add_option(category, "marriage", marriage)
occupation = EnumeratedListOption(_("Occupation"), "")
for item in _OCCUPATION:
occupation.add_item(item["value"], item["name"])
occupation.set_help(_("Details of occupation information."))
menu.add_option(category, "occupation", occupation)
nodesize = NumberOption(_("Node size"), 25, 5, 100, 5)
nodesize.set_help(_("One dimension of a node, in mm. If the timeflow "
"is up or down then this is the width, otherwise "
@@ -294,7 +288,6 @@ class TreeDocBase(BaseDoc, TreeDoc):
self.detail = get_option('detail').get_value()
self.marriage = get_option('marriage').get_value()
self.occupation = get_option('occupation').get_value()
self.nodesize = get_option('nodesize').get_value()
self.levelsize = get_option('levelsize').get_value()
self.nodecolor = get_option('nodecolor').get_value()
@@ -352,6 +345,14 @@ class TreeDocBase(BaseDoc, TreeDoc):
self.write(0, '\\usepackage[%s,%s]{geometry}\n' % (paper, margin))
self.write(0, '\\usepackage[all]{genealogytree}\n')
self.write(0, '\\usepackage{color}\n')
trans = glocale.language[0][:2]
lang = LOCALE._get_language_string(trans).lower()
if lang in LANG_SUPPORT:
self.write(0, '\\gtrset{language=%s}\n' % lang)
if lang in LATIN:
self.write(0, '\\IfFileExists{lmodern.sty}{\n')
self.write(0, ' \\usepackage{lmodern}\n')
self.write(0, '}{}\n')
self.write(0, '\\begin{document}\n')
if self.nodecolor == 'preferences':
@@ -462,9 +463,8 @@ class TreeDocBase(BaseDoc, TreeDoc):
# Comparison with 'Occupation' for backwards compatibility with Gramps 5.0
attr_type = str(attr.get_type())
if attr_type in ('Occupation', _('Occupation')):
if self.occupation != "no":
self.write(level+1, 'profession = {%s},\n' %
escape(attr.get_value()))
self.write(level+1, 'profession = {%s},\n' %
escape(attr.get_value()))
if attr_type == 'Comment':
self.write(level+1, 'comment = {%s},\n' %
escape(attr.get_value()))
@@ -508,8 +508,6 @@ class TreeDocBase(BaseDoc, TreeDoc):
elif event.type == EventType.CREMATION:
event_type = 'burial'
modifier = 'cremated'
elif event.type == EventType.OCCUPATION:
event_type = 'occupation'
else:
return
@@ -536,17 +534,6 @@ class TreeDocBase(BaseDoc, TreeDoc):
place = escape(_pd.display_event(db, event))
if event_type == 'occupation' and self.occupation != "no":
description = escape(event.description)
self.write(level, 'profession = {%s}' % description)
if self.occupation == "date":
self.write(level+1, '{%s}' % date_str)
if self.occupation == "place":
self.write(level+1, '{%s}' % place)
if self.occupation == "date place":
self.write(level+1, '{%s}\, {%s}' % (date_str, place))
self.write(level, ',\n')
if modifier:
event_type += '+'
self.write(level, '%s = {%s}{%s}{%s},\n' %