update Ukrainian relationship calculator (by Fedir)

svn: r22582
This commit is contained in:
Jérôme Rapinat 2013-06-24 06:41:23 +00:00
parent 39395150f7
commit 6d9fbe0238

View File

@ -143,7 +143,7 @@ class RelationshipCalculator(gramps.gen.relationship.RelationshipCalculator):
def __init__(self): def __init__(self):
gramps.gen.relationship.RelationshipCalculator.__init__(self) gramps.gen.relationship.RelationshipCalculator.__init__(self)
def get_sword_distaff(self, level, reltocommon, gender = gen.lib.Person.UNKNOWN): def get_sword_distaff(self, level, reltocommon, gender = Person.UNKNOWN):
""" """
Generate relationships 'by male line' or 'by female line', Generate relationships 'by male line' or 'by female line',
specific for Ukraine specific for Ukraine
@ -159,10 +159,10 @@ class RelationshipCalculator(gramps.gen.relationship.RelationshipCalculator):
break break
by_line = g by_line = g
if by_line == self.REL_FATHER and gender == gen.lib.Person.MALE: if by_line == self.REL_FATHER and gender == Person.MALE:
# by male line # by male line
return " по чоловічій лінії" return " по чоловічій лінії"
elif by_line == self.REL_MOTHER and gender == gen.lib.Person.FEMALE: elif by_line == self.REL_MOTHER and gender == Person.FEMALE:
# by male line # by male line
return " по жіночій лінії" return " по жіночій лінії"
elif reltocommon[0] == self.REL_FATHER: elif reltocommon[0] == self.REL_FATHER:
@ -242,11 +242,11 @@ class RelationshipCalculator(gramps.gen.relationship.RelationshipCalculator):
else: else:
# Grandfather, Greatgrandfather, Greatgreatgrandfather # Grandfather, Greatgrandfather, Greatgreatgrandfather
return t_inlaw + _father_level[level] \ return t_inlaw + _father_level[level] \
+ self.get_sword_distaff(level, reltocommon, gen.lib.Person.MALE) + self.get_sword_distaff(level, reltocommon, Person.MALE)
else: else:
# For deep generations # For deep generations
return t_inlaw + "пра(пра)дід у %d поколінні" % (level + 1) \ return t_inlaw + "пра(пра)дід у %d поколінні" % (level + 1) \
+ self.get_sword_distaff(level, reltocommon, gen.lib.Person.MALE) + self.get_sword_distaff(level, reltocommon, Person.MALE)
def get_mother(self, level, reltocommon, inlaw=''): def get_mother(self, level, reltocommon, inlaw=''):
@ -268,11 +268,11 @@ class RelationshipCalculator(gramps.gen.relationship.RelationshipCalculator):
else: else:
# Grandmother, Greatgrandmother, Greatgreatgrandmother # Grandmother, Greatgrandmother, Greatgreatgrandmother
return t_inlaw + _mother_level[level] \ return t_inlaw + _mother_level[level] \
+ self.get_sword_distaff(level, reltocommon, gen.lib.Person.FEMALE) + self.get_sword_distaff(level, reltocommon, Person.FEMALE)
else: else:
# For deep generations # For deep generations
return t_inlaw + "пра(пра)баба у %d поколінні" % (level + 1) \ return t_inlaw + "пра(пра)баба у %d поколінні" % (level + 1) \
+ self.get_sword_distaff(level, reltocommon, gen.lib.Person.FEMALE) + self.get_sword_distaff(level, reltocommon, Person.FEMALE)
@ -532,12 +532,12 @@ class RelationshipCalculator(gramps.gen.relationship.RelationshipCalculator):
""" """
Return level name depend of gender Return level name depend of gender
""" """
if (gender == gen.lib.Person.MALE): if (gender == Person.MALE):
if level < len(_level_name_male): if level < len(_level_name_male):
return _level_name_male[level] return _level_name_male[level]
else: else:
return "%d-юрідний" % level return "%d-юрідний" % level
elif (gender == gen.lib.Person.FEMALE): elif (gender == Person.FEMALE):
if level < len(_level_name_female): if level < len(_level_name_female):
return _level_name_female[level] return _level_name_female[level]
else: else:
@ -609,13 +609,13 @@ class RelationshipCalculator(gramps.gen.relationship.RelationshipCalculator):
elif Ga == 0: elif Ga == 0:
# b is son/descendant of a # b is son/descendant of a
if gender_b == gen.lib.Person.MALE: if gender_b == Person.MALE:
if inlaw and Gb == 1 and not step: if inlaw and Gb == 1 and not step:
rel_str = "зять" rel_str = "зять"
else: else:
rel_str = self.get_son(Gb, inlaw) rel_str = self.get_son(Gb, inlaw)
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == Person.FEMALE:
if inlaw and Gb == 1 and not step: if inlaw and Gb == 1 and not step:
rel_str = "невістка" rel_str = "невістка"
else: else:
@ -628,13 +628,13 @@ class RelationshipCalculator(gramps.gen.relationship.RelationshipCalculator):
elif Gb == 0: elif Gb == 0:
# b is parent/grand parent of a # b is parent/grand parent of a
if gender_b == gen.lib.Person.MALE: if gender_b == Person.MALE:
if inlaw and Gb == 1 and not step: if inlaw and Gb == 1 and not step:
rel_str = "тесть" rel_str = "тесть"
else: else:
rel_str = self.get_father(Ga, reltocommon_a, inlaw) rel_str = self.get_father(Ga, reltocommon_a, inlaw)
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == Person.FEMALE:
if inlaw and Gb == 1 and not step: if inlaw and Gb == 1 and not step:
rel_str = "теща" rel_str = "теща"
else: else:
@ -652,13 +652,13 @@ class RelationshipCalculator(gramps.gen.relationship.RelationshipCalculator):
# that called in parent RelationshipCalculator # that called in parent RelationshipCalculator
# see Relationship.py # see Relationship.py
if gender_b == gen.lib.Person.MALE: if gender_b == Person.MALE:
if inlaw and not step: if inlaw and not step:
rel_str = "рідний брат" rel_str = "рідний брат"
else: else:
rel_str = "напів рідний брат" rel_str = "напів рідний брат"
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == Person.FEMALE:
if inlaw and not step: if inlaw and not step:
rel_str = "рідна сестра" rel_str = "рідна сестра"
else: else:
@ -669,9 +669,9 @@ class RelationshipCalculator(gramps.gen.relationship.RelationshipCalculator):
elif Gb == 1 and Ga > 1: elif Gb == 1 and Ga > 1:
# b is aunt/uncle of a # b is aunt/uncle of a
if (gender_b == gen.lib.Person.MALE): if (gender_b == Person.MALE):
rel_str = self.get_uncle(Ga, reltocommon_a, inlaw) rel_str = self.get_uncle(Ga, reltocommon_a, inlaw)
elif (gender_b == gen.lib.Person.FEMALE): elif (gender_b == Person.FEMALE):
rel_str = self.get_aunt(Ga, reltocommon_a, inlaw) rel_str = self.get_aunt(Ga, reltocommon_a, inlaw)
else: else:
rel_str = self.get_uncle_aunt_unknown(Ga, reltocommon_a, inlaw) rel_str = self.get_uncle_aunt_unknown(Ga, reltocommon_a, inlaw)
@ -679,9 +679,9 @@ class RelationshipCalculator(gramps.gen.relationship.RelationshipCalculator):
elif Ga == 1 and Gb > 1: elif Ga == 1 and Gb > 1:
# b is niece/nephew of a # b is niece/nephew of a
if (gender_b == gen.lib.Person.MALE): if (gender_b == Person.MALE):
rel_str = self.get_nephew(Gb, reltocommon_b, inlaw) rel_str = self.get_nephew(Gb, reltocommon_b, inlaw)
elif (gender_b == gen.lib.Person.FEMALE): elif (gender_b == Person.FEMALE):
rel_str = self.get_niece(Gb, reltocommon_b, inlaw) rel_str = self.get_niece(Gb, reltocommon_b, inlaw)
else: else:
rel_str = self.get_nephew_niece_unknown(Gb, reltocommon_b, inlaw) rel_str = self.get_nephew_niece_unknown(Gb, reltocommon_b, inlaw)
@ -699,7 +699,7 @@ class RelationshipCalculator(gramps.gen.relationship.RelationshipCalculator):
level_name = self.get_level(Gb, gender_b) level_name = self.get_level(Gb, gender_b)
if (gender_b == gen.lib.Person.MALE): if (gender_b == Person.MALE):
# b is far uncle # b is far uncle
if inlaw != '': if inlaw != '':
t_inlaw = "названий " t_inlaw = "названий "
@ -709,7 +709,7 @@ class RelationshipCalculator(gramps.gen.relationship.RelationshipCalculator):
else: else:
rel_str = t_inlaw + "%s пра(пра)дід в %d поколінні" \ rel_str = t_inlaw + "%s пра(пра)дід в %d поколінні" \
% (level_name, (level)) % (level_name, (level))
elif (gender_b == gen.lib.Person.FEMALE): elif (gender_b == Person.FEMALE):
# b is far aunt # b is far aunt
if inlaw != '': if inlaw != '':
t_inlaw = "названа " t_inlaw = "названа "
@ -733,7 +733,7 @@ class RelationshipCalculator(gramps.gen.relationship.RelationshipCalculator):
level_name = self.get_level(Ga, gender_b) level_name = self.get_level(Ga, gender_b)
level = Gb - Ga + 1 level = Gb - Ga + 1
if (gender_b == gen.lib.Person.MALE): if (gender_b == Person.MALE):
# b is far nephew # b is far nephew
if level == 2: if level == 2:
rel_str = "%s небіж" % level_name rel_str = "%s небіж" % level_name
@ -741,7 +741,7 @@ class RelationshipCalculator(gramps.gen.relationship.RelationshipCalculator):
rel_str = "%s пра(пра)внук у %d поколінні" \ rel_str = "%s пра(пра)внук у %d поколінні" \
% (level_name, level) % (level_name, level)
#rel_str = "%s %s" % (level_name, self.get_nephew(level, reltocommon_b, inlaw)) #rel_str = "%s %s" % (level_name, self.get_nephew(level, reltocommon_b, inlaw))
elif (gender_b == gen.lib.Person.FEMALE): elif (gender_b == Person.FEMALE):
# b is far niece # b is far niece
if level == 2: if level == 2:
rel_str = "%s небога" % level_name rel_str = "%s небога" % level_name
@ -757,11 +757,11 @@ class RelationshipCalculator(gramps.gen.relationship.RelationshipCalculator):
# b is cousin of a # b is cousin of a
level_name = self.get_level(Ga, gender_b) level_name = self.get_level(Ga, gender_b)
if (gender_b == gen.lib.Person.MALE): if (gender_b == Person.MALE):
if inlaw != '': if inlaw != '':
t_inlaw = "названий " t_inlaw = "названий "
rel_str = t_inlaw + "%s брат" % level_name rel_str = t_inlaw + "%s брат" % level_name
elif (gender_b == gen.lib.Person.FEMALE): elif (gender_b == Person.FEMALE):
if inlaw != '': if inlaw != '':
t_inlaw = "названа " t_inlaw = "названа "
rel_str = t_inlaw + "%s сестра" % level_name rel_str = t_inlaw + "%s сестра" % level_name
@ -831,52 +831,52 @@ class RelationshipCalculator(gramps.gen.relationship.RelationshipCalculator):
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 == Person.MALE:
rel_str = 'рідний брат' rel_str = 'рідний брат'
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == Person.FEMALE:
rel_str = 'рідна сестра' rel_str = 'рідна сестра'
else: else:
rel_str = 'рідний(а) брат або сестра' rel_str = 'рідний(а) брат або сестра'
else: else:
if gender_b == gen.lib.Person.MALE: if gender_b == Person.MALE:
rel_str = "названий брат" rel_str = "названий брат"
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == Person.FEMALE:
rel_str = "названа сестра" rel_str = "названа сестра"
else: else:
rel_str = "названий(а) брат або сестра" rel_str = "названий(а) брат або сестра"
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 == Person.MALE:
rel_str = 'брат' rel_str = 'брат'
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == Person.FEMALE:
rel_str = 'сестра' rel_str = 'сестра'
else: else:
rel_str = 'брат або сестра' rel_str = 'брат або сестра'
else: else:
if gender_b == gen.lib.Person.MALE: if gender_b == Person.MALE:
rel_str = "швагро" rel_str = "швагро"
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == Person.FEMALE:
rel_str = "братова" rel_str = "братова"
else: else:
rel_str = "швагро або братова" rel_str = "швагро або братова"
elif sib_type == self.HALF_SIB_FATHER: elif sib_type == self.HALF_SIB_FATHER:
if gender_b == gen.lib.Person.MALE: if gender_b == Person.MALE:
rel_str = "єдинокровний(напіврідний) брат" rel_str = "єдинокровний(напіврідний) брат"
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == Person.FEMALE:
rel_str = "єдинокровна(напіврідна) сестра" rel_str = "єдинокровна(напіврідна) сестра"
else: else:
rel_str = "напіврідний(а) брат/сестра" rel_str = "напіврідний(а) брат/сестра"
elif sib_type == self.HALF_SIB_MOTHER: elif sib_type == self.HALF_SIB_MOTHER:
if gender_b == gen.lib.Person.MALE: if gender_b == Person.MALE:
rel_str = "єдинокровний(напіврідний) брат" rel_str = "єдинокровний(напіврідний) брат"
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == Person.FEMALE:
rel_str = "єдинокровна(напіврідна) сестра" rel_str = "єдинокровна(напіврідна) сестра"
else: else:
rel_str = "напіврідний(а) брат/сестра" rel_str = "напіврідний(а) брат/сестра"
elif sib_type == self.STEP_SIB: elif sib_type == self.STEP_SIB:
if gender_b == gen.lib.Person.MALE: if gender_b == Person.MALE:
rel_str = "зведений брат" rel_str = "зведений брат"
elif gender_b == gen.lib.Person.FEMALE: elif gender_b == Person.FEMALE:
rel_str = "зведена сестра" rel_str = "зведена сестра"
else: else:
rel_str = "зведений брат або сестра" rel_str = "зведений брат або сестра"