Make in-law relationships easier to translate for the Kinship Report.

svn: r14053
This commit is contained in:
Brian Matherly 2010-01-13 04:31:42 +00:00
parent 623e39d0a8
commit 4b1c61a6e7
8 changed files with 75 additions and 18 deletions

View File

@ -1373,7 +1373,10 @@ class RelationshipCalculator(object):
common_list.append(commons[rel_str])
return (relstrings, common_list)
def get_plural_relationship_string(self, Ga, Gb):
def get_plural_relationship_string(self, Ga, Gb,
reltocommon_a='', reltocommon_b='',
only_birth=True,
in_law_a=False, in_law_b=False):
"""
Provide a string that describes the relationsip between a person, and
a group of people with the same relationship. E.g. "grandparents" or
@ -1389,6 +1392,23 @@ class RelationshipCalculator(object):
:param Gb: The number of generations between the group of people and the
common ancestor
:type Gb: int
:param reltocommon_a : relation path to common ancestor or common
Family for person a.
Note that length = Ga
:type reltocommon_a: str
:param reltocommon_b : relation path to common ancestor or common
Family for person b.
Note that length = Gb
:type reltocommon_b: str
:param only_birth : True if relation between a and b is by birth only
False otherwise
:type only_birth: bool
:param in_law_a : True if path to common ancestors is via the partner
of person a
:type in_law_a: bool
:param in_law_b : True if path to common ancestors is via the partner
of person b
:type in_law_b: bool
:returns: A string describing the relationship between the person and
the group.
:rtype: str
@ -1442,6 +1462,10 @@ class RelationshipCalculator(object):
_removed_level[Gb-Ga] )
else:
rel_str = "distant cousins"
if in_law_b == True:
rel_str = "spouses of %s" % rel_str
return rel_str
def get_single_relationship_string(self, Ga, Gb, gender_a, gender_b,

View File

@ -229,6 +229,8 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
rel_str = _lineal_up[gender]
elif removed < 0:
rel_str = _lineal_down[gender]
elif in_law_a or in_law_b:
rel_str = u'Partner'
else:
rel_str = u'Proband'
else:
@ -249,8 +251,13 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
rel_str = _collateral_same[gender]
return self._fix_caps(rel_str % {'p': pre, 's': post})
def get_plural_relationship_string(self, Ga, Gb):
return self._get_relationship_string(Ga, Gb, 'many')
def get_plural_relationship_string(self, Ga, Gb,
reltocommon_a='', reltocommon_b='',
only_birth=True,
in_law_a=False, in_law_b=False):
return self._get_relationship_string(Ga, Gb, 'many',
reltocommon_a, reltocommon_b,
only_birth, in_law_a, in_law_b)
def get_single_relationship_string(self, Ga, Gb, gender_a, gender_b,
reltocommon_a, reltocommon_b,

View File

@ -426,7 +426,10 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# kinship report
def get_plural_relationship_string(self, Ga, Gb):
def get_plural_relationship_string(self, Ga, Gb,
reltocommon_a='', reltocommon_b='',
only_birth=True,
in_law_a=False, in_law_b=False):
"""
voir Relationship.py
"""
@ -507,8 +510,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
elif Ga < len(_LEVEL_NAME):
rel_str = u"les grands-oncles et grands-tantes" + bygen % \
(Ga + 1)
else:
return rel_str
elif Gb > 1 and Gb > Ga:
# These are cousins in different generations with the second person
@ -529,8 +531,10 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
rel_str = u"les neveux et nièces" + can + civ
elif Ga < len(_LEVEL_NAME):
rel_str = u"les neveux et nièces" + bygen % Gb
else:
return rel_str
if in_law_b == True:
rel_str = "conjoints des %s" % rel_str
return rel_str
# quick report (missing on RelCalc tool - Status Bar)

View File

@ -434,7 +434,10 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
return (self.get_junior_female_cousin(Ga-1, Gb-Ga))
def get_plural_relationship_string(self, Ga, Gb):
def get_plural_relationship_string(self, Ga, Gb,
reltocommon_a='', reltocommon_b='',
only_birth=True,
in_law_a=False, in_law_b=False):
rel_str = u"дальние родственники"
if Ga == 0:
# These are descendants
@ -478,6 +481,11 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
_juniors_removed_level[Gb-Ga] )
else:
rel_str = u"(младшие) дальние родственники"
if in_law_b == True:
# TODO: Translate this!
rel_str = "spouses of %s" % rel_str
return rel_str
# TODO: def get_sibling_relationship_string for Russian step and inlaw relations

View File

@ -225,7 +225,10 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# kinship report
def get_plural_relationship_string(self, Ga, Gb):
def get_plural_relationship_string(self, Ga, Gb,
reltocommon_a='', reltocommon_b='',
only_birth=True,
in_law_a=False, in_law_b=False):
"""
see Relationship.py
"""
@ -289,8 +292,6 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
elif Ga < len(_level_name):
rel_str = "prastrýkovia a pratety" + bygen % (
Ga+1)
else:
return rel_str
elif Gb > 1 and Gb > Ga:
# These are cousins in different generations with the second person
# being in a lower generation from the common ancestor than the
@ -307,8 +308,10 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
elif Ga < len(_level_name):
rel_str = "synovci a netere" + bygen % (
Gb)
else:
return rel_str
if in_law_b == True:
# TODO: Translate this!
rel_str = "spouses of %s" % rel_str
return rel_str

View File

@ -311,7 +311,10 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
return rel_str
def get_plural_relationship_string(self, Ga, Gb):
def get_plural_relationship_string(self, Ga, Gb,
reltocommon_a='', reltocommon_b='',
only_birth=True,
in_law_a=False, in_law_b=False):
"""
Provide a string that describes the relationsip between a person, and
a group of people with the same relationship. E.g. "grandparents" or
@ -394,6 +397,11 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
rel_str = self.pair_up(result,'')
else:
rel_str = u"avlägsna kusiner"
if in_law_b == True:
# TODO: Translate this!
rel_str = "spouses of %s" % rel_str
return rel_str
def get_single_relationship_string(self, Ga, Gb, gender_a, gender_b,

View File

@ -64,8 +64,9 @@ plg.fname = 'rel_de.py'
plg.ptype = RELCALC
plg.relcalcclass = 'RelationshipCalculator'
plg.lang_list = ["de", "DE", "de_DE", "deutsch", "Deutsch", "de_DE.UTF8",
"de_DE@euro", "de_DE.UTF8@euro",
"de_DE@euro", "de_DE.UTF8@euro", "de_AT.UTF-8",
"german","German", "de_DE.UTF-8", "de_DE.utf-8", "de_DE.utf8"]
# es
plg = newplugin()
plg.id = 'relcalc_es'

View File

@ -128,13 +128,15 @@ class KinshipReport(Report):
elif x > 1 and not self.inc_cousins:
continue
title = self.rel_calc.get_plural_relationship_string(Ga, Gb)
get_rel_str = self.rel_calc.get_plural_relationship_string
title = get_rel_str(Ga, Gb, in_law_b=False)
self.write_people(title, self.kinship_map[Ga][Gb])
if self.inc_spouses and \
Ga in self.spouse_map and \
Gb in self.spouse_map[Ga]:
title = _("spouses of %s") % title
title = get_rel_str(Ga, Gb, in_law_b=True)
self.write_people(title, self.spouse_map[Ga][Gb])
def traverse_down(self, person_handle, Ga, Gb, skip_handle=None):