svn: r4867
This commit is contained in:
Alex Roitman 2005-06-23 19:03:56 +00:00
parent 44d7865a5e
commit 5df8d1f8c8

View File

@ -244,33 +244,53 @@ class RelationshipCalculator:
if family and other.get_handle() in [family.get_father_handle(), if family and other.get_handle() in [family.get_father_handle(),
family.get_mother_handle()]: family.get_mother_handle()]:
family_rel = family.get_relationship() family_rel = family.get_relationship()
# Use person's gender # Determine person's gender
if other.get_gender() == RelLib.Person.MALE: if other.get_gender() == RelLib.Person.MALE:
if family_rel == RelLib.Family.CIVIL_UNION: gender = RelLib.Person.MALE
return __("male|partner")
else:
return _("husband")
elif other.get_gender() == RelLib.Person.FEMALE: elif other.get_gender() == RelLib.Person.FEMALE:
if family_rel == RelLib.Family.CIVIL_UNION: gender = RelLib.Person.FEMALE
return __("female|partner") # Person's gender is unknown, try guessing from spouse's
else:
return _("wife")
# Gender is unknown, try using other person's gender
elif orig.get_gender() == RelLib.Person.MALE: elif orig.get_gender() == RelLib.Person.MALE:
if family_rel == RelLib.Family.CIVIL_UNION: if family_rel == RelLib.Family.CIVIL_UNION:
return __("female|partner") gender = RelLib.Person.MALE
else: else:
return _("wife") gender = RelLib.Person.FEMALE
elif orig.get_gender() == RelLib.Person.FEMALE: elif orig.get_gender() == RelLib.Person.FEMALE:
if family_rel == RelLib.Family.CIVIL_UNION: if family_rel == RelLib.Family.CIVIL_UNION:
return __("male|partner") gender = RelLib.Person.FEMALE
else: else:
gender = RelLib.Person.MALE
else:
gender = RelLib.Person.UNKNOWN
if family_rel == RelLib.Family.MARRIED:
if gender == RelLib.Person.MALE:
return _("husband") return _("husband")
# Gender of both people is unknown, go with family rel alone elif gender == RelLib.Person.FEMALE:
elif family_rel == RelLib.Family.CIVIL_UNION: return _("wife")
return __("gender unknown|partner")
else: else:
return __("gender unknown|spouse") return __("gender unknown|spouse")
elif family_rel == RelLib.Family.UNMARRIED:
if gender == RelLib.Person.MALE:
return __("unmarried|husband")
elif gender == RelLib.Person.FEMALE:
return __("unmarried|wife")
else:
return __("gender unknown,unmarried|spouse")
elif family_rel == RelLib.Family.CIVIL_UNION:
if gender == RelLib.Person.MALE:
return __("male,civil union|partner")
elif gender == RelLib.Person.FEMALE:
return __("female,civil union|partner")
else:
return __("gender unknown,civil union|partner")
else:
if gender == RelLib.Person.MALE:
return __("male,unknown relation|partner")
elif gender == RelLib.Person.FEMALE:
return __("female,unknown relation|partner")
else:
return __("gender unknown,unknown relation|partner")
else: else:
return None return None
return None return None