3114: Kinship report in french crash under Windows with rtf or pdf output format (contribution by danielg)

svn: r12867
This commit is contained in:
Jérôme Rapinat
2009-08-03 05:43:46 +00:00
parent 6cd32e4b74
commit 5ccc779779

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
@@ -41,128 +40,128 @@ from gen.plug import PluginManager
# à la %sème génération # à la %sème génération
_level_name = [ _level_name = [
"première", u"première",
"deuxième", u"deuxième",
"troisième", u"troisième",
"quatrième", u"quatrième",
"cinquième", u"cinquième",
"sixième", u"sixième",
"septième", u"septième",
"huitième", u"huitième",
"neuvième", u"neuvième",
"dixième", u"dixième",
"onzième", u"onzième",
"douzième", u"douzième",
"treizième", u"treizième",
"quatorzième", u"quatorzième",
"quinzième", u"quinzième",
"seizième", u"seizième",
"dix-septième", u"dix-septième",
"dix-huitième", u"dix-huitième",
"dix-neuvième", u"dix-neuvième",
"vingtième", u"vingtième",
"vingt-et-unième", u"vingt-et-unième",
"vingt-deuxième", u"vingt-deuxième",
"vingt-troisième", u"vingt-troisième",
"vingt-quatrième", u"vingt-quatrième",
"vingt-cinquième", u"vingt-cinquième",
"vingt-sixième", u"vingt-sixième",
"vingt-septième", u"vingt-septième",
"vingt-huitième", u"vingt-huitième",
"vingt-neuvième", u"vingt-neuvième",
"trentième", u"trentième",
] ]
# pour le degrè (canon et civil), limitation 20+20 ainsi que pour # pour le degrè (canon et civil), limitation 20+20 ainsi que pour
# LE [premier] cousin # LE [premier] cousin
_removed_level = [ _removed_level = [
"premier", u"premier",
"deuxième", u"deuxième",
"troisième", u"troisième",
"quatrième", u"quatrième",
"cinquième", u"cinquième",
"sixième", u"sixième",
"septième", u"septième",
"huitième", u"huitième",
"neuvième", u"neuvième",
"dixième", u"dixième",
"onzième", u"onzième",
"douzième", u"douzième",
"treizième", u"treizième",
"quatorzième", u"quatorzième",
"quinzième", u"quinzième",
"seizième", u"seizième",
"dix-septième", u"dix-septième",
"dix-huitième", u"dix-huitième",
"dix-neuvième", u"dix-neuvième",
"vingtième", u"vingtième",
"vingt-et-unième", u"vingt-et-unième",
"vingt-deuxième", u"vingt-deuxième",
"vingt-troisième", u"vingt-troisième",
"vingt-quatrième", u"vingt-quatrième",
"vingt-cinquième", u"vingt-cinquième",
"vingt-sixième", u"vingt-sixième",
"vingt-septième", u"vingt-septième",
"vingt-huitième", u"vingt-huitième",
"vingt-neuvième", u"vingt-neuvième",
"trentième", u"trentième",
"trente-et-unième", u"trente-et-unième",
"trente-deuxième", u"trente-deuxième",
"trente-troisième", u"trente-troisième",
"trente-quatrième", u"trente-quatrième",
"trente-cinquième", u"trente-cinquième",
"trente-sixième", u"trente-sixième",
"trente-septième", u"trente-septième",
"trente-huitième", u"trente-huitième",
"trente-neuvième", u"trente-neuvième",
"quarantième", u"quarantième",
"quanrante-et-unième", u"quanrante-et-unième",
] ]
# listes volontairement limitées | small lists, use generation level if > [5] # listes volontairement limitées | small lists, use generation level if > [5]
_father_level = ["", "le père%s", "le grand-père%s", _father_level = [u"", u"le père%s", u"le grand-père%s",
"l'arrière-grand-père%s", "le trisaïeul%s"] u"l'arrière-grand-père%s", u"le trisaïeul%s"]
_mother_level = ["", "la mère%s", "la grand-mère%s", _mother_level = [u"", u"la mère%s", u"la grand-mère%s",
"l'arrière-grand-mère%s", "la trisaïeule%s"] u"l'arrière-grand-mère%s", u"la trisaïeule%s"]
_son_level = ["", "le fils%s", "le petit-fils%s", _son_level = [u"", u"le fils%s", u"le petit-fils%s",
"l'arrière-petit-fils%s"] u"l'arrière-petit-fils%s"]
_daughter_level = ["", "la fille%s", "la petite-fille%s", _daughter_level = [u"", u"la fille%s", u"la petite-fille%s",
"l'arrière-petite-fille%s"] u"l'arrière-petite-fille%s"]
_sister_level = ["", "la sœur%s", "la tante%s", "la grand-tante%s", _sister_level = [u"", u"la sœur%s", u"la tante%s", u"la grand-tante%s",
"l'arrière-grand-tante%s"] u"l'arrière-grand-tante%s"]
_brother_level = ["", "le frère%s", "l'oncle%s", "le grand-oncle%s", _brother_level = [u"", u"le frère%s", u"l'oncle%s", u"le grand-oncle%s",
"l'arrière-grand-oncle%s"] u"l'arrière-grand-oncle%s"]
_nephew_level = ["", "le neveu%s", "le petit-neveu%s", _nephew_level = [u"", u"le neveu%s", u"le petit-neveu%s",
"l'arrière-petit-neveu%s"] "l'arrière-petit-neveu%s"]
_niece_level = ["", "la nièce%s", "la petite-nièce%s", _niece_level = [u"", "la nièce%s", "la petite-nièce%s",
"l'arrière-petite-nièce%s"] u"l'arrière-petite-nièce%s"]
# kinship report # kinship report
_parents_level = ["", "les parents", "les grands-parents", _parents_level = [u"", u"les parents", u"les grands-parents",
"les arrières-grands-parents", "les trisaïeux"] u"les arrières-grands-parents", u"les trisaïeux"]
_children_level = ["", "les enfants", "les petits-enfants", _children_level = [u"", u"les enfants", u"les petits-enfants",
"les arrières-petits-enfants", u"les arrières-petits-enfants",
"les arrières-arrières-petits-enfants"] u"les arrières-arrières-petits-enfants"]
_siblings_level = ["", "les frères et les sœurs", _siblings_level = [u"", u"les frères et les sœurs",
"les oncles et les tantes", u"les oncles et les tantes",
"les grands-oncles et les grands-tantes", u"les grands-oncles et les grands-tantes",
"les arrières-grands-oncles et les arrières-grands-tantes"] u"les arrières-grands-oncles et les arrières-grands-tantes"]
_nephews_nieces_level = ["", "les neveux et les nièces", _nephews_nieces_level = [u"", u"les neveux et les nièces",
"les petits-neveux et les petites-nièces", u"les petits-neveux et les petites-nièces",
"les arrière-petits-neveux et les arrières-petites-nièces"] u"les arrière-petits-neveux et les arrières-petites-nièces"]
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -173,7 +172,7 @@ _nephews_nieces_level = ["", "les neveux et les nièces",
class RelationshipCalculator(Relationship.RelationshipCalculator): class RelationshipCalculator(Relationship.RelationshipCalculator):
INLAW = ' (par alliance)' INLAW = u' (par alliance)'
def __init__(self): def __init__(self):
Relationship.RelationshipCalculator.__init__(self) Relationship.RelationshipCalculator.__init__(self)
@@ -184,104 +183,104 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
def get_cousin(self, level, removed, dir="", inlaw=""): def get_cousin(self, level, removed, dir="", inlaw=""):
if removed == 0 and level < len(_level_name): if removed == 0 and level < len(_level_name):
return "le %s cousin%s" % (_removed_level[level - 1], inlaw) return u"le %s cousin%s" % (_removed_level[level - 1], inlaw)
elif level < removed: elif level < removed:
rel_str = self.get_uncle(level - 1, inlaw) rel_str = self.get_uncle(level - 1, inlaw)
else: else:
# limitation gen = 29 # limitation gen = 29
return "le cousin lointain, relié à la %s génération" % \ return u"le cousin lointain, relié à la %s génération" % \
_level_name[removed] _level_name[removed]
def get_cousine(self, level, removed, dir="", inlaw=""): def get_cousine(self, level, removed, dir="", inlaw=""):
if removed == 0 and level < len(_level_name): if removed == 0 and level < len(_level_name):
return "la %s cousine%s" % (_level_name[level - 1], inlaw) return u"la %s cousine%s" % (_level_name[level - 1], inlaw)
elif level < removed: elif level < removed:
rel_str = self.get_aunt(level - 1, inlaw) rel_str = self.get_aunt(level - 1, inlaw)
else: else:
return "la cousine lointaine, reliée à la %s génération" % \ return u"la cousine lointaine, reliée à la %s génération" % \
_level_name[removed] _level_name[removed]
def get_parents(self, level): def get_parents(self, level):
if level > len(_parents_level) - 1: if level > len(_parents_level) - 1:
return "les ascendants lointains, à la %s génération" % \ return u"les ascendants lointains, à la %s génération" % \
_level_name[level] _level_name[level]
else: else:
return _parents_level[level] return _parents_level[level]
def get_father(self, level, inlaw=""): def get_father(self, level, inlaw=""):
if level > len(_father_level) - 1: if level > len(_father_level) - 1:
return "l'ascendant lointain, à la %s génération" % \ return u"l'ascendant lointain, à la %s génération" % \
_level_name[level] _level_name[level]
else: else:
return _father_level[level] % inlaw return _father_level[level] % inlaw
def get_mother(self, level, inlaw=""): def get_mother(self, level, inlaw=""):
if level > len(_mother_level) - 1: if level > len(_mother_level) - 1:
return "l'ascendante lointaine, à la %s génération" % \ return u"l'ascendante lointaine, à la %s génération" % \
_level_name[level] _level_name[level]
else: else:
return _mother_level[level] % inlaw return _mother_level[level] % inlaw
def get_parent_unknown(self, level, inlaw=""): def get_parent_unknown(self, level, inlaw=""):
if level > len(_level_name) - 1: if level > len(_level_name) - 1:
return "l'ascendant lointain, à la %s génération" % \ return u"l'ascendant lointain, à la %s génération" % \
_level_name[level] _level_name[level]
elif level == 1: elif level == 1:
return "un parent%s" % inlaw return u"un parent%s" % inlaw
else: else:
return "un parent lointain%s" % inlaw return u"un parent lointain%s" % inlaw
def get_son(self, level, inlaw=""): def get_son(self, level, inlaw=""):
if level > len(_son_level) - 1: if level > len(_son_level) - 1:
return "le descendant lointain, à la %s génération" % \ return u"le descendant lointain, à la %s génération" % \
_level_name[level + 1] _level_name[level + 1]
else: else:
return _son_level[level] % inlaw return _son_level[level] % inlaw
def get_daughter(self, level, inlaw=""): def get_daughter(self, level, inlaw=""):
if level > len(_daughter_level) - 1: if level > len(_daughter_level) - 1:
return "la descendante lointaine, à la %s génération" % \ return u"la descendante lointaine, à la %s génération" % \
_level_name[level + 1] _level_name[level + 1]
else: else:
return _daughter_level[level] % inlaw return _daughter_level[level] % inlaw
def get_child_unknown(self, level, inlaw=""): def get_child_unknown(self, level, inlaw=""):
if level > len(_level_name) - 1: if level > len(_level_name) - 1:
return "le descendant lointain, à la %s génération" % \ return u"le descendant lointain, à la %s génération" % \
_level_name[level + 1] _level_name[level + 1]
elif level == 1: elif level == 1:
return "un enfant%s" % inlaw return u"un enfant%s" % inlaw
else: else:
return "un descendant lointain%s" % inlaw return u"un descendant lointain%s" % inlaw
def get_sibling_unknown(self, level, inlaw=""): def get_sibling_unknown(self, level, inlaw=""):
return "un parent lointain%s" % inlaw return u"un parent lointain%s" % inlaw
def get_uncle(self, level, inlaw=""): def get_uncle(self, level, inlaw=""):
if level > len(_brother_level) - 1: if level > len(_brother_level) - 1:
return "l'oncle lointain, relié à la %s génération" % \ return u"l'oncle lointain, relié à la %s génération" % \
_level_name[level] _level_name[level]
else: else:
return _brother_level[level] % inlaw return _brother_level[level] % inlaw
def get_aunt(self, level, inlaw=""): def get_aunt(self, level, inlaw=""):
if level > len(_sister_level) - 1: if level > len(_sister_level) - 1:
return "la tante lointaine, reliée à la %s génération" % \ return u"la tante lointaine, reliée à la %s génération" % \
_level_name[level] _level_name[level]
else: else:
return _sister_level[level] % inlaw return _sister_level[level] % inlaw
def get_nephew(self, level, inlaw=""): def get_nephew(self, level, inlaw=""):
if level > len(_nephew_level) - 1: if level > len(_nephew_level) - 1:
return "le neveu lointain, à la %s génération" % _level_name[level] return u"le neveu lointain, à la %s génération" % _level_name[level]
else: else:
return _nephew_level[level] % inlaw return _nephew_level[level] % inlaw
def get_niece(self, level, inlaw=""): def get_niece(self, level, inlaw=""):
if level > len(_niece_level) - 1: if level > len(_niece_level) - 1:
return "la nièce lointaine, à la %s génération" % \ return u"la nièce lointaine, à la %s génération" % \
_level_name[level] _level_name[level]
else: else:
return _niece_level[level] % inlaw return _niece_level[level] % inlaw
@@ -293,10 +292,10 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
voir Relationship.py voir Relationship.py
""" """
rel_str = "des parents lointains" rel_str = u"des parents lointains"
gen = " à la %sème génération" gen = u" à la %sème génération"
bygen = " par la %sème génération" bygen = u" par la %sème génération"
cmt = " (frères ou sœurs d'un ascendant" + gen % Ga + ")" cmt = u" (frères ou sœurs d'un ascendant" + gen % Ga + ")"
if Ga == 0: if Ga == 0:
# These are descendants # These are descendants
@@ -304,7 +303,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
if Gb < len(_children_level): if Gb < len(_children_level):
rel_str = _children_level[Gb] rel_str = _children_level[Gb]
else: else:
rel_str = "les descendants" + gen % (Gb + 1) rel_str = u"les descendants" + gen % (Gb + 1)
elif Gb == 0: elif Gb == 0:
# These are parents/grand parents # These are parents/grand parents
@@ -312,7 +311,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
if Ga < len(_parents_level): if Ga < len(_parents_level):
rel_str = _parents_level[Ga] rel_str = _parents_level[Ga]
else: else:
rel_str = "les ascendants" + gen % (Ga + 1) rel_str = u"les ascendants" + gen % (Ga + 1)
elif Gb == 1: elif Gb == 1:
# These are siblings/aunts/uncles # These are siblings/aunts/uncles
@@ -320,7 +319,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
if Ga < len(_siblings_level): if Ga < len(_siblings_level):
rel_str = _siblings_level[Ga] rel_str = _siblings_level[Ga]
else: else:
rel_str = "Les enfants d'un ascendant" + gen % (Ga + 1) + \ rel_str = u"Les enfants d'un ascendant" + gen % (Ga + 1) + \
cmt cmt
elif Ga == 1: elif Ga == 1:
@@ -329,25 +328,25 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
if Gb < len(_nephews_nieces_level): if Gb < len(_nephews_nieces_level):
rel_str = _nephews_nieces_level[Gb - 1] rel_str = _nephews_nieces_level[Gb - 1]
else: else:
rel_str = "les neveux et les nièces" + gen % Gb rel_str = u"les neveux et les nièces" + gen % Gb
elif Ga > 1 and Ga == Gb: elif Ga > 1 and Ga == Gb:
# These are cousins in the same generation # These are cousins in the same generation
# use custom level for latin words # use custom level for latin words
if Ga == 2: if Ga == 2:
rel_str = "les cousins germains et cousines germaines" rel_str = u"les cousins germains et cousines germaines"
elif Ga <= len(_level_name): elif Ga <= len(_level_name):
# %ss for plural # %ss for plural
rel_str = "les %ss cousins et cousines" % _level_name[Ga - rel_str = u"les %ss cousins et cousines" % _level_name[Ga -
2] 2]
else: else:
# security # security
rel_str = "les cousins et cousines" rel_str = u"les cousins et cousines"
elif Ga > 1 and Ga > Gb: elif Ga > 1 and Ga > Gb:
# These are cousins in different generations with the second person # These are cousins in different generations with the second person
@@ -356,18 +355,18 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# use custom level for latin words and specific relation # use custom level for latin words and specific relation
if Ga == 3 and Gb == 2: if Ga == 3 and Gb == 2:
desc = " (cousins germains d'un parent)" desc = u" (cousins germains d'un parent)"
rel_str = "les oncles et tantes à la mode de Bretagne" + \ rel_str = u"les oncles et tantes à la mode de Bretagne" + \
desc desc
elif Gb <= len(_level_name) and Ga - Gb < len(_removed_level) and \ elif Gb <= len(_level_name) and Ga - Gb < len(_removed_level) and \
Ga + Gb + 1 < len(_removed_level): Ga + Gb + 1 < len(_removed_level):
can = " du %s au %s degré (canon)" % (_removed_level[Gb], can = u" du %s au %s degré (canon)" % (_removed_level[Gb],
_removed_level[Ga]) _removed_level[Ga])
civ = " et au %s degré (civil)" % _removed_level[Ga + Gb + civ = u" et au %s degré (civil)" % _removed_level[Ga + Gb +
1] 1]
rel_str = "les oncles et tantes" + can + civ rel_str = u"les oncles et tantes" + can + civ
elif Ga < len(_level_name): elif Ga < len(_level_name):
rel_str = "les grands-oncles et grands-tantes" + bygen % \ rel_str = u"les grands-oncles et grands-tantes" + bygen % \
(Ga + 1) (Ga + 1)
else: else:
return rel_str return rel_str
@@ -379,18 +378,18 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# use custom level for latin words and specific relation # use custom level for latin words and specific relation
if Ga == 2 and Gb == 3: if Ga == 2 and Gb == 3:
info = " (cousins issus d'un germain)" info = u" (cousins issus d'un germain)"
rel_str = "les neveux et nièces à la mode de Bretagne" + \ rel_str = u"les neveux et nièces à la mode de Bretagne" + \
info info
elif Ga <= len(_level_name) and Gb - Ga < len(_removed_level) and \ elif Ga <= len(_level_name) and Gb - Ga < len(_removed_level) and \
Ga + Gb + 1 < len(_removed_level): Ga + Gb + 1 < len(_removed_level):
can = " du %s au %s degré (canon)" % (_removed_level[Gb], can = u" du %s au %s degré (canon)" % (_removed_level[Gb],
_removed_level[Ga]) _removed_level[Ga])
civ = " et au %s degré (civil)" % _removed_level[Ga + Gb + civ = u" et au %s degré (civil)" % _removed_level[Ga + Gb +
1] 1]
rel_str = "les neveux et nièces" + can + civ rel_str = u"les neveux et nièces" + can + civ
elif Ga < len(_level_name): elif Ga < len(_level_name):
rel_str = "les neveux et nièces" + bygen % Gb rel_str = u"les neveux et nièces" + bygen % Gb
else: else:
return rel_str return rel_str
return rel_str return rel_str
@@ -421,22 +420,22 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
if in_law_a or in_law_b: if in_law_a or in_law_b:
inlaw = self.INLAW inlaw = self.INLAW
else: else:
inlaw = "" inlaw = u""
rel_str = "un parent lointains%s" % inlaw rel_str = u"un parent lointains%s" % inlaw
bygen = " par la %sème génération" bygen = u" par la %sème génération"
if Ga == 0: if Ga == 0:
# b is descendant of a # b is descendant of a
if Gb == 0: if Gb == 0:
rel_str = 'le même individu' rel_str = u"le même individu"
elif gender_b == gen.lib.Person.MALE and Gb < len(_son_level): elif gender_b == gen.lib.Person.MALE and Gb < len(_son_level):
# spouse of daughter # spouse of daughter
if inlaw and Gb == 1 and not step: if inlaw and Gb == 1 and not step:
rel_str = "le gendre" rel_str = u"le gendre"
else: else:
rel_str = self.get_son(Gb) rel_str = self.get_son(Gb)
elif gender_b == gen.lib.Person.FEMALE and Gb < len(_daughter_level): elif gender_b == gen.lib.Person.FEMALE and Gb < len(_daughter_level):
@@ -444,17 +443,17 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# spouse of son # spouse of son
if inlaw and Gb == 1 and not step: if inlaw and Gb == 1 and not step:
rel_str = "la bru" rel_str = u"la bru"
else: else:
rel_str = self.get_daughter(Gb) rel_str = self.get_daughter(Gb)
elif Gb < len(_level_name) and gender_b == gen.lib.Person.MALE: elif Gb < len(_level_name) and gender_b == gen.lib.Person.MALE:
# don't display inlaw # don't display inlaw
rel_str = "le descendant lointain (%dème génération)" % \ rel_str = u"le descendant lointain (%dème génération)" % \
(Gb + 1) (Gb + 1)
elif Gb < len(_level_name) and gender_b == gen.lib.Person.FEMALE: elif Gb < len(_level_name) and gender_b == gen.lib.Person.FEMALE:
rel_str = "la descendante lointaine (%dème génération)" % \ rel_str = u"la descendante lointaine (%dème génération)" % \
(Gb + 1) (Gb + 1)
else: else:
return self.get_child_unknown(Gb) return self.get_child_unknown(Gb)
@@ -467,12 +466,12 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# other spouse of father (new parent) # other spouse of father (new parent)
if Ga == 1 and inlaw and self.STEP_SIB: if Ga == 1 and inlaw and self.STEP_SIB:
rel_str = "le beau-père" rel_str = u"le beau-père"
elif Ga == 1 and inlaw: elif Ga == 1 and inlaw:
# father of spouse (family of spouse) # father of spouse (family of spouse)
rel_str = "le père du conjoint" rel_str = u"le père du conjoint"
else: else:
rel_str = self.get_father(Ga, inlaw) rel_str = self.get_father(Ga, inlaw)
elif gender_b == gen.lib.Person.FEMALE and Ga < len(_mother_level): elif gender_b == gen.lib.Person.FEMALE and Ga < len(_mother_level):
@@ -480,19 +479,19 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# other spouse of mother (new parent) # other spouse of mother (new parent)
if Ga == 1 and inlaw and self.STEP_SIB: if Ga == 1 and inlaw and self.STEP_SIB:
rel_str = "la belle-mère" rel_str = u"la belle-mère"
elif Ga == 1 and inlaw: elif Ga == 1 and inlaw:
# mother of spouse (family of spouse) # mother of spouse (family of spouse)
rel_str = "la mère du conjoint" rel_str = u"la mère du conjoint"
else: else:
rel_str = self.get_mother(Ga, inlaw) rel_str = self.get_mother(Ga, inlaw)
elif Ga < len(_level_name) and gender_b == gen.lib.Person.MALE: elif Ga < len(_level_name) and gender_b == gen.lib.Person.MALE:
rel_str = "l'ascendant lointain%s (%dème génération)" % \ rel_str = u"l'ascendant lointain%s (%dème génération)" % \
(inlaw, Ga + 1) (inlaw, Ga + 1)
elif Ga < len(_level_name) and gender_b == gen.lib.Person.FEMALE: elif Ga < len(_level_name) and gender_b == gen.lib.Person.FEMALE:
rel_str = "l'ascendante lointaine%s (%dème génération)" % \ rel_str = u"l'ascendante lointaine%s (%dème génération)" % \
(inlaw, Ga + 1) (inlaw, Ga + 1)
else: else:
return self.get_parent_unknown(Ga, inlaw) return self.get_parent_unknown(Ga, inlaw)
@@ -509,9 +508,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# don't display inlaw # don't display inlaw
if gender_b == gen.lib.Person.MALE: if gender_b == gen.lib.Person.MALE:
rel_str = "l'oncle lointain" + bygen % (Ga + 1) rel_str = u"l'oncle lointain" + bygen % (Ga + 1)
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == gen.lib.Person.FEMALE:
rel_str = "la tante lointaine" + bygen % (Ga + 1) rel_str = u"la tante lointaine" + bygen % (Ga + 1)
elif gender_b == gen.lib.Person.UNKNOWN: elif gender_b == gen.lib.Person.UNKNOWN:
rel_str = self.get_sibling_unknown(Ga, inlaw) rel_str = self.get_sibling_unknown(Ga, inlaw)
else: else:
@@ -526,10 +525,10 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
rel_str = self.get_niece(Gb - 1, inlaw) rel_str = self.get_niece(Gb - 1, inlaw)
else: else:
if gender_b == gen.lib.Person.MALE: if gender_b == gen.lib.Person.MALE:
rel_str = "le neveu lointain%s (%dème génération)" % \ rel_str = u"le neveu lointain%s (%dème génération)" % \
(inlaw, Gb) (inlaw, Gb)
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == gen.lib.Person.FEMALE:
rel_str = "la nièce lointaine%s (%dème génération)" % \ rel_str = u"la nièce lointaine%s (%dème génération)" % \
(inlaw, Gb) (inlaw, Gb)
elif gender_b == gen.lib.Person.UNKNOWN: elif gender_b == gen.lib.Person.UNKNOWN:
rel_str = self.get_sibling_unknown(Ga, inlaw) rel_str = self.get_sibling_unknown(Ga, inlaw)
@@ -556,25 +555,25 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
if Ga == 3 and Gb == 2: if Ga == 3 and Gb == 2:
if gender_b == gen.lib.Person.MALE: if gender_b == gen.lib.Person.MALE:
desc = " (cousin germain d'un parent)" desc = u" (cousin germain d'un parent)"
rel_str = "l'oncle à la mode de Bretagne" + desc rel_str = u"l'oncle à la mode de Bretagne" + desc
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == gen.lib.Person.FEMALE:
desc = " (cousine germaine d'un parent)" desc = u" (cousine germaine d'un parent)"
rel_str = "la tante à la mode de Bretagne" + desc rel_str = u"la tante à la mode de Bretagne" + desc
elif gender_b == gen.lib.Person.UNKNOWN: elif gender_b == gen.lib.Person.UNKNOWN:
return self.get_sibling_unknown(Ga, inlaw) return self.get_sibling_unknown(Ga, inlaw)
else: else:
return rel_str return rel_str
elif Gb <= len(_level_name) and Ga - Gb < len(_removed_level) and \ elif Gb <= len(_level_name) and Ga - Gb < len(_removed_level) and \
Ga + Gb + 1 < len(_removed_level): Ga + Gb + 1 < len(_removed_level):
can = " du %s au %s degré (canon)" % (_removed_level[Gb], can = u" du %s au %s degré (canon)" % (_removed_level[Gb],
_removed_level[Ga]) _removed_level[Ga])
civ = " et au %s degré (civil)" % _removed_level[Ga + Gb + civ = u" et au %s degré (civil)" % _removed_level[Ga + Gb +
1] 1]
if gender_b == gen.lib.Person.MALE: if gender_b == gen.lib.Person.MALE:
rel_str = "l'oncle" + can + civ rel_str = u"l'oncle" + can + civ
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == gen.lib.Person.FEMALE:
rel_str = "la tante" + can + civ rel_str = u"la tante" + can + civ
elif gender_b == gen.lib.Person.UNKNOWN: elif gender_b == gen.lib.Person.UNKNOWN:
rel_str = self.get_sibling_unknown(Ga, inlaw) rel_str = self.get_sibling_unknown(Ga, inlaw)
else: else:
@@ -595,25 +594,25 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# first person. # first person.
if Ga == 2 and Gb == 3: if Ga == 2 and Gb == 3:
info = " (cousins issus d'un germain)" info = u" (cousins issus d'un germain)"
if gender_b == gen.lib.Person.MALE: if gender_b == gen.lib.Person.MALE:
rel_str = "le neveu à la mode de Bretagne" + info rel_str = u"le neveu à la mode de Bretagne" + info
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == gen.lib.Person.FEMALE:
rel_str = "la nièce à la mode de Bretagne" + info rel_str = u"la nièce à la mode de Bretagne" + info
elif gender_b == gen.lib.Person.UNKNOWN: elif gender_b == gen.lib.Person.UNKNOWN:
rel_str = self.get_sibling_unknown(Ga, inlaw) rel_str = self.get_sibling_unknown(Ga, inlaw)
else: else:
return rel_str return rel_str
elif Ga <= len(_level_name) and Gb - Ga < len(_removed_level) and \ elif Ga <= len(_level_name) and Gb - Ga < len(_removed_level) and \
Ga + Gb + 1 < len(_removed_level): Ga + Gb + 1 < len(_removed_level):
can = " du %s au %s degré (canon)" % (_removed_level[Gb], can = u" du %s au %s degré (canon)" % (_removed_level[Gb],
_removed_level[Ga]) _removed_level[Ga])
civ = " et au %s degré (civil)" % _removed_level[Ga + Gb + civ = u" et au %s degré (civil)" % _removed_level[Ga + Gb +
1] 1]
if gender_b == gen.lib.Person.MALE: if gender_b == gen.lib.Person.MALE:
rel_str = "le neveu" + can + civ rel_str = u"le neveu" + can + civ
if gender_b == gen.lib.Person.FEMALE: if gender_b == gen.lib.Person.FEMALE:
rel_str = "la nièce" + can + civ rel_str = u"la nièce" + can + civ
elif gender_b == gen.lib.Person.UNKNOWN: elif gender_b == gen.lib.Person.UNKNOWN:
rel_str = self.get_sibling_unknown(Ga, inlaw) rel_str = self.get_sibling_unknown(Ga, inlaw)
else: else:
@@ -639,65 +638,65 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
if in_law_a or in_law_b: if in_law_a or in_law_b:
inlaw = self.INLAW inlaw = self.INLAW
else: else:
inlaw = "" inlaw = u""
if sib_type == self.NORM_SIB: if sib_type == self.NORM_SIB:
if not inlaw: if not inlaw:
if gender_b == gen.lib.Person.MALE: if gender_b == gen.lib.Person.MALE:
rel_str = 'le frère (germain)' rel_str = u"le frère (germain)"
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == gen.lib.Person.FEMALE:
rel_str = 'la sœur (germaine)' rel_str = u"la sœur (germaine)"
else: else:
rel_str = 'le frère ou la sœur germain(e)' rel_str = u"le frère ou la sœur germain(e)"
else: else:
if gender_b == gen.lib.Person.MALE: if gender_b == gen.lib.Person.MALE:
rel_str = "le beau-frère" rel_str = u"le beau-frère"
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == gen.lib.Person.FEMALE:
rel_str = "la belle-sœur" rel_str = u"la belle-sœur"
else: else:
rel_str = "le beau-frère ou la belle-sœur" rel_str = u"le beau-frère ou la belle-sœur"
elif sib_type == self.UNKNOWN_SIB: elif sib_type == self.UNKNOWN_SIB:
if not inlaw: if not inlaw:
if gender_b == gen.lib.Person.MALE: if gender_b == gen.lib.Person.MALE:
rel_str = 'le frère' rel_str = u"le frère"
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == gen.lib.Person.FEMALE:
rel_str = 'la sœur' rel_str = u"la sœur"
else: else:
rel_str = 'le frère ou la sœur' rel_str = u"le frère ou la sœur"
else: else:
if gender_b == gen.lib.Person.MALE: if gender_b == gen.lib.Person.MALE:
rel_str = "le beau-frère" rel_str = u"le beau-frère"
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == gen.lib.Person.FEMALE:
rel_str = "la belle-sœur" rel_str = u"la belle-sœur"
else: else:
rel_str = "le beau-frère ou la belle-sœur" rel_str = u"le beau-frère ou la belle-sœur"
elif sib_type == self.HALF_SIB_MOTHER: elif sib_type == self.HALF_SIB_MOTHER:
# Logique inversée ! Pourquoi ? # Logique inversée ! Pourquoi ?
if gender_b == gen.lib.Person.MALE: if gender_b == gen.lib.Person.MALE:
rel_str = "le demi-frère consanguin" rel_str = u"le demi-frère consanguin"
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == gen.lib.Person.FEMALE:
rel_str = "la demi-sœur consanguine" rel_str = u"la demi-sœur consanguine"
else: else:
rel_str = "le demi-frère ou la demi-sœur consanguin(e)" rel_str = u"le demi-frère ou la demi-sœur consanguin(e)"
elif sib_type == self.HALF_SIB_FATHER: elif sib_type == self.HALF_SIB_FATHER:
# Logique inversée ! Pourquoi ? # Logique inversée ! Pourquoi ?
if gender_b == gen.lib.Person.MALE: if gender_b == gen.lib.Person.MALE:
rel_str = "le demi-frère utérin" rel_str = u"le demi-frère utérin"
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == gen.lib.Person.FEMALE:
rel_str = "la demi-sœur utérine" rel_str = u"la demi-sœur utérine"
else: else:
rel_str = "le demi-frère ou la demi-sœur utérin(e)" rel_str = u"le demi-frère ou la demi-sœur utérin(e)"
elif sib_type == self.STEP_SIB: elif sib_type == self.STEP_SIB:
if gender_b == gen.lib.Person.MALE: if gender_b == gen.lib.Person.MALE:
rel_str = "le demi-frère" rel_str = u"le demi-frère"
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == gen.lib.Person.FEMALE:
rel_str = "la demi-sœur" rel_str = u"la demi-sœur"
else: else:
rel_str = "le demi-frère ou la demi-sœur" rel_str = u"le demi-frère ou la demi-sœur"
return rel_str return rel_str