function get_lds_glance(WT_Individual $indi)
{
    $BAPL = $indi->getFacts('BAPL') ? 'B' : '_';
    $ENDL = $indi->getFacts('ENDL') ? 'E' : '_';
    $SLGC = $indi->getFacts('SLGC') ? 'C' : '_';
    $SLGS = '_';
    foreach ($indi->getSpouseFamilies() as $family) {
        if ($family->getFacts('SLGS')) {
            $SLGS = '';
        }
    }
    return $BAPL . $ENDL . $SLGS . $SLGC;
}
Exemple #2
0
 /**
  * Prints descendency of passed in person
  *
  * @param WT_Individual $person person to print descendency for
  * @param mixed         $count  count of generations to print
  * @param bool          $showNav
  *
  * @return int
  */
 function print_descendency($person, $count, $showNav = true)
 {
     global $TEXT_DIRECTION, $WT_IMAGES, $bheight, $bwidth, $bhalfheight, $lastGenSecondFam;
     if ($count > $this->dgenerations) {
         return;
     }
     if (!$person) {
         return;
     }
     $pid = $person->getXref();
     $tablealign = 'right';
     $otablealign = 'left';
     if ($TEXT_DIRECTION == 'rtl') {
         $tablealign = 'left';
         $otablealign = 'right';
     }
     //-- put a space between families on the last generation
     if ($count == $this->dgenerations - 1) {
         if (isset($lastGenSecondFam)) {
             echo "<br>";
         }
         $lastGenSecondFam = true;
     }
     echo "<table id=\"table_{$pid}\" align=\"" . $tablealign . "\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">";
     echo "<tr>";
     echo "<td align=\"{$tablealign}\" width=\"100%\">";
     $numkids = 0;
     $families = $person->getSpouseFamilies();
     $famNum = 0;
     $children = array();
     if ($count < $this->dgenerations) {
         // Put all of the children in a common array
         foreach ($families as $family) {
             $famNum++;
             foreach ($family->getChildren() as $child) {
                 $children[] = $child;
             }
         }
         $ct = count($children);
         if ($ct > 0) {
             echo "<table style=\"position: relative; top: auto; text-align: {$tablealign};\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">";
             for ($i = 0; $i < $ct; $i++) {
                 $person2 = $children[$i];
                 $chil = $person2->getXref();
                 echo '<tr>';
                 echo "<td id=\"td_{$chil}\" class=\"{$TEXT_DIRECTION}\" align=\"{$otablealign}\">";
                 $kids = $this->print_descendency($person2, $count + 1);
                 $numkids += $kids;
                 echo '</td>';
                 // Print the lines
                 if ($ct > 1) {
                     if ($i == 0) {
                         // First child
                         echo "<td valign=\"bottom\"><img class=\"line1\" name=\"tvertline\" id=\"vline_{$chil}\" src=\"" . $WT_IMAGES["vline"] . "\" width=\"3\"></td>";
                     } elseif ($i == $ct - 1) {
                         // Last child
                         echo "<td valign=\"top\"><img name=\"bvertline\" id=\"vline_{$chil}\" src=\"" . $WT_IMAGES["vline"] . "\" width=\"3\"></td>";
                     } else {
                         // Middle child
                         echo "<td style=\"background: url('" . $WT_IMAGES["vline"] . "');\"><img src=\"" . $WT_IMAGES["spacer"] . "\" width=\"3\"></td>";
                     }
                 }
                 echo '</tr>';
             }
             echo '</table>';
         }
         echo '</td>';
         echo '<td width="', $bwidth, '">';
     }
     // Print the descendency expansion arrow
     if ($count == $this->dgenerations) {
         $numkids = 1;
         $tbwidth = $bwidth + 16;
         for ($j = $count; $j < $this->dgenerations; $j++) {
             echo "<div style=\"width: " . $tbwidth . "px;\"><br></div></td><td width=\"{$bwidth}\">";
         }
         $kcount = 0;
         foreach ($families as $family) {
             $kcount += $family->getNumberOfChildren();
         }
         if ($kcount == 0) {
             echo "&nbsp;</td><td width=\"{$bwidth}\">";
         } else {
             echo "<a href=\"{$pid}\" onclick=\"return changeDis('td_" . $pid . "','" . $pid . "','" . $this->show_full . "','" . $this->show_spouse . "','" . $this->box_width . "')\" class=\"" . $this->left_arrow . "\"></a>";
             //-- move the arrow up to line up with the correct box
             if ($this->show_spouse) {
                 echo str_repeat('<br><br><br>', count($families));
             }
             echo "</td><td width=\"{$bwidth}\">";
         }
     }
     echo "<table id=\"table2_{$pid}\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td>";
     print_pedigree_person($person);
     echo "</td><td><img class=\"line2\" src=\"" . $WT_IMAGES["hline"] . "\" width=\"7\" height=\"3\" alt=\"\">";
     //----- Print the spouse
     if ($this->show_spouse) {
         foreach ($families as $family) {
             echo "</td></tr><tr><td align=\"{$otablealign}\">";
             //-- shrink the box for the spouses
             $tempw = $bwidth;
             $temph = $bheight;
             $bwidth -= 10;
             $bheight -= 10;
             print_pedigree_person($family->getSpouse($person));
             $bwidth = $tempw;
             $bheight = $temph;
             $numkids += 0.95;
             echo "</td><td></td>";
         }
         //-- add offset divs to make things line up better
         if ($count == $this->dgenerations) {
             echo "<tr><td colspan\"2\"><div style=\"height: " . $bhalfheight / 2 . "px; width: " . $bwidth . "px;\"><br></div>";
         }
     }
     echo "</td></tr></table>";
     // For the root person, print a down arrow that allows changing the root of tree
     if ($showNav && $count == 1) {
         // NOTE: If statement OK
         if ($person->canShowName()) {
             // -- print left arrow for decendants so that we can move down the tree
             $famids = $person->getSpouseFamilies();
             //-- make sure there is more than 1 child in the family with parents
             $cfamids = $person->getChildFamilies();
             $num = 0;
             foreach ($cfamids as $family) {
                 $num += $family->getNumberOfChildren();
             }
             // NOTE: If statement OK
             if ($num > 0) {
                 echo '<div class="center" id="childarrow" style="position:absolute; width:', $bwidth, 'px;">';
                 echo '<a href="#" class="icon-darrow"></a><br>';
                 echo '<div id="childbox">';
                 echo '<table class="person_box"><tr><td>';
                 foreach ($famids as $family) {
                     $spouse = $family->getSpouse($person);
                     if ($spouse) {
                         $spid = $spouse->getXref();
                         echo "<a href=\"hourglass.php?rootid={$spid}&amp;show_spouse={$this->show_spouse}&amp;show_full={$this->show_full}&amp;generations={$this->generations}&amp;box_width={$this->box_width}\" class=\"name1\">";
                         echo $spouse->getFullName();
                         echo '</a><br>';
                     }
                     foreach ($family->getChildren() as $child) {
                         $cid = $child->getXref();
                         echo "&nbsp;&nbsp;<a href=\"hourglass.php?rootid={$cid}&amp;show_spouse={$this->show_spouse}&amp;show_full={$this->show_full}&amp;generations={$this->generations}&amp;box_width={$this->box_width}\" class=\"name1\">";
                         echo $child->getFullName();
                         echo '</a><br>';
                     }
                 }
                 //-- print the siblings
                 foreach ($cfamids as $family) {
                     if ($family->getHusband() || $family->getWife()) {
                         echo "<span class=\"name1\"><br>" . WT_I18N::translate('Parents') . "<br></span>";
                         $husb = $family->getHusband();
                         if ($husb) {
                             $spid = $husb->getXref();
                             echo "&nbsp;&nbsp;<a href=\"hourglass.php?rootid={$spid}&amp;show_spouse={$this->show_spouse}&amp;show_full={$this->show_full}&amp;generations={$this->generations}&amp;box_width={$this->box_width}\" class=\"name1\">";
                             echo $husb->getFullName();
                             echo '</a><br>';
                         }
                         $wife = $family->getWife();
                         if ($wife) {
                             $spid = $wife->getXref();
                             echo "&nbsp;&nbsp;<a href=\"hourglass.php?rootid={$spid}&amp;show_spouse={$this->show_spouse}&amp;show_full={$this->show_full}&amp;generations={$this->generations}&amp;box_width={$this->box_width}\" class=\"name1\">";
                             echo $wife->getFullName();
                             echo '</a><br>';
                         }
                     }
                     $num = $family->getNumberOfChildren();
                     if ($num > 2) {
                         echo "<span class=\"name1\"><br>" . WT_I18N::translate('Siblings') . "<br></span>";
                     }
                     if ($num == 2) {
                         echo "<span class=\"name1\"><br>" . WT_I18N::translate('Sibling') . "<br></span>";
                     }
                     foreach ($family->getChildren() as $child) {
                         $cid = $child->getXref();
                         if ($cid != $pid) {
                             echo "&nbsp;&nbsp;<a href=\"hourglass.php?rootid={$cid}&amp;show_spouse={$this->show_spouse}&amp;show_full={$this->show_full}&amp;generations={$this->generations}&amp;box_width={$this->box_width}\" class=\"name1\">";
                             echo $child->getFullName();
                             echo '</a><br>';
                         }
                     }
                 }
                 echo '</td></tr></table>';
                 echo '</div>';
                 echo '</div>';
             }
         }
     }
     echo '</td></tr>';
     echo '</table>';
     return $numkids;
 }
Exemple #3
0
 /**
  * Find all the families that are descended from an individual.
  *
  * @param WT_Individual $person
  * @param int           $n
  * @param WT_Family[]   $array
  *
  * @return WT_Family[]
  */
 public function fam_desc($person, $n, $array)
 {
     if ($n < 1) {
         return $array;
     }
     foreach ($person->getSpouseFamilies() as $family) {
         $array[$family->getXref()] = $family;
         foreach ($family->getChildren() as $child) {
             $array = $this->fam_desc($child, $n - 1, $array);
         }
     }
     return $array;
 }
