1<?php 2 3/** 4 * webtrees: online genealogy 5 * Copyright (C) 2021 webtrees development team 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <https://www.gnu.org/licenses/>. 16 */ 17 18declare(strict_types=1); 19 20namespace Fisharebest\Webtrees\Elements; 21 22use Fisharebest\Webtrees\I18N; 23 24use function uasort; 25 26/** 27 * RELATION_IS_DESCRIPTOR := {Size=1:25} 28 * A word or phrase that states object 1's relation is object 2. For example 29 * you would read the following as "Joe Jacob's great grandson is the submitter 30 * pointed to by the @XREF:SUBM@": 31 * 0 INDI 32 * 1 NAME Joe /Jacob/ 33 * 1 ASSO @<XREF:SUBM>@ 34 * 2 RELA great grandson 35 */ 36class RelationIsDescriptor extends AbstractElement 37{ 38 protected const MAXIMUM_LENGTH = 25; 39 40 /** 41 * A list of controlled values for this element 42 * 43 * @param string $sex - the text depends on the sex of the *linked* individual 44 * 45 * @return array<int|string,string> 46 */ 47 public function values(string $sex = 'U'): array 48 { 49 $values = [ 50 'M' => [ 51 '' => '', 52 'attendant' => I18N::translateContext('MALE', 'Attendant'), 53 'attending' => I18N::translateContext('MALE', 'Attending'), 54 'best_man' => I18N::translate('Best man'), 55 'bridesmaid' => I18N::translate('Bridesmaid'), 56 'buyer' => I18N::translateContext('MALE', 'Buyer'), 57 'circumciser' => I18N::translate('Circumciser'), 58 'civil_registrar' => I18N::translateContext('MALE', 'Civil registrar'), 59 'employee' => I18N::translateContext('MALE', 'Employee'), 60 'employer' => I18N::translateContext('MALE', 'Employer'), 61 'foster_child' => I18N::translate('Foster child'), 62 'foster_father' => I18N::translate('Foster father'), 63 'foster_mother' => I18N::translate('Foster mother'), 64 'friend' => I18N::translateContext('MALE', 'Friend'), 65 'godfather' => I18N::translate('Godfather'), 66 'godmother' => I18N::translate('Godmother'), 67 'godparent' => I18N::translate('Godparent'), 68 'godson' => I18N::translate('Godson'), 69 'goddaughter' => I18N::translate('Goddaughter'), 70 'godchild' => I18N::translate('Godchild'), 71 'guardian' => I18N::translateContext('MALE', 'Guardian'), 72 'informant' => I18N::translateContext('MALE', 'Informant'), 73 'lodger' => I18N::translateContext('MALE', 'Lodger'), 74 'nanny' => I18N::translate('Nanny'), 75 'nurse' => I18N::translateContext('MALE', 'Nurse'), 76 'owner' => I18N::translateContext('MALE', 'Owner'), 77 'priest' => I18N::translate('Priest'), 78 'rabbi' => I18N::translate('Rabbi'), 79 'registry_officer' => I18N::translateContext('MALE', 'Registry officer'), 80 'seller' => I18N::translateContext('MALE', 'Seller'), 81 'servant' => I18N::translateContext('MALE', 'Servant'), 82 'slave' => I18N::translateContext('MALE', 'Slave'), 83 'ward' => I18N::translateContext('MALE', 'Ward'), 84 'witness' => I18N::translate('Witness'), 85 ], 86 'F' => [ 87 'attendant' => I18N::translateContext('FEMALE', 'Attendant'), 88 'attending' => I18N::translateContext('FEMALE', 'Attending'), 89 'best_man' => I18N::translate('Best man'), 90 'bridesmaid' => I18N::translate('Bridesmaid'), 91 'buyer' => I18N::translateContext('FEMALE', 'Buyer'), 92 'circumciser' => I18N::translate('Circumciser'), 93 'civil_registrar' => I18N::translateContext('FEMALE', 'Civil registrar'), 94 'employee' => I18N::translateContext('FEMALE', 'Employee'), 95 'employer' => I18N::translateContext('FEMALE', 'Employer'), 96 'foster_child' => I18N::translate('Foster child'), 97 'foster_father' => I18N::translate('Foster father'), 98 'foster_mother' => I18N::translate('Foster mother'), 99 'friend' => I18N::translateContext('FEMALE', 'Friend'), 100 'godfather' => I18N::translate('Godfather'), 101 'godmother' => I18N::translate('Godmother'), 102 'godparent' => I18N::translate('Godparent'), 103 'godson' => I18N::translate('Godson'), 104 'goddaughter' => I18N::translate('Goddaughter'), 105 'godchild' => I18N::translate('Godchild'), 106 'guardian' => I18N::translateContext('FEMALE', 'Guardian'), 107 'informant' => I18N::translateContext('FEMALE', 'Informant'), 108 'lodger' => I18N::translateContext('FEMALE', 'Lodger'), 109 'nanny' => I18N::translate('Nanny'), 110 'nurse' => I18N::translateContext('FEMALE', 'Nurse'), 111 'owner' => I18N::translateContext('FEMALE', 'Owner'), 112 'priest' => I18N::translate('Priest'), 113 'rabbi' => I18N::translate('Rabbi'), 114 'registry_officer' => I18N::translateContext('FEMALE', 'Registry officer'), 115 'seller' => I18N::translateContext('FEMALE', 'Seller'), 116 'servant' => I18N::translateContext('FEMALE', 'Servant'), 117 'slave' => I18N::translateContext('FEMALE', 'Slave'), 118 'ward' => I18N::translateContext('FEMALE', 'Ward'), 119 'witness' => I18N::translate('Witness'), 120 ], 121 'U' => [ 122 'attendant' => I18N::translate('Attendant'), 123 'attending' => I18N::translate('Attending'), 124 'best_man' => I18N::translate('Best man'), 125 'bridesmaid' => I18N::translate('Bridesmaid'), 126 'buyer' => I18N::translate('Buyer'), 127 'circumciser' => I18N::translate('Circumciser'), 128 'civil_registrar' => I18N::translate('Civil registrar'), 129 'employee' => I18N::translate('Employee'), 130 'employer' => I18N::translate('Employer'), 131 'foster_child' => I18N::translate('Foster child'), 132 'foster_father' => I18N::translate('Foster father'), 133 'foster_mother' => I18N::translate('Foster mother'), 134 'friend' => I18N::translate('Friend'), 135 'godfather' => I18N::translate('Godfather'), 136 'godmother' => I18N::translate('Godmother'), 137 'godparent' => I18N::translate('Godparent'), 138 'godson' => I18N::translate('Godson'), 139 'goddaughter' => I18N::translate('Goddaughter'), 140 'godchild' => I18N::translate('Godchild'), 141 'guardian' => I18N::translate('Guardian'), 142 'informant' => I18N::translate('Informant'), 143 'lodger' => I18N::translate('Lodger'), 144 'nanny' => I18N::translate('Nanny'), 145 'nurse' => I18N::translate('Nurse'), 146 'owner' => I18N::translate('Owner'), 147 'priest' => I18N::translate('Priest'), 148 'rabbi' => I18N::translate('Rabbi'), 149 'registry_officer' => I18N::translate('Registry officer'), 150 'seller' => I18N::translate('Seller'), 151 'servant' => I18N::translate('Servant'), 152 'slave' => I18N::translate('Slave'), 153 'ward' => I18N::translate('Ward'), 154 'witness' => I18N::translate('Witness'), 155 ], 156 ]; 157 158 $tmp = $values[$sex] ?? $values['U']; 159 160 uasort($tmp, I18N::comparator()); 161 162 return $tmp; 163 } 164} 165