Exemple #4
0
function get_relationship_name_from_path($path, WT_Individual $person1 = null, WT_Individual $person2 = null)
{
    if (!preg_match('/^(mot|fat|par|hus|wif|spo|son|dau|chi|bro|sis|sib)*$/', $path)) {
        // TODO: Update all the “3 RELA ” values in class_person
        return '<span class="error">' . $path . '</span>';
    }
    // The path does not include the starting person.  In some languages, the
    // translation for a man’s (relative) is different to a woman’s (relative),
    // due to inflection.
    $sex1 = $person1 ? $person1->getSex() : 'U';
    // The sex of the last person in the relationship determines the name in
    // many cases.  e.g. great-aunt / great-uncle
    if (preg_match('/(fat|hus|son|bro)$/', $path)) {
        $sex2 = 'M';
    } elseif (preg_match('/(mot|wif|dau|sis)$/', $path)) {
        $sex2 = 'F';
    } else {
        $sex2 = 'U';
    }
    switch ($path) {
        case '':
            return WT_I18N::translate('self');
            //  Level One relationships
        //  Level One relationships
        case 'mot':
            return WT_I18N::translate('mother');
        case 'fat':
            return WT_I18N::translate('father');
        case 'par':
            return WT_I18N::translate('parent');
        case 'hus':
            if ($person1 && $person2) {
                foreach ($person1->getSpouseFamilies() as $family) {
                    if ($person2 === $family->getSpouse($person1)) {
                        if ($family->getFacts('_NMR')) {
                            return WT_I18N::translate_c('MALE', 'partner');
                        } elseif ($family->getFacts(WT_EVENTS_DIV)) {
                            return WT_I18N::translate('ex-husband');
                        }
                    }
                }
            }
            return WT_I18N::translate('husband');
        case 'wif':
            if ($person1 && $person1) {
                foreach ($person1->getSpouseFamilies() as $family) {
                    if ($person2 === $family->getSpouse($person1)) {
                        if ($family->getFacts('_NMR')) {
                            return WT_I18N::translate_c('FEMALE', 'partner');
                        } elseif ($family->getFacts(WT_EVENTS_DIV)) {
                            return WT_I18N::translate('ex-wife');
                        }
                    }
                }
            }
            return WT_I18N::translate('wife');
        case 'spo':
            if ($person1 && $person2) {
                foreach ($person1->getSpouseFamilies() as $family) {
                    if ($person2 === $family->getSpouse($person1)) {
                        if ($family->getFacts('_NMR')) {
                            return WT_I18N::translate_c('MALE/FEMALE', 'partner');
                        } elseif ($family->getFacts(WT_EVENTS_DIV)) {
                            return WT_I18N::translate('ex-spouse');
                        }
                    }
                }
            }
            return WT_I18N::translate('spouse');
        case 'son':
            return WT_I18N::translate('son');
        case 'dau':
            return WT_I18N::translate('daughter');
        case 'chi':
            return WT_I18N::translate('child');
        case 'bro':
            if ($person1 && $person2) {
                $dob1 = $person1->getBirthDate();
                $dob2 = $person2->getBirthDate();
                if ($dob1->isOK() && $dob2->isOK()) {
                    if (abs($dob1->JD() - $dob2->JD()) < 2 && !$dob1->qual1 && !$dob2->qual1) {
                        // Exclude BEF, AFT, etc.
                        return WT_I18N::translate('twin brother');
                    } elseif ($dob1->MaxJD() < $dob2->MinJD()) {
                        return WT_I18N::translate('younger brother');
                    } elseif ($dob1->MinJD() > $dob2->MaxJD()) {
                        return WT_I18N::translate('elder brother');
                    }
                }
            }
            return WT_I18N::translate('brother');
        case 'sis':
            if ($person1 && $person2) {
                $dob1 = $person1->getBirthDate();
                $dob2 = $person2->getBirthDate();
                if ($dob1->isOK() && $dob2->isOK()) {
                    if (abs($dob1->JD() - $dob2->JD()) < 2 && !$dob1->qual1 && !$dob2->qual1) {
                        // Exclude BEF, AFT, etc.
                        return WT_I18N::translate('twin sister');
                    } elseif ($dob1->MaxJD() < $dob2->MinJD()) {
                        return WT_I18N::translate('younger sister');
                    } elseif ($dob1->MinJD() > $dob2->MaxJD()) {
                        return WT_I18N::translate('elder sister');
                    }
                }
            }
            return WT_I18N::translate('sister');
        case 'sib':
            if ($person1 && $person2) {
                $dob1 = $person1->getBirthDate();
                $dob2 = $person2->getBirthDate();
                if ($dob1->isOK() && $dob2->isOK()) {
                    if (abs($dob1->JD() - $dob2->JD()) < 2 && !$dob1->qual1 && !$dob2->qual1) {
                        // Exclude BEF, AFT, etc.
                        return WT_I18N::translate('twin sibling');
                    } elseif ($dob1->MaxJD() < $dob2->MinJD()) {
                        return WT_I18N::translate('younger sibling');
                    } elseif ($dob1->MinJD() > $dob2->MaxJD()) {
                        return WT_I18N::translate('elder sibling');
                    }
                }
            }
            return WT_I18N::translate('sibling');
            // Level Two relationships
        // Level Two relationships
        case 'brochi':
            return WT_I18N::translate_c('brother’s child', 'nephew/niece');
        case 'brodau':
            return WT_I18N::translate_c('brother’s daughter', 'niece');
        case 'broson':
            return WT_I18N::translate_c('brother’s son', 'nephew');
        case 'browif':
            return WT_I18N::translate_c('brother’s wife', 'sister-in-law');
        case 'chichi':
            return WT_I18N::translate_c('child’s child', 'grandchild');
        case 'chidau':
            return WT_I18N::translate_c('child’s daughter', 'granddaughter');
        case 'chihus':
            return WT_I18N::translate_c('child’s husband', 'son-in-law');
        case 'chison':
            return WT_I18N::translate_c('child’s son', 'grandson');
        case 'chispo':
            return WT_I18N::translate_c('child’s spouse', 'son/daughter-in-law');
        case 'chiwif':
            return WT_I18N::translate_c('child’s wife', 'daughter-in-law');
        case 'dauchi':
            return WT_I18N::translate_c('daughter’s child', 'grandchild');
        case 'daudau':
            return WT_I18N::translate_c('daughter’s daughter', 'granddaughter');
        case 'dauhus':
            return WT_I18N::translate_c('daughter’s husband', 'son-in-law');
        case 'dauson':
            return WT_I18N::translate_c('daughter’s son', 'grandson');
        case 'fatbro':
            return WT_I18N::translate_c('father’s brother', 'uncle');
        case 'fatchi':
            return WT_I18N::translate_c('father’s child', 'half-sibling');
        case 'fatdau':
            return WT_I18N::translate_c('father’s daughter', 'half-sister');
        case 'fatfat':
            return WT_I18N::translate_c('father’s father', 'paternal grandfather');
        case 'fatmot':
            return WT_I18N::translate_c('father’s mother', 'paternal grandmother');
        case 'fatpar':
            return WT_I18N::translate_c('father’s parent', 'paternal grandparent');
        case 'fatsib':
            return WT_I18N::translate_c('father’s sibling', 'aunt/uncle');
        case 'fatsis':
            return WT_I18N::translate_c('father’s sister', 'aunt');
        case 'fatson':
            return WT_I18N::translate_c('father’s son', 'half-brother');
        case 'fatwif':
            return WT_I18N::translate_c('father’s wife', 'step-mother');
        case 'husbro':
            return WT_I18N::translate_c('husband’s brother', 'brother-in-law');
        case 'huschi':
            return WT_I18N::translate_c('husband’s child', 'step-child');
        case 'husdau':
            return WT_I18N::translate_c('husband’s daughter', 'step-daughter');
        case 'husfat':
            return WT_I18N::translate_c('husband’s father', 'father-in-law');
        case 'husmot':
            return WT_I18N::translate_c('husband’s mother', 'mother-in-law');
        case 'hussib':
            return WT_I18N::translate_c('husband’s sibling', 'brother/sister-in-law');
        case 'hussis':
            return WT_I18N::translate_c('husband’s sister', 'sister-in-law');
        case 'husson':
            return WT_I18N::translate_c('husband’s son', 'step-son');
        case 'motbro':
            return WT_I18N::translate_c('mother’s brother', 'uncle');
        case 'motchi':
            return WT_I18N::translate_c('mother’s child', 'half-sibling');
        case 'motdau':
            return WT_I18N::translate_c('mother’s daughter', 'half-sister');
        case 'motfat':
            return WT_I18N::translate_c('mother’s father', 'maternal grandfather');
        case 'mothus':
            return WT_I18N::translate_c('mother’s husband', 'step-father');
        case 'motmot':
            return WT_I18N::translate_c('mother’s mother', 'maternal grandmother');
        case 'motpar':
            return WT_I18N::translate_c('mother’s parent', 'maternal grandparent');
        case 'motsib':
            return WT_I18N::translate_c('mother’s sibling', 'aunt/uncle');
        case 'motsis':
            return WT_I18N::translate_c('mother’s sister', 'aunt');
        case 'motson':
            return WT_I18N::translate_c('mother’s son', 'half-brother');
        case 'parbro':
            return WT_I18N::translate_c('parent’s brother', 'uncle');
        case 'parchi':
            return WT_I18N::translate_c('parent’s child', 'half-sibling');
        case 'pardau':
            return WT_I18N::translate_c('parent’s daughter', 'half-sister');
        case 'parfat':
            return WT_I18N::translate_c('parent’s father', 'grandfather');
        case 'parmot':
            return WT_I18N::translate_c('parent’s mother', 'grandmother');
        case 'parpar':
            return WT_I18N::translate_c('parent’s parent', 'grandparent');
        case 'parsib':
            return WT_I18N::translate_c('parent’s sibling', 'aunt/uncle');
        case 'parsis':
            return WT_I18N::translate_c('parent’s sister', 'aunt');
        case 'parson':
            return WT_I18N::translate_c('parent’s son', 'half-brother');
        case 'parspo':
            return WT_I18N::translate_c('parent’s spouse', 'step-parent');
        case 'sibchi':
            return WT_I18N::translate_c('sibling’s child', 'nephew/niece');
        case 'sibdau':
            return WT_I18N::translate_c('sibling’s daughter', 'niece');
        case 'sibson':
            return WT_I18N::translate_c('sibling’s son', 'nephew');
        case 'sibspo':
            return WT_I18N::translate_c('sibling’s spouse', 'brother/sister-in-law');
        case 'sischi':
            return WT_I18N::translate_c('sister’s child', 'nephew/niece');
        case 'sisdau':
            return WT_I18N::translate_c('sister’s daughter', 'niece');
        case 'sishus':
            return WT_I18N::translate_c('sister’s husband', 'brother-in-law');
        case 'sisson':
            return WT_I18N::translate_c('sister’s son', 'nephew');
        case 'sonchi':
            return WT_I18N::translate_c('son’s child', 'grandchild');
        case 'sondau':
            return WT_I18N::translate_c('son’s daughter', 'granddaughter');
        case 'sonson':
            return WT_I18N::translate_c('son’s son', 'grandson');
        case 'sonwif':
            return WT_I18N::translate_c('son’s wife', 'daughter-in-law');
        case 'spobro':
            return WT_I18N::translate_c('spouse’s brother', 'brother-in-law');
        case 'spochi':
            return WT_I18N::translate_c('spouse’s child', 'step-child');
        case 'spodau':
            return WT_I18N::translate_c('spouse’s daughter', 'step-daughter');
        case 'spofat':
            return WT_I18N::translate_c('spouse’s father', 'father-in-law');
        case 'spomot':
            return WT_I18N::translate_c('spouse’s mother', 'mother-in-law');
        case 'sposis':
            return WT_I18N::translate_c('spouse’s sister', 'sister-in-law');
        case 'sposon':
            return WT_I18N::translate_c('spouse’s son', 'step-son');
        case 'spopar':
            return WT_I18N::translate_c('spouse’s parent', 'mother/father-in-law');
        case 'sposib':
            return WT_I18N::translate_c('spouse’s sibling', 'brother/sister-in-law');
        case 'wifbro':
            return WT_I18N::translate_c('wife’s brother', 'brother-in-law');
        case 'wifchi':
            return WT_I18N::translate_c('wife’s child', 'step-child');
        case 'wifdau':
            return WT_I18N::translate_c('wife’s daughter', 'step-daughter');
        case 'wiffat':
            return WT_I18N::translate_c('wife’s father', 'father-in-law');
        case 'wifmot':
            return WT_I18N::translate_c('wife’s mother', 'mother-in-law');
        case 'wifsib':
            return WT_I18N::translate_c('wife’s sibling', 'brother/sister-in-law');
        case 'wifsis':
            return WT_I18N::translate_c('wife’s sister', 'sister-in-law');
        case 'wifson':
            return WT_I18N::translate_c('wife’s son', 'step-son');
            // Level Three relationships
            // I have commented out some of the unknown-sex relationships that are unlikely to to occur.
            // Feel free to add them in, if you think they might be needed
        // Level Three relationships
        // I have commented out some of the unknown-sex relationships that are unlikely to to occur.
        // Feel free to add them in, if you think they might be needed
        case 'brochichi':
            if ($sex1 == 'M') {
                return WT_I18N::translate_c('(a man’s) brother’s child’s child', 'great-nephew/niece');
            } else {
                return WT_I18N::translate_c('(a woman’s) brother’s child’s child', 'great-nephew/niece');
            }
        case 'brochidau':
            if ($sex1 == 'M') {
                return WT_I18N::translate_c('(a man’s) brother’s child’s daughter', 'great-niece');
            } else {
                return WT_I18N::translate_c('(a woman’s) brother’s child’s daughter', 'great-niece');
            }
        case 'brochison':
            if ($sex1 == 'M') {
                return WT_I18N::translate_c('(a man’s) brother’s child’s son', 'great-nephew');
            } else {
                return WT_I18N::translate_c('(a woman’s) brother’s child’s son', 'great-nephew');
            }
        case 'brodauchi':
            if ($sex1 == 'M') {
                return WT_I18N::translate_c('(a man’s) brother’s daughter’s child', 'great-nephew/niece');
            } else {
                return WT_I18N::translate_c('(a woman’s) brother’s daughter’s child', 'great-nephew/niece');
            }
        case 'brodaudau':
            if ($sex1 == 'M') {
                return WT_I18N::translate_c('(a man’s) brother’s daughter’s daughter', 'great-niece');
            } else {
                return WT_I18N::translate_c('(a woman’s) brother’s daughter’s daughter', 'great-niece');
            }
        case 'brodauhus':
            return WT_I18N::translate_c('brother’s daughter’s husband', 'nephew-in-law');
        case 'brodauson':
            if ($sex1 == 'M') {
                return WT_I18N::translate_c('(a man’s) brother’s daughter’s son', 'great-nephew');
            } else {
                return WT_I18N::translate_c('(a woman’s) brother’s daughter’s son', 'great-nephew');
            }
        case 'brosonchi':
            if ($sex1 == 'M') {
                return WT_I18N::translate_c('(a man’s) brother’s son’s child', 'great-nephew/niece');
            } else {
                return WT_I18N::translate_c('(a woman’s) brother’s son’s child', 'great-nephew/niece');
            }
        case 'brosondau':
            if ($sex1 == 'M') {
                return WT_I18N::translate_c('(a man’s) brother’s son’s daughter', 'great-niece');
            } else {
                return WT_I18N::translate_c('(a woman’s) brother’s son’s daughter', 'great-niece');
            }
        case 'brosonson':
            if ($sex1 == 'M') {
                return WT_I18N::translate_c('(a man’s) brother’s son’s son', 'great-nephew');
            } else {
                return WT_I18N::translate_c('(a woman’s) brother’s son’s son', 'great-nephew');
            }
        case 'brosonwif':
            return WT_I18N::translate_c('brother’s son’s wife', 'niece-in-law');
        case 'browifbro':
            return WT_I18N::translate_c('brother’s wife’s brother', 'brother-in-law');
        case 'browifsib':
            return WT_I18N::translate_c('brother’s wife’s sibling', 'brother/sister-in-law');
        case 'browifsis':
            return WT_I18N::translate_c('brother’s wife’s sister', 'sister-in-law');
        case 'chichichi':
            return WT_I18N::translate_c('child’s child’s child', 'great-grandchild');
        case 'chichidau':
            return WT_I18N::translate_c('child’s child’s daughter', 'great-granddaughter');
        case 'chichison':
            return WT_I18N::translate_c('child’s child’s son', 'great-grandson');
        case 'chidauchi':
            return WT_I18N::translate_c('child’s daughter’s child', 'great-grandchild');
        case 'chidaudau':
            return WT_I18N::translate_c('child’s daughter’s daughter', 'great-granddaughter');
        case 'chidauhus':
            return WT_I18N::translate_c('child’s daughter’s husband', 'granddaughter’s husband');
        case 'chidauson':
            return WT_I18N::translate_c('child’s daughter’s son', 'great-grandson');
        case 'chisonchi':
            return WT_I18N::translate_c('child’s son’s child', 'great-grandchild');
        case 'chisondau':
            return WT_I18N::translate_c('child’s son’s daughter', 'great-granddaughter');
        case 'chisonson':
            return WT_I18N::translate_c('child’s son’s son', 'great-grandson');
        case 'chisonwif':
            return WT_I18N::translate_c('child’s son’s wife', 'grandson’s wife');
        case 'dauchichi':
            return WT_I18N::translate_c('daughter’s child’s child', 'great-grandchild');
        case 'dauchidau':
            return WT_I18N::translate_c('daughter’s child’s daughter', 'great-granddaughter');
        case 'dauchison':
            return WT_I18N::translate_c('daughter’s child’s son', 'great-grandson');
        case 'daudauchi':
            return WT_I18N::translate_c('daughter’s daughter’s child', 'great-grandchild');
        case 'daudaudau':
            return WT_I18N::translate_c('daughter’s daughter’s daughter', 'great-granddaughter');
        case 'daudauhus':
            return WT_I18N::translate_c('daughter’s daughter’s husband', 'granddaughter’s husband');
        case 'daudauson':
            return WT_I18N::translate_c('daughter’s daughter’s son', 'great-grandson');
        case 'dauhusfat':
            return WT_I18N::translate_c('daughter’s husband’s father', 'son-in-law’s father');
        case 'dauhusmot':
            return WT_I18N::translate_c('daughter’s husband’s mother', 'son-in-law’s mother');
        case 'dauhuspar':
            return WT_I18N::translate_c('daughter’s husband’s parent', 'son-in-law’s parent');
        case 'dausonchi':
            return WT_I18N::translate_c('daughter’s son’s child', 'great-grandchild');
        case 'dausondau':
            return WT_I18N::translate_c('daughter’s son’s daughter', 'great-granddaughter');
        case 'dausonson':
            return WT_I18N::translate_c('daughter’s son’s son', 'great-grandson');
        case 'dausonwif':
            return WT_I18N::translate_c('daughter’s son’s wife', 'grandson’s wife');
        case 'fatbrochi':
            return WT_I18N::translate_c('father’s brother’s child', 'first cousin');
        case 'fatbrodau':
            return WT_I18N::translate_c('father’s brother’s daughter', 'first cousin');
        case 'fatbroson':
            return WT_I18N::translate_c('father’s brother’s son', 'first cousin');
        case 'fatbrowif':
            return WT_I18N::translate_c('father’s brother’s wife', 'aunt');
        case 'fatfatbro':
            return WT_I18N::translate_c('father’s father’s brother', 'great-uncle');
        case 'fatfatfat':
            return WT_I18N::translate_c('father’s father’s father', 'great-grandfather');
        case 'fatfatmot':
            return WT_I18N::translate_c('father’s father’s mother', 'great-grandmother');
        case 'fatfatpar':
            return WT_I18N::translate_c('father’s father’s parent', 'great-grandparent');
        case 'fatfatsib':
            return WT_I18N::translate_c('father’s father’s sibling', 'great-aunt/uncle');
        case 'fatfatsis':
            return WT_I18N::translate_c('father’s father’s sister', 'great-aunt');
        case 'fatmotbro':
            return WT_I18N::translate_c('father’s mother’s brother', 'great-uncle');
        case 'fatmotfat':
            return WT_I18N::translate_c('father’s mother’s father', 'great-grandfather');
        case 'fatmotmot':
            return WT_I18N::translate_c('father’s mother’s mother', 'great-grandmother');
        case 'fatmotpar':
            return WT_I18N::translate_c('father’s mother’s parent', 'great-grandparent');
        case 'fatmotsib':
            return WT_I18N::translate_c('father’s mother’s sibling', 'great-aunt/uncle');
        case 'fatmotsis':
            return WT_I18N::translate_c('father’s mother’s sister', 'great-aunt');
        case 'fatparbro':
            return WT_I18N::translate_c('father’s parent’s brother', 'great-uncle');
        case 'fatparfat':
            return WT_I18N::translate_c('father’s parent’s father', 'great-grandfather');
        case 'fatparmot':
            return WT_I18N::translate_c('father’s parent’s mother', 'great-grandmother');
        case 'fatparpar':
            return WT_I18N::translate_c('father’s parent’s parent', 'great-grandparent');
        case 'fatparsib':
            return WT_I18N::translate_c('father’s parent’s sibling', 'great-aunt/uncle');
        case 'fatparsis':
            return WT_I18N::translate_c('father’s parent’s sister', 'great-aunt');
        case 'fatsischi':
            return WT_I18N::translate_c('father’s sister’s child', 'first cousin');
        case 'fatsisdau':
            return WT_I18N::translate_c('father’s sister’s daughter', 'first cousin');
        case 'fatsishus':
            return WT_I18N::translate_c('father’s sister’s husband', 'uncle');
        case 'fatsisson':
            return WT_I18N::translate_c('father’s sister’s son', 'first cousin');
        case 'fatwifchi':
            return WT_I18N::translate_c('father’s wife’s child', 'step-sibling');
        case 'fatwifdau':
            return WT_I18N::translate_c('father’s wife’s daughter', 'step-sister');
        case 'fatwifson':
            return WT_I18N::translate_c('father’s wife’s son', 'step-brother');
        case 'husbrowif':
            return WT_I18N::translate_c('husband’s brother’s wife', 'sister-in-law');
        case 'hussishus':
            return WT_I18N::translate_c('husband’s sister’s husband', 'brother-in-law');
        case 'motbrochi':
            return WT_I18N::translate_c('mother’s brother’s child', 'first cousin');
        case 'motbrodau':
            return WT_I18N::translate_c('mother’s brother’s daughter', 'first cousin');
        case 'motbroson':
            return WT_I18N::translate_c('mother’s brother’s son', 'first cousin');
        case 'motbrowif':
            return WT_I18N::translate_c('mother’s brother’s wife', 'aunt');
        case 'motfatbro':
            return WT_I18N::translate_c('mother’s father’s brother', 'great-uncle');
        case 'motfatfat':
            return WT_I18N::translate_c('mother’s father’s father', 'great-grandfather');
        case 'motfatmot':
            return WT_I18N::translate_c('mother’s father’s mother', 'great-grandmother');
        case 'motfatpar':
            return WT_I18N::translate_c('mother’s father’s parent', 'great-grandparent');
        case 'motfatsib':
            return WT_I18N::translate_c('mother’s father’s sibling', 'great-aunt/uncle');
        case 'motfatsis':
            return WT_I18N::translate_c('mother’s father’s sister', 'great-aunt');
        case 'mothuschi':
            return WT_I18N::translate_c('mother’s husband’s child', 'step-sibling');
        case 'mothusdau':
            return WT_I18N::translate_c('mother’s husband’s daughter', 'step-sister');
        case 'mothusson':
            return WT_I18N::translate_c('mother’s husband’s son', 'step-brother');
        case 'motmotbro':
            return WT_I18N::translate_c('mother’s mother’s brother', 'great-uncle');
        case 'motmotfat':
            return WT_I18N::translate_c('mother’s mother’s father', 'great-grandfather');
        case 'motmotmot':
            return WT_I18N::translate_c('mother’s mother’s mother', 'great-grandmother');
        case 'motmotpar':
            return WT_I18N::translate_c('mother’s mother’s parent', 'great-grandparent');
        case 'motmotsib':
            return WT_I18N::translate_c('mother’s mother’s sibling', 'great-aunt/uncle');
        case 'motmotsis':
            return WT_I18N::translate_c('mother’s mother’s sister', 'great-aunt');
        case 'motparbro':
            return WT_I18N::translate_c('mother’s parent’s brother', 'great-uncle');
        case 'motparfat':
            return WT_I18N::translate_c('mother’s parent’s father', 'great-grandfather');
        case 'motparmot':
            return WT_I18N::translate_c('mother’s parent’s mother', 'great-grandmother');
        case 'motparpar':
            return WT_I18N::translate_c('mother’s parent’s parent', 'great-grandparent');
        case 'motparsib':
            return WT_I18N::translate_c('mother’s parent’s sibling', 'great-aunt/uncle');
        case 'motparsis':
            return WT_I18N::translate_c('mother’s parent’s sister', 'great-aunt');
        case 'motsischi':
            return WT_I18N::translate_c('mother’s sister’s child', 'first cousin');
        case 'motsisdau':
            return WT_I18N::translate_c('mother’s sister’s daughter', 'first cousin');
        case 'motsishus':
            return WT_I18N::translate_c('mother’s sister’s husband', 'uncle');
        case 'motsisson':
            return WT_I18N::translate_c('mother’s sister’s son', 'first cousin');
        case 'parbrowif':
            return WT_I18N::translate_c('parent’s brother’s wife', 'aunt');
        case 'parfatbro':
            return WT_I18N::translate_c('parent’s father’s brother', 'great-uncle');
        case 'parfatfat':
            return WT_I18N::translate_c('parent’s father’s father', 'great-grandfather');
        case 'parfatmot':
            return WT_I18N::translate_c('parent’s father’s mother', 'great-grandmother');
        case 'parfatpar':
            return WT_I18N::translate_c('parent’s father’s parent', 'great-grandparent');
        case 'parfatsib':
            return WT_I18N::translate_c('parent’s father’s sibling', 'great-aunt/uncle');
        case 'parfatsis':
            return WT_I18N::translate_c('parent’s father’s sister', 'great-aunt');
        case 'parmotbro':
            return WT_I18N::translate_c('parent’s mother’s brother', 'great-uncle');
        case 'parmotfat':
            return WT_I18N::translate_c('parent’s mother’s father', 'great-grandfather');
        case 'parmotmot':
            return WT_I18N::translate_c('parent’s mother’s mother', 'great-grandmother');
        case 'parmotpar':
            return WT_I18N::translate_c('parent’s mother’s parent', 'great-grandparent');
        case 'parmotsib':
            return WT_I18N::translate_c('parent’s mother’s sibling', 'great-aunt/uncle');
        case 'parmotsis':
            return WT_I18N::translate_c('parent’s mother’s sister', 'great-aunt');
        case 'parparbro':
            return WT_I18N::translate_c('parent’s parent’s brother', 'great-uncle');
        case 'parparfat':
            return WT_I18N::translate_c('parent’s parent’s father', 'great-grandfather');
        case 'parparmot':
            return WT_I18N::translate_c('parent’s parent’s mother', 'great-grandmother');
        case 'parparpar':
            return WT_I18N::translate_c('parent’s parent’s parent', 'great-grandparent');
        case 'parparsib':
            return WT_I18N::translate_c('parent’s parent’s sibling', 'great-aunt/uncle');
        case 'parparsis':
            return WT_I18N::translate_c('parent’s parent’s sister', 'great-aunt');
        case 'parsishus':
            return WT_I18N::translate_c('parent’s sister’s husband', 'uncle');
        case 'parspochi':
            return WT_I18N::translate_c('parent’s spouse’s child', 'step-sibling');
        case 'parspodau':
            return WT_I18N::translate_c('parent’s spouse’s daughter', 'step-sister');
        case 'parsposon':
            return WT_I18N::translate_c('parent’s spouse’s son', 'step-brother');
        case 'sibchichi':
            return WT_I18N::translate_c('sibling’s child’s child', 'great-nephew/niece');
        case 'sibchidau':
            return WT_I18N::translate_c('sibling’s child’s daughter', 'great-niece');
        case 'sibchison':
            return WT_I18N::translate_c('sibling’s child’s son', 'great-nephew');
        case 'sibdauchi':
            return WT_I18N::translate_c('sibling’s daughter’s child', 'great-nephew/niece');
        case 'sibdaudau':
            return WT_I18N::translate_c('sibling’s daughter’s daughter', 'great-niece');
        case 'sibdauhus':
            return WT_I18N::translate_c('sibling’s daughter’s husband', 'nephew-in-law');
        case 'sibdauson':
            return WT_I18N::translate_c('sibling’s daughter’s son', 'great-nephew');
        case 'sibsonchi':
            return WT_I18N::translate_c('sibling’s son’s child', 'great-nephew/niece');
        case 'sibsondau':
            return WT_I18N::translate_c('sibling’s son’s daughter', 'great-niece');
        case 'sibsonson':
            return WT_I18N::translate_c('sibling’s son’s son', 'great-nephew');
        case 'sibsonwif':
            return WT_I18N::translate_c('sibling’s son’s wife', 'niece-in-law');
        case 'sischichi':
            if ($sex1 == 'M') {
                return WT_I18N::translate_c('(a man’s) sister’s child’s child', 'great-nephew/niece');
            } else {
                return WT_I18N::translate_c('(a woman’s) sister’s child’s child', 'great-nephew/niece');
            }
        case 'sischidau':
            if ($sex1 == 'M') {
                return WT_I18N::translate_c('(a man’s) sister’s child’s daughter', 'great-niece');
            } else {
                return WT_I18N::translate_c('(a woman’s) sister’s child’s daughter', 'great-niece');
            }
        case 'sischison':
            if ($sex1 == 'M') {
                return WT_I18N::translate_c('(a man’s) sister’s child’s son', 'great-nephew');
            } else {
                return WT_I18N::translate_c('(a woman’s) sister’s child’s son', 'great-nephew');
            }
        case 'sisdauchi':
            if ($sex1 == 'M') {
                return WT_I18N::translate_c('(a man’s) sister’s daughter’s child', 'great-nephew/niece');
            } else {
                return WT_I18N::translate_c('(a woman’s) sister’s daughter’s child', 'great-nephew/niece');
            }
        case 'sisdaudau':
            if ($sex1 == 'M') {
                return WT_I18N::translate_c('(a man’s) sister’s daughter’s daughter', 'great-niece');
            } else {
                return WT_I18N::translate_c('(a woman’s) sister’s daughter’s daughter', 'great-niece');
            }
        case 'sisdauhus':
            return WT_I18N::translate_c('sisters’s daughter’s husband', 'nephew-in-law');
        case 'sisdauson':
            if ($sex1 == 'M') {
                return WT_I18N::translate_c('(a man’s) sister’s daughter’s son', 'great-nephew');
            } else {
                return WT_I18N::translate_c('(a woman’s) sister’s daughter’s son', 'great-nephew');
            }
        case 'sishusbro':
            return WT_I18N::translate_c('sister’s husband’s brother', 'brother-in-law');
        case 'sishussib':
            return WT_I18N::translate_c('sister’s husband’s sibling', 'brother/sister-in-law');
        case 'sishussis':
            return WT_I18N::translate_c('sister’s husband’s sister', 'sister-in-law');
        case 'sissonchi':
            if ($sex1 == 'M') {
                return WT_I18N::translate_c('(a man’s) sister’s son’s child', 'great-nephew/niece');
            } else {
                return WT_I18N::translate_c('(a woman’s) sister’s son’s child', 'great-nephew/niece');
            }
        case 'sissondau':
            if ($sex1 == 'M') {
                return WT_I18N::translate_c('(a man’s) sister’s son’s daughter', 'great-niece');
            } else {
                return WT_I18N::translate_c('(a woman’s) sister’s son’s daughter', 'great-niece');
            }
        case 'sissonson':
            if ($sex1 == 'M') {
                return WT_I18N::translate_c('(a man’s) sister’s son’s son', 'great-nephew');
            } else {
                return WT_I18N::translate_c('(a woman’s) sister’s son’s son', 'great-nephew');
            }
        case 'sissonwif':
            return WT_I18N::translate_c('sisters’s son’s wife', 'niece-in-law');
        case 'sonchichi':
            return WT_I18N::translate_c('son’s child’s child', 'great-grandchild');
        case 'sonchidau':
            return WT_I18N::translate_c('son’s child’s daughter', 'great-granddaughter');
        case 'sonchison':
            return WT_I18N::translate_c('son’s child’s son', 'great-grandson');
        case 'sondauchi':
            return WT_I18N::translate_c('son’s daughter’s child', 'great-grandchild');
        case 'sondaudau':
            return WT_I18N::translate_c('son’s daughter’s daughter', 'great-granddaughter');
        case 'sondauhus':
            return WT_I18N::translate_c('son’s daughter’s husband', 'granddaughter’s husband');
        case 'sondauson':
            return WT_I18N::translate_c('son’s daughter’s son', 'great-grandson');
        case 'sonsonchi':
            return WT_I18N::translate_c('son’s son’s child', 'great-grandchild');
        case 'sonsondau':
            return WT_I18N::translate_c('son’s son’s daughter', 'great-granddaughter');
        case 'sonsonson':
            return WT_I18N::translate_c('son’s son’s son', 'great-grandson');
        case 'sonsonwif':
            return WT_I18N::translate_c('son’s son’s wife', 'grandson’s wife');
        case 'sonwiffat':
            return WT_I18N::translate_c('son’s wife’s father', 'daughter-in-law’s father');
        case 'sonwifmot':
            return WT_I18N::translate_c('son’s wife’s mother', 'daughter-in-law’s mother');
        case 'sonwifpar':
            return WT_I18N::translate_c('son’s wife’s parent', 'daughter-in-law’s parent');
        case 'wifbrowif':
            return WT_I18N::translate_c('wife’s brother’s wife', 'sister-in-law');
        case 'wifsishus':
            return WT_I18N::translate_c('wife’s sister’s husband', 'brother-in-law');
            // Some “special case” level four relationships that have specific names in certain languages
        // Some “special case” level four relationships that have specific names in certain languages
        case 'fatfatbrowif':
            return WT_I18N::translate_c('father’s father’s brother’s wife', 'great-aunt');
        case 'fatfatsibspo':
            return WT_I18N::translate_c('father’s father’s sibling’s spouse', 'great-aunt/uncle');
        case 'fatfatsishus':
            return WT_I18N::translate_c('father’s father’s sister’s husband', 'great-uncle');
        case 'fatmotbrowif':
            return WT_I18N::translate_c('father’s mother’s brother’s wife', 'great-aunt');
        case 'fatmotsibspo':
            return WT_I18N::translate_c('father’s mother’s sibling’s spouse', 'great-aunt/uncle');
        case 'fatmotsishus':
            return WT_I18N::translate_c('father’s mother’s sister’s husband', 'great-uncle');
        case 'fatparbrowif':
            return WT_I18N::translate_c('father’s parent’s brother’s wife', 'great-aunt');
        case 'fatparsibspo':
            return WT_I18N::translate_c('father’s parent’s sibling’s spouse', 'great-aunt/uncle');
        case 'fatparsishus':
            return WT_I18N::translate_c('father’s parent’s sister’s husband', 'great-uncle');
        case 'motfatbrowif':
            return WT_I18N::translate_c('mother’s father’s brother’s wife', 'great-aunt');
        case 'motfatsibspo':
            return WT_I18N::translate_c('mother’s father’s sibling’s spouse', 'great-aunt/uncle');
        case 'motfatsishus':
            return WT_I18N::translate_c('mother’s father’s sister’s husband', 'great-uncle');
        case 'motmotbrowif':
            return WT_I18N::translate_c('mother’s mother’s brother’s wife', 'great-aunt');
        case 'motmotsibspo':
            return WT_I18N::translate_c('mother’s mother’s sibling’s spouse', 'great-aunt/uncle');
        case 'motmotsishus':
            return WT_I18N::translate_c('mother’s mother’s sister’s husband', 'great-uncle');
        case 'motparbrowif':
            return WT_I18N::translate_c('mother’s parent’s brother’s wife', 'great-aunt');
        case 'motparsibspo':
            return WT_I18N::translate_c('mother’s parent’s sibling’s spouse', 'great-aunt/uncle');
        case 'motparsishus':
            return WT_I18N::translate_c('mother’s parent’s sister’s husband', 'great-uncle');
        case 'parfatbrowif':
            return WT_I18N::translate_c('parent’s father’s brother’s wife', 'great-aunt');
        case 'parfatsibspo':
            return WT_I18N::translate_c('parent’s father’s sibling’s spouse', 'great-aunt/uncle');
        case 'parfatsishus':
            return WT_I18N::translate_c('parent’s father’s sister’s husband', 'great-uncle');
        case 'parmotbrowif':
            return WT_I18N::translate_c('parent’s mother’s brother’s wife', 'great-aunt');
        case 'parmotsibspo':
            return WT_I18N::translate_c('parent’s mother’s sibling’s spouse', 'great-aunt/uncle');
        case 'parmotsishus':
            return WT_I18N::translate_c('parent’s mother’s sister’s husband', 'great-uncle');
        case 'parparbrowif':
            return WT_I18N::translate_c('parent’s parent’s brother’s wife', 'great-aunt');
        case 'parparsibspo':
            return WT_I18N::translate_c('parent’s parent’s sibling’s spouse', 'great-aunt/uncle');
        case 'parparsishus':
            return WT_I18N::translate_c('parent’s parent’s sister’s husband', 'great-uncle');
        case 'fatfatbrodau':
            return WT_I18N::translate_c('father’s father’s brother’s daughter', 'first cousin once removed ascending');
        case 'fatfatbroson':
            return WT_I18N::translate_c('father’s father’s brother’s son', 'first cousin once removed ascending');
        case 'fatfatbrochi':
            return WT_I18N::translate_c('father’s father’s brother’s child', 'first cousin once removed ascending');
        case 'fatfatsisdau':
            return WT_I18N::translate_c('father’s father’s sister’s daughter', 'first cousin once removed ascending');
        case 'fatfatsisson':
            return WT_I18N::translate_c('father’s father’s sister’s son', 'first cousin once removed ascending');
        case 'fatfatsischi':
            return WT_I18N::translate_c('father’s father’s sister’s child', 'first cousin once removed ascending');
        case 'fatmotbrodau':
            return WT_I18N::translate_c('father’s mother’s brother’s daughter', 'first cousin once removed ascending');
        case 'fatmotbroson':
            return WT_I18N::translate_c('father’s mother’s brother’s son', 'first cousin once removed ascending');
        case 'fatmotbrochi':
            return WT_I18N::translate_c('father’s mother’s brother’s child', 'first cousin once removed ascending');
        case 'fatmotsisdau':
            return WT_I18N::translate_c('father’s mother’s sister’s daughter', 'first cousin once removed ascending');
        case 'fatmotsisson':
            return WT_I18N::translate_c('father’s mother’s sister’s son', 'first cousin once removed ascending');
        case 'fatmotsischi':
            return WT_I18N::translate_c('father’s mother’s sister’s child', 'first cousin once removed ascending');
        case 'motfatbrodau':
            return WT_I18N::translate_c('mother’s father’s brother’s daughter', 'first cousin once removed ascending');
        case 'motfatbroson':
            return WT_I18N::translate_c('mother’s father’s brother’s son', 'first cousin once removed ascending');
        case 'motfatbrochi':
            return WT_I18N::translate_c('mother’s father’s brother’s child', 'first cousin once removed ascending');
        case 'motfatsisdau':
            return WT_I18N::translate_c('mother’s father’s sister’s daughter', 'first cousin once removed ascending');
        case 'motfatsisson':
            return WT_I18N::translate_c('mother’s father’s sister’s son', 'first cousin once removed ascending');
        case 'motfatsischi':
            return WT_I18N::translate_c('mother’s father’s sister’s child', 'first cousin once removed ascending');
        case 'motmotbrodau':
            return WT_I18N::translate_c('mother’s mother’s brother’s daughter', 'first cousin once removed ascending');
        case 'motmotbroson':
            return WT_I18N::translate_c('mother’s mother’s brother’s son', 'first cousin once removed ascending');
        case 'motmotbrochi':
            return WT_I18N::translate_c('mother’s mother’s brother’s child', 'first cousin once removed ascending');
        case 'motmotsisdau':
            return WT_I18N::translate_c('mother’s mother’s sister’s daughter', 'first cousin once removed ascending');
        case 'motmotsisson':
            return WT_I18N::translate_c('mother’s mother’s sister’s son', 'first cousin once removed ascending');
        case 'motmotsischi':
            return WT_I18N::translate_c('mother’s mother’s sister’s child', 'first cousin once removed ascending');
    }
    // Some “special case” level five relationships that have specific names in certain languages
    if (preg_match('/^(mot|fat|par)fatbro(son|dau|chi)dau$/', $path)) {
        return WT_I18N::translate_c('grandfather’s brother’s granddaughter', 'second cousin');
    } else {
        if (preg_match('/^(mot|fat|par)fatbro(son|dau|chi)son$/', $path)) {
            return WT_I18N::translate_c('grandfather’s brother’s grandson', 'second cousin');
        } else {
            if (preg_match('/^(mot|fat|par)fatbro(son|dau|chi)chi$/', $path)) {
                return WT_I18N::translate_c('grandfather’s brother’s grandchild', 'second cousin');
            } else {
                if (preg_match('/^(mot|fat|par)fatsis(son|dau|chi)dau$/', $path)) {
                    return WT_I18N::translate_c('grandfather’s sister’s granddaughter', 'second cousin');
                } else {
                    if (preg_match('/^(mot|fat|par)fatsis(son|dau|chi)son$/', $path)) {
                        return WT_I18N::translate_c('grandfather’s sister’s grandson', 'second cousin');
                    } else {
                        if (preg_match('/^(mot|fat|par)fatsis(son|dau|chi)chi$/', $path)) {
                            return WT_I18N::translate_c('grandfather’s sister’s grandchild', 'second cousin');
                        } else {
                            if (preg_match('/^(mot|fat|par)fatsib(son|dau|chi)dau$/', $path)) {
                                return WT_I18N::translate_c('grandfather’s sibling’s granddaughter', 'second cousin');
                            } else {
                                if (preg_match('/^(mot|fat|par)fatsib(son|dau|chi)son$/', $path)) {
                                    return WT_I18N::translate_c('grandfather’s sibling’s grandson', 'second cousin');
                                } else {
                                    if (preg_match('/^(mot|fat|par)fatsib(son|dau|chi)chi$/', $path)) {
                                        return WT_I18N::translate_c('grandfather’s sibling’s grandchild', 'second cousin');
                                    } else {
                                        if (preg_match('/^(mot|fat|par)motbro(son|dau|chi)dau$/', $path)) {
                                            return WT_I18N::translate_c('grandmother’s brother’s granddaughter', 'second cousin');
                                        } else {
                                            if (preg_match('/^(mot|fat|par)motbro(son|dau|chi)son$/', $path)) {
                                                return WT_I18N::translate_c('grandmother’s brother’s grandson', 'second cousin');
                                            } else {
                                                if (preg_match('/^(mot|fat|par)motbro(son|dau|chi)chi$/', $path)) {
                                                    return WT_I18N::translate_c('grandmother’s brother’s grandchild', 'second cousin');
                                                } else {
                                                    if (preg_match('/^(mot|fat|par)motsis(son|dau|chi)dau$/', $path)) {
                                                        return WT_I18N::translate_c('grandmother’s sister’s granddaughter', 'second cousin');
                                                    } else {
                                                        if (preg_match('/^(mot|fat|par)motsis(son|dau|chi)son$/', $path)) {
                                                            return WT_I18N::translate_c('grandmother’s sister’s grandson', 'second cousin');
                                                        } else {
                                                            if (preg_match('/^(mot|fat|par)motsis(son|dau|chi)chi$/', $path)) {
                                                                return WT_I18N::translate_c('grandmother’s sister’s grandchild', 'second cousin');
                                                            } else {
                                                                if (preg_match('/^(mot|fat|par)motsib(son|dau|chi)dau$/', $path)) {
                                                                    return WT_I18N::translate_c('grandmother’s sibling’s granddaughter', 'second cousin');
                                                                } else {
                                                                    if (preg_match('/^(mot|fat|par)motsib(son|dau|chi)son$/', $path)) {
                                                                        return WT_I18N::translate_c('grandmother’s sibling’s grandson', 'second cousin');
                                                                    } else {
                                                                        if (preg_match('/^(mot|fat|par)motsib(son|dau|chi)chi$/', $path)) {
                                                                            return WT_I18N::translate_c('grandmother’s sibling’s grandchild', 'second cousin');
                                                                        } else {
                                                                            if (preg_match('/^(mot|fat|par)parbro(son|dau|chi)dau$/', $path)) {
                                                                                return WT_I18N::translate_c('grandparent’s brother’s granddaughter', 'second cousin');
                                                                            } else {
                                                                                if (preg_match('/^(mot|fat|par)parbro(son|dau|chi)son$/', $path)) {
                                                                                    return WT_I18N::translate_c('grandparent’s brother’s grandson', 'second cousin');
                                                                                } else {
                                                                                    if (preg_match('/^(mot|fat|par)parbro(son|dau|chi)chi$/', $path)) {
                                                                                        return WT_I18N::translate_c('grandparent’s brother’s grandchild', 'second cousin');
                                                                                    } else {
                                                                                        if (preg_match('/^(mot|fat|par)parsis(son|dau|chi)dau$/', $path)) {
                                                                                            return WT_I18N::translate_c('grandparent’s sister’s granddaughter', 'second cousin');
                                                                                        } else {
                                                                                            if (preg_match('/^(mot|fat|par)parsis(son|dau|chi)son$/', $path)) {
                                                                                                return WT_I18N::translate_c('grandparent’s sister’s grandson', 'second cousin');
                                                                                            } else {
                                                                                                if (preg_match('/^(mot|fat|par)parsis(son|dau|chi)chi$/', $path)) {
                                                                                                    return WT_I18N::translate_c('grandparent’s sister’s grandchild', 'second cousin');
                                                                                                } else {
                                                                                                    if (preg_match('/^(mot|fat|par)parsib(son|dau|chi)dau$/', $path)) {
                                                                                                        return WT_I18N::translate_c('grandparent’s sibling’s granddaughter', 'second cousin');
                                                                                                    } else {
                                                                                                        if (preg_match('/^(mot|fat|par)parsib(son|dau|chi)son$/', $path)) {
                                                                                                            return WT_I18N::translate_c('grandparent’s sibling’s grandson', 'second cousin');
                                                                                                        } else {
                                                                                                            if (preg_match('/^(mot|fat|par)parsib(son|dau|chi)chi$/', $path)) {
                                                                                                                return WT_I18N::translate_c('grandparent’s sibling’s grandchild', 'second cousin');
                                                                                                            }
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    // Look for generic/pattern relationships.
    // TODO: these are heavily based on English relationship names.
    // We need feedback from other languages to improve this.
    // Dutch has special names for 8 generations of great-great-..., so these need explicit naming
    // Spanish has special names for four but also has two different numbering patterns
    if (preg_match('/^((?:mot|fat|par)+)(bro|sis|sib)$/', $path, $match)) {
        // siblings of direct ancestors
        $up = strlen($match[1]) / 3;
        $bef_last = substr($path, -6, 3);
        switch ($up) {
            case 3:
                switch ($sex2) {
                    case 'M':
                        if ($bef_last == 'fat') {
                            return WT_I18N::translate_c('great-grandfather’s brother', 'great-great-uncle');
                        } else {
                            if ($bef_last == 'mot') {
                                return WT_I18N::translate_c('great-grandmother’s brother', 'great-great-uncle');
                            } else {
                                return WT_I18N::translate_c('great-grandparent’s brother', 'great-great-uncle');
                            }
                        }
                    case 'F':
                        return WT_I18N::translate('great-great-aunt');
                    case 'U':
                        return WT_I18N::translate('great-great-aunt/uncle');
                }
                break;
            case 4:
                switch ($sex2) {
                    case 'M':
                        if ($bef_last == 'fat') {
                            return WT_I18N::translate_c('great-great-grandfather’s brother', 'great-great-great-uncle');
                        } else {
                            if ($bef_last == 'mot') {
                                return WT_I18N::translate_c('great-great-grandmother’s brother', 'great-great-great-uncle');
                            } else {
                                return WT_I18N::translate_c('great-great-grandparent’s brother', 'great-great-great-uncle');
                            }
                        }
                    case 'F':
                        return WT_I18N::translate('great-great-great-aunt');
                    case 'U':
                        return WT_I18N::translate('great-great-great-aunt/uncle');
                }
                break;
            case 5:
                switch ($sex2) {
                    case 'M':
                        if ($bef_last == 'fat') {
                            return WT_I18N::translate_c('great-great-great-grandfather’s brother', 'great ×4 uncle');
                        } else {
                            if ($bef_last == 'mot') {
                                return WT_I18N::translate_c('great-great-great-grandmother’s brother', 'great ×4 uncle');
                            } else {
                                return WT_I18N::translate_c('great-great-great-grandparent’s brother', 'great ×4 uncle');
                            }
                        }
                    case 'F':
                        return WT_I18N::translate('great ×4 aunt');
                    case 'U':
                        return WT_I18N::translate('great ×4 aunt/uncle');
                }
                break;
            case 6:
                switch ($sex2) {
                    case 'M':
                        if ($bef_last == 'fat') {
                            return WT_I18N::translate_c('great ×4 grandfather’s brother', 'great ×5 uncle');
                        } else {
                            if ($bef_last == 'mot') {
                                return WT_I18N::translate_c('great ×4 grandmother’s brother', 'great ×5 uncle');
                            } else {
                                return WT_I18N::translate_c('great ×4 grandparent’s brother', 'great ×5 uncle');
                            }
                        }
                    case 'F':
                        return WT_I18N::translate('great ×5 aunt');
                    case 'U':
                        return WT_I18N::translate('great ×5 aunt/uncle');
                }
                break;
            case 7:
                switch ($sex2) {
                    case 'M':
                        if ($bef_last == 'fat') {
                            return WT_I18N::translate_c('great ×5 grandfather’s brother', 'great ×6 uncle');
                        } else {
                            if ($bef_last == 'mot') {
                                return WT_I18N::translate_c('great ×5 grandmother’s brother', 'great ×6 uncle');
                            } else {
                                return WT_I18N::translate_c('great ×5 grandparent’s brother', 'great ×6 uncle');
                            }
                        }
                    case 'F':
                        return WT_I18N::translate('great ×6 aunt');
                    case 'U':
                        return WT_I18N::translate('great ×6 aunt/uncle');
                }
                break;
            case 8:
                switch ($sex2) {
                    case 'M':
                        if ($bef_last == 'fat') {
                            return WT_I18N::translate_c('great ×6 grandfather’s brother', 'great ×7 uncle');
                        } else {
                            if ($bef_last == 'mot') {
                                return WT_I18N::translate_c('great ×6 grandmother’s brother', 'great ×7 uncle');
                            } else {
                                return WT_I18N::translate_c('great ×6 grandparent’s brother', 'great ×7 uncle');
                            }
                        }
                    case 'F':
                        return WT_I18N::translate('great ×7 aunt');
                    case 'U':
                        return WT_I18N::translate('great ×7 aunt/uncle');
                }
                break;
            default:
                // Different languages have different rules for naming generations.
                // An English great ×12 uncle is a Danish great ×10 uncle.
                //
                // Need to find out which languages use which rules.
                switch (WT_LOCALE) {
                    case 'da':
                        switch ($sex2) {
                            case 'M':
                                return WT_I18N::translate('great ×%d uncle', $up - 4);
                            case 'F':
                                return WT_I18N::translate('great ×%d aunt', $up - 4);
                            case 'U':
                                return WT_I18N::translate('great ×%d aunt/uncle', $up - 4);
                        }
                    case 'pl':
                        switch ($sex2) {
                            case 'M':
                                if ($bef_last == 'fat') {
                                    return WT_I18N::translate_c('great ×(%d-1) grandfather’s brother', 'great ×%d uncle', $up - 2);
                                } else {
                                    if ($bef_last == 'mot') {
                                        return WT_I18N::translate_c('great ×(%d-1) grandmother’s brother', 'great ×%d uncle', $up - 2);
                                    } else {
                                        return WT_I18N::translate_c('great ×(%d-1) grandparent’s brother', 'great ×%d uncle', $up - 2);
                                    }
                                }
                            case 'F':
                                return WT_I18N::translate('great ×%d aunt', $up - 2);
                            case 'U':
                                return WT_I18N::translate('great ×%d aunt/uncle', $up - 2);
                        }
                    case 'it':
                        // Source: Michele Locati
                    // Source: Michele Locati
                    case 'en_AU':
                    case 'en_GB':
                    case 'en_US':
                    default:
                        switch ($sex2) {
                            case 'M':
                                // I18N: if you need a different number for %d, contact the developers, as a code-change is required
                                return WT_I18N::translate('great ×%d uncle', $up - 1);
                            case 'F':
                                return WT_I18N::translate('great ×%d aunt', $up - 1);
                            case 'U':
                                return WT_I18N::translate('great ×%d aunt/uncle', $up - 1);
                        }
                }
        }
    }
    if (preg_match('/^(?:bro|sis|sib)((?:son|dau|chi)+)$/', $path, $match)) {
        // direct descendants of siblings
        $down = strlen($match[1]) / 3 + 1;
        // Add one, as we count generations from the common ancestor
        $first = substr($path, 0, 3);
        switch ($down) {
            case 4:
                switch ($sex2) {
                    case 'M':
                        if ($first == 'bro' && $sex1 == 'M') {
                            return WT_I18N::translate_c('(a man’s) brother’s great-grandson', 'great-great-nephew');
                        } else {
                            if ($first == 'sis' && $sex1 == 'M') {
                                return WT_I18N::translate_c('(a man’s) sister’s great-grandson', 'great-great-nephew');
                            } else {
                                return WT_I18N::translate_c('(a woman’s) great-great-nephew', 'great-great-nephew');
                            }
                        }
                    case 'F':
                        if ($first == 'bro' && $sex1 == 'M') {
                            return WT_I18N::translate_c('(a man’s) brother’s great-granddaughter', 'great-great-niece');
                        } else {
                            if ($first == 'sis' && $sex1 == 'M') {
                                return WT_I18N::translate_c('(a man’s) sister’s great-granddaughter', 'great-great-niece');
                            } else {
                                return WT_I18N::translate_c('(a woman’s) great-great-niece', 'great-great-niece');
                            }
                        }
                    case 'U':
                        if ($first == 'bro' && $sex1 == 'M') {
                            return WT_I18N::translate_c('(a man’s) brother’s great-grandchild', 'great-great-nephew/niece');
                        } else {
                            if ($first == 'sis' && $sex1 == 'M') {
                                return WT_I18N::translate_c('(a man’s) sister’s great-grandchild', 'great-great-nephew/niece');
                            } else {
                                return WT_I18N::translate_c('(a woman’s) great-great-nephew/niece', 'great-great-nephew/niece');
                            }
                        }
                }
            case 5:
                switch ($sex2) {
                    case 'M':
                        if ($first == 'bro' && $sex1 == 'M') {
                            return WT_I18N::translate_c('(a man’s) brother’s great-great-grandson', 'great-great-great-nephew');
                        } else {
                            if ($first == 'sis' && $sex1 == 'M') {
                                return WT_I18N::translate_c('(a man’s) sister’s great-great-grandson', 'great-great-great-nephew');
                            } else {
                                return WT_I18N::translate_c('(a woman’s) great-great-great-nephew', 'great-great-great-nephew');
                            }
                        }
                    case 'F':
                        if ($first == 'bro' && $sex1 == 'M') {
                            return WT_I18N::translate_c('(a man’s) brother’s great-great-granddaughter', 'great-great-great-niece');
                        } else {
                            if ($first == 'sis' && $sex1 == 'M') {
                                return WT_I18N::translate_c('(a man’s) sister’s great-great-granddaughter', 'great-great-great-niece');
                            } else {
                                return WT_I18N::translate_c('(a woman’s) great-great-great-niece', 'great-great-great-niece');
                            }
                        }
                    case 'U':
                        if ($first == 'bro' && $sex1 == 'M') {
                            return WT_I18N::translate_c('(a man’s) brother’s great-great-grandchild', 'great-great-great-nephew/niece');
                        } else {
                            if ($first == 'sis' && $sex1 == 'M') {
                                return WT_I18N::translate_c('(a man’s) sister’s great-great-grandchild', 'great-great-great-nephew/niece');
                            } else {
                                return WT_I18N::translate_c('(a woman’s) great-great-great-nephew/niece', 'great-great-great-nephew/niece');
                            }
                        }
                }
            case 6:
                switch ($sex2) {
                    case 'M':
                        if ($first == 'bro' && $sex1 == 'M') {
                            return WT_I18N::translate_c('(a man’s) brother’s great-great-great-grandson', 'great ×4 nephew');
                        } else {
                            if ($first == 'sis' && $sex1 == 'M') {
                                return WT_I18N::translate_c('(a man’s) sister’s great-great-great-grandson', 'great ×4 nephew');
                            } else {
                                return WT_I18N::translate_c('(a woman’s) great ×4 nephew', 'great ×4 nephew');
                            }
                        }
                    case 'F':
                        if ($first == 'bro' && $sex1 == 'M') {
                            return WT_I18N::translate_c('(a man’s) brother’s great-great-great-granddaughter', 'great ×4 niece');
                        } else {
                            if ($first == 'sis' && $sex1 == 'M') {
                                return WT_I18N::translate_c('(a man’s) sister’s great-great-great-granddaughter', 'great ×4 niece');
                            } else {
                                return WT_I18N::translate_c('(a woman’s) great ×4 niece', 'great ×4 niece');
                            }
                        }
                    case 'U':
                        if ($first == 'bro' && $sex1 == 'M') {
                            return WT_I18N::translate_c('(a man’s) brother’s great-great-great-grandchild', 'great ×4 nephew/niece');
                        } else {
                            if ($first == 'sis' && $sex1 == 'M') {
                                return WT_I18N::translate_c('(a man’s) sister’s great-great-great-grandchild', 'great ×4 nephew/niece');
                            } else {
                                return WT_I18N::translate_c('(a woman’s) great ×4 nephew/niece', 'great ×4 nephew/niece');
                            }
                        }
                }
            case 7:
                switch ($sex2) {
                    case 'M':
                        if ($first == 'bro' && $sex1 == 'M') {
                            return WT_I18N::translate_c('(a man’s) brother’s great ×4 grandson', 'great ×5 nephew');
                        } else {
                            if ($first == 'sis' && $sex1 == 'M') {
                                return WT_I18N::translate_c('(a man’s) sister’s great ×4 grandson', 'great ×5 nephew');
                            } else {
                                return WT_I18N::translate_c('(a woman’s) great ×5 nephew', 'great ×5 nephew');
                            }
                        }
                    case 'F':
                        if ($first == 'bro' && $sex1 == 'M') {
                            return WT_I18N::translate_c('(a man’s) brother’s great ×4 granddaughter', 'great ×5 niece');
                        } else {
                            if ($first == 'sis' && $sex1 == 'M') {
                                return WT_I18N::translate_c('(a man’s) sister’s great ×4 granddaughter', 'great ×5 niece');
                            } else {
                                return WT_I18N::translate_c('(a woman’s) great ×5 niece', 'great ×5 niece');
                            }
                        }
                    case 'U':
                        if ($first == 'bro' && $sex1 == 'M') {
                            return WT_I18N::translate_c('(a man’s) brother’s great ×4 grandchild', 'great ×5 nephew/niece');
                        } else {
                            if ($first == 'sis' && $sex1 == 'M') {
                                return WT_I18N::translate_c('(a man’s) sister’s great ×4 grandchild', 'great ×5 nephew/niece');
                            } else {
                                return WT_I18N::translate_c('(a woman’s) great ×5 nephew/niece', 'great ×5 nephew/niece');
                            }
                        }
                }
            default:
                // Different languages have different rules for naming generations.
                // An English great ×12 nephew is a Polish great ×11 nephew.
                //
                // Need to find out which languages use which rules.
                switch (WT_LOCALE) {
                    case 'pl':
                        // Source: Lukasz Wilenski
                        switch ($sex2) {
                            case 'M':
                                if ($first == 'bro' && $sex1 == 'M') {
                                    return WT_I18N::translate_c('(a man’s) brother’s great ×(%d-1) grandson', 'great ×%d nephew', $down - 3);
                                } else {
                                    if ($first == 'sis' && $sex1 == 'M') {
                                        return WT_I18N::translate_c('(a man’s) sister’s great ×(%d-1) grandson', 'great ×%d nephew', $down - 3);
                                    } else {
                                        return WT_I18N::translate_c('(a woman’s) great ×%d nephew', 'great ×%d nephew', $down - 3);
                                    }
                                }
                            case 'F':
                                if ($first == 'bro' && $sex1 == 'M') {
                                    return WT_I18N::translate_c('(a man’s) brother’s great ×(%d-1) granddaughter', 'great ×%d niece', $down - 3);
                                } else {
                                    if ($first == 'sis' && $sex1 == 'M') {
                                        return WT_I18N::translate_c('(a man’s) sister’s great ×(%d-1) granddaughter', 'great ×%d niece', $down - 3);
                                    } else {
                                        return WT_I18N::translate_c('(a woman’s) great ×%d niece', 'great ×%d niece', $down - 3);
                                    }
                                }
                            case 'U':
                                if ($first == 'bro' && $sex1 == 'M') {
                                    return WT_I18N::translate_c('(a man’s) brother’s great ×(%d-1) grandchild', 'great ×%d nephew/niece', $down - 3);
                                } else {
                                    if ($first == 'sis' && $sex1 == 'M') {
                                        return WT_I18N::translate_c('(a man’s) sister’s great ×(%d-1) grandchild', 'great ×%d nephew/niece', $down - 3);
                                    } else {
                                        return WT_I18N::translate_c('(a woman’s) great ×%d nephew/niece', 'great ×%d nephew/niece', $down - 3);
                                    }
                                }
                        }
                    case 'he':
                        // Source: Meliza Amity
                        switch ($sex2) {
                            case 'M':
                                return WT_I18N::translate('great ×%d nephew', $down - 1);
                            case 'F':
                                return WT_I18N::translate('great ×%d niece', $down - 1);
                            case 'U':
                                return WT_I18N::translate('great ×%d nephew/niece', $down - 1);
                        }
                    case 'it':
                        // Source: Michele Locati.
                    // Source: Michele Locati.
                    case 'en_AU':
                    case 'en_GB':
                    case 'en_US':
                    default:
                        switch ($sex2) {
                            case 'M':
                                // I18N: if you need a different number for %d, contact the developers, as a code-change is required
                                return WT_I18N::translate('great ×%d nephew', $down - 2);
                            case 'F':
                                return WT_I18N::translate('great ×%d niece', $down - 2);
                            case 'U':
                                return WT_I18N::translate('great ×%d nephew/niece', $down - 2);
                        }
                }
        }
    }
    if (preg_match('/^((?:mot|fat|par)*)$/', $path, $match)) {
        // direct ancestors
        $up = strlen($match[1]) / 3;
        switch ($up) {
            case 4:
                switch ($sex2) {
                    case 'M':
                        return WT_I18N::translate('great-great-grandfather');
                    case 'F':
                        return WT_I18N::translate('great-great-grandmother');
                    case 'U':
                        return WT_I18N::translate('great-great-grandparent');
                }
                break;
            case 5:
                switch ($sex2) {
                    case 'M':
                        return WT_I18N::translate('great-great-great-grandfather');
                    case 'F':
                        return WT_I18N::translate('great-great-great-grandmother');
                    case 'U':
                        return WT_I18N::translate('great-great-great-grandparent');
                }
                break;
            case 6:
                switch ($sex2) {
                    case 'M':
                        return WT_I18N::translate('great ×4 grandfather');
                    case 'F':
                        return WT_I18N::translate('great ×4 grandmother');
                    case 'U':
                        return WT_I18N::translate('great ×4 grandparent');
                }
                break;
            case 7:
                switch ($sex2) {
                    case 'M':
                        return WT_I18N::translate('great ×5 grandfather');
                    case 'F':
                        return WT_I18N::translate('great ×5 grandmother');
                    case 'U':
                        return WT_I18N::translate('great ×5 grandparent');
                }
                break;
            case 8:
                switch ($sex2) {
                    case 'M':
                        return WT_I18N::translate('great ×6 grandfather');
                    case 'F':
                        return WT_I18N::translate('great ×6 grandmother');
                    case 'U':
                        return WT_I18N::translate('great ×6 grandparent');
                }
                break;
            case 9:
                switch ($sex2) {
                    case 'M':
                        return WT_I18N::translate('great ×7 grandfather');
                    case 'F':
                        return WT_I18N::translate('great ×7 grandmother');
                    case 'U':
                        return WT_I18N::translate('great ×7 grandparent');
                }
                break;
            default:
                // Different languages have different rules for naming generations.
                // An English great ×12 grandfather is a Danish great ×11 grandfather.
                //
                // Need to find out which languages use which rules.
                switch (WT_LOCALE) {
                    case 'da':
                        // Source: Patrick Sorensen
                        switch ($sex2) {
                            case 'M':
                                return WT_I18N::translate('great ×%d grandfather', $up - 3);
                            case 'F':
                                return WT_I18N::translate('great ×%d grandmother', $up - 3);
                            case 'U':
                                return WT_I18N::translate('great ×%d grandparent', $up - 3);
                        }
                    case 'it':
                        // Source: Michele Locati
                    // Source: Michele Locati
                    case 'es':
                        // Source: Wes Groleau
                        switch ($sex2) {
                            case 'M':
                                return WT_I18N::translate('great ×%d grandfather', $up);
                            case 'F':
                                return WT_I18N::translate('great ×%d grandmother', $up);
                            case 'U':
                                return WT_I18N::translate('great ×%d grandparent', $up);
                        }
                    case 'fr':
                        // Source: Jacqueline Tetreault
                    // Source: Jacqueline Tetreault
                    case 'fr_CA':
                        switch ($sex2) {
                            case 'M':
                                return WT_I18N::translate('great ×%d grandfather', $up - 1);
                            case 'F':
                                return WT_I18N::translate('great ×%d grandmother', $up - 1);
                            case 'U':
                                return WT_I18N::translate('great ×%d grandparent', $up - 1);
                        }
                    case 'nn':
                        // Source: Hogne Røed Nilsen (https://bugs.launchpad.net/webtrees/+bug/1168553)
                    // Source: Hogne Røed Nilsen (https://bugs.launchpad.net/webtrees/+bug/1168553)
                    case 'nb':
                        switch ($sex2) {
                            case 'M':
                                // I18N: if you need a different number for %d, contact the developers, as a code-change is required
                                return WT_I18N::translate('great ×%d grandfather', $up - 3);
                            case 'F':
                                return WT_I18N::translate('great ×%d grandmother', $up - 3);
                            case 'U':
                                return WT_I18N::translate('great ×%d grandparent', $up - 3);
                        }
                    case 'en_AU':
                    case 'en_GB':
                    case 'en_US':
                    default:
                        switch ($sex2) {
                            case 'M':
                                // I18N: if you need a different number for %d, contact the developers, as a code-change is required
                                return WT_I18N::translate('great ×%d grandfather', $up - 2);
                            case 'F':
                                return WT_I18N::translate('great ×%d grandmother', $up - 2);
                            case 'U':
                                return WT_I18N::translate('great ×%d grandparent', $up - 2);
                        }
                }
        }
    }
    if (preg_match('/^((?:son|dau|chi)*)$/', $path, $match)) {
        // direct descendants
        $up = strlen($match[1]) / 3;
        switch ($up) {
            case 4:
                switch ($sex2) {
                    case 'son':
                        return WT_I18N::translate('great-great-grandson');
                    case 'dau':
                        return WT_I18N::translate('great-great-granddaughter');
                    case 'chi':
                        return WT_I18N::translate('great-great-grandchild');
                }
                break;
            case 5:
                switch ($sex2) {
                    case 'M':
                        return WT_I18N::translate('great-great-great-grandson');
                    case 'F':
                        return WT_I18N::translate('great-great-great-granddaughter');
                    case 'U':
                        return WT_I18N::translate('great-great-great-grandchild');
                }
                break;
            case 6:
                switch ($sex2) {
                    case 'M':
                        return WT_I18N::translate('great ×4 grandson');
                    case 'F':
                        return WT_I18N::translate('great ×4 granddaughter');
                    case 'U':
                        return WT_I18N::translate('great ×4 grandchild');
                }
                break;
            case 7:
                switch ($sex2) {
                    case 'M':
                        return WT_I18N::translate('great ×5 grandson');
                    case 'F':
                        return WT_I18N::translate('great ×5 granddaughter');
                    case 'U':
                        return WT_I18N::translate('great ×5 grandchild');
                }
                break;
            case 8:
                switch ($sex2) {
                    case 'M':
                        return WT_I18N::translate('great ×6 grandson');
                    case 'F':
                        return WT_I18N::translate('great ×6 granddaughter');
                    case 'U':
                        return WT_I18N::translate('great ×6 grandchild');
                }
                break;
            case 9:
                switch ($sex2) {
                    case 'M':
                        return WT_I18N::translate('great ×7 grandson');
                    case 'F':
                        return WT_I18N::translate('great ×7 granddaughter');
                    case 'U':
                        return WT_I18N::translate('great ×7 grandchild');
                }
                break;
            default:
                // Different languages have different rules for naming generations.
                // An English great ×12 grandson is a Danish great ×11 grandson.
                //
                // Need to find out which languages use which rules.
                switch (WT_LOCALE) {
                    case 'nn':
                        // Source: Hogne Røed Nilsen
                    // Source: Hogne Røed Nilsen
                    case 'nb':
                    case 'da':
                        // Source: Patrick Sorensen
                        switch ($sex2) {
                            case 'M':
                                return WT_I18N::translate('great ×%d grandson', $up - 3);
                            case 'F':
                                return WT_I18N::translate('great ×%d granddaughter', $up - 3);
                            case 'U':
                                return WT_I18N::translate('great ×%d grandchild', $up - 3);
                        }
                    case 'it':
                        // Source: Michele Locati
                    // Source: Michele Locati
                    case 'es':
                        // Source: Wes Groleau (adding doesn’t change behavior, but needs to be better researched)
                    // Source: Wes Groleau (adding doesn’t change behavior, but needs to be better researched)
                    case 'en_AU':
                    case 'en_GB':
                    case 'en_US':
                    default:
                        switch ($sex2) {
                            case 'M':
                                // I18N: if you need a different number for %d, contact the developers, as a code-change is required
                                return WT_I18N::translate('great ×%d grandson', $up - 2);
                            case 'F':
                                return WT_I18N::translate('great ×%d granddaughter', $up - 2);
                            case 'U':
                                return WT_I18N::translate('great ×%d grandchild', $up - 2);
                        }
                }
        }
    }
    if (preg_match('/^((?:mot|fat|par)+)(?:bro|sis|sib)((?:son|dau|chi)+)$/', $path, $match)) {
        // cousins in English
        $ascent = $match[1];
        $descent = $match[2];
        $up = strlen($ascent) / 3;
        $down = strlen($descent) / 3;
        $cousin = min($up, $down);
        // Moved out of switch (en/default case) so that
        $removed = abs($down - $up);
        // Spanish (and other languages) can use it, too.
        // Different languages have different rules for naming cousins.  For example,
        // an English “second cousin once removed” is a Polish “cousin of 7th degree”.
        //
        // Need to find out which languages use which rules.
        switch (WT_LOCALE) {
            case 'pl':
                // Source: Lukasz Wilenski
                return cousin_name($up + $down + 2, $sex2);
            case 'it':
                // Source: Michele Locati.  See italian_cousins_names.zip
                // http://webtrees.net/forums/8-translation/1200-great-xn-grandparent?limit=6&start=6
                return cousin_name($up + $down - 3, $sex2);
            case 'es':
                // Source: Wes Groleau.  See http://UniGen.us/Parentesco.html & http://UniGen.us/Parentesco-D.html
                if ($down == $up) {
                    return cousin_name($cousin, $sex2);
                } elseif ($down < $up) {
                    return cousin_name2($cousin + 1, $sex2, get_relationship_name_from_path('sib' . $descent, null, null));
                } else {
                    switch ($sex2) {
                        case 'M':
                            return cousin_name2($cousin + 1, $sex2, get_relationship_name_from_path('bro' . $descent, null, null));
                        case 'F':
                            return cousin_name2($cousin + 1, $sex2, get_relationship_name_from_path('sis' . $descent, null, null));
                        case 'U':
                            return cousin_name2($cousin + 1, $sex2, get_relationship_name_from_path('sib' . $descent, null, null));
                    }
                }
            case 'en_AU':
                // See: http://en.wikipedia.org/wiki/File:CousinTree.svg
            // See: http://en.wikipedia.org/wiki/File:CousinTree.svg
            case 'en_GB':
            case 'en_US':
            default:
                switch ($removed) {
                    case 0:
                        return cousin_name($cousin, $sex2);
                    case 1:
                        if ($up > $down) {
                            /* I18N: %s=“fifth cousin”, etc. http://www.ancestry.com/learn/library/article.aspx?article=2856 */
                            return WT_I18N::translate('%s once removed ascending', cousin_name($cousin, $sex2));
                        } else {
                            /* I18N: %s=“fifth cousin”, etc. http://www.ancestry.com/learn/library/article.aspx?article=2856 */
                            return WT_I18N::translate('%s once removed descending', cousin_name($cousin, $sex2));
                        }
                    case 2:
                        if ($up > $down) {
                            /* I18N: %s=“fifth cousin”, etc. */
                            return WT_I18N::translate('%s twice removed ascending', cousin_name($cousin, $sex2));
                        } else {
                            /* I18N: %s=“fifth cousin”, etc. */
                            return WT_I18N::translate('%s twice removed descending', cousin_name($cousin, $sex2));
                        }
                    case 3:
                        if ($up > $down) {
                            /* I18N: %s=“fifth cousin”, etc. */
                            return WT_I18N::translate('%s three times removed ascending', cousin_name($cousin, $sex2));
                        } else {
                            /* I18N: %s=“fifth cousin”, etc. */
                            return WT_I18N::translate('%s three times removed descending', cousin_name($cousin, $sex2));
                        }
                    default:
                        if ($up > $down) {
                            /* I18N: %1$s=“fifth cousin”, etc., %2$d>=4 */
                            return WT_I18N::translate('%1$s %2$d times removed ascending', cousin_name($cousin, $sex2), $removed);
                        } else {
                            /* I18N: %1$s=“fifth cousin”, etc., %2$d>=4 */
                            return WT_I18N::translate('%1$s %2$d times removed descending', cousin_name($cousin, $sex2), $removed);
                        }
                }
        }
    }
    // Split the relationship into sub-relationships, e.g., third-cousin’s great-uncle.
    // Try splitting at every point, and choose the path with the shorted translated name.
    $relationship = null;
    $path1 = substr($path, 0, 3);
    $path2 = substr($path, 3);
    while ($path2) {
        $tmp = WT_I18N::translate('%1$s’s %2$s', get_relationship_name_from_path($path1, null, null), get_relationship_name_from_path($path2, null, null));
        if (!$relationship || strlen($tmp) < strlen($relationship)) {
            $relationship = $tmp;
        }
        $path1 .= substr($path2, 0, 3);
        $path2 = substr($path2, 3);
    }
    return $relationship;
}
Exemple #5
0
 /**
  * Prints descendency of passed in person
  *
  * @param WT_Individual|null $person
  * @param                    $count
  *
  * @return int
  */
 function print_descendency(WT_Individual $person = null, $count)
 {
     global $WT_IMAGES, $bwidth, $bheight, $show_full, $box_width;
     // print_pedigree_person() requires these globals.
     if ($count > $this->dgenerations) {
         return 0;
     }
     $show_full = $this->show_full;
     $box_width = $this->box_width;
     echo '<table><tr><td width="', $bwidth, '">';
     $numkids = 0;
     $famNum = 0;
     // if real person load child array
     if ($person) {
         $sfamilies = $person->getSpouseFamilies();
         $children = array();
         //count is position from center to left, dgenerations is number of generations
         if ($count < $this->dgenerations) {
             //-- put all of the children in a common array
             foreach ($sfamilies as $family) {
                 $famNum++;
                 $chs = $family->getChildren();
                 foreach ($chs as $child) {
                     $children[] = $child;
                 }
             }
             $ct = count($children);
         }
     } else {
         $ct = 0;
         // set to 0 for empty boxes
     }
     if ($count < $this->dgenerations) {
         if ($ct == 0) {
             // empty boxes
             echo '<table><tr><td>';
             $person2 = null;
             $kids = $this->print_descendency($person2, $count + 1);
             $numkids += $kids;
             echo '</td></tr></table>';
         }
         if ($ct > 0) {
             // real people
             echo '<table>';
             for ($i = 0; $i < $ct; $i++) {
                 $person2 = $children[$i];
                 $chil = $person2->getXref();
                 echo '<tr><td>';
                 $kids = $this->print_descendency($person2, $count + 1);
                 $numkids += $kids;
                 echo '</td>';
                 //-- print the lines
                 if ($ct > 1) {
                     if ($i == 0) {
                         //-- adjust for the first column on left
                         $h = round(($bheight * $kids + 8) / 2);
                         // Assumes border = 1 and padding = 3
                         //-- adjust for other vertical columns
                         if ($kids > 1) {
                             $h = ($kids - 1) * 4 + $h;
                         }
                         echo '<td class="tdbot">', '<img class="tvertline" id="vline_', $chil, '" src="', $WT_IMAGES["vline"], '"  height="', $h - 1, '" alt=""></td>';
                     } else {
                         if ($i == $ct - 1) {
                             //-- adjust for the first column on left
                             $h = round(($bheight * $kids + 8) / 2);
                             //-- adjust for other vertical columns
                             if ($kids > 1) {
                                 $h = ($kids - 1) * 4 + $h;
                             }
                             echo '<td class="tdtop">', '<img class="bvertline" id="vline_', $chil, '" src="', $WT_IMAGES["vline"], '" height="', $h + 1, '" alt=""></td>';
                         } else {
                             echo '<td style="background: url(', $WT_IMAGES["vline"], ');">', '<img class="spacer" src="', $WT_IMAGES["spacer"], '" alt=""></td>';
                         }
                     }
                 }
                 echo '</tr>';
             }
             echo '</table>';
         }
         echo '</td>';
         echo '<td width="', $bwidth, '">';
     }
     if ($numkids == 0) {
         $numkids = 1;
     }
     echo '<table><tr><td>';
     if ($person) {
         print_pedigree_person($person);
         echo '</td><td>', '<img class="line2" src="', $WT_IMAGES["hline"], '" width="8" height="3" alt="">';
     } else {
         echo '<div style="width:', $bwidth + 19, 'px; height:', $bheight + 8, 'px;"></div>', '</td><td>';
     }
     //----- Print the spouse
     if ($count == 1) {
         if ($this->show_spouse) {
             foreach ($sfamilies as $family) {
                 $spouse = $family->getSpouse($person);
                 echo '</td></tr><tr><td>';
                 //-- shrink the box for the spouses
                 $tempw = $bwidth;
                 $temph = $bheight;
                 $bwidth -= 5;
                 //$bheight -= 5;
                 print_pedigree_person($spouse);
                 $bwidth = $tempw;
                 $bheight = $temph;
                 $numkids += 0.95;
                 echo '</td><td>';
             }
         }
     }
     echo "</td></tr></table>";
     echo '</td></tr>';
     echo '</table>';
     return $numkids;
 }
Exemple #6
0
 public function loadSpouses(WT_Individual $person, $generations)
 {
     $out = '';
     if ($person && $person->canShow()) {
         foreach ($person->getSpouseFamilies() as $family) {
             $spouse = $family->getSpouse($person);
             if ($spouse) {
                 $out .= $this->getFamilyLi($family, $spouse, $generations - 1);
             }
         }
         if (!$out) {
             $out = '<li class="sb_desc_none">' . WT_I18N::translate('No children') . '</li>';
         }
     }
     if ($out) {
         return '<ul>' . $out . '</ul>';
     } else {
         return '';
     }
 }