xref: /webtrees/app/Elements/RelationIsDescriptor.php (revision f7cf8a155e2743f3d124eef3d30a558ab062fa4b)
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
24/**
25 * RELATION_IS_DESCRIPTOR := {Size=1:25}
26 * A word or phrase that states object 1's relation is object 2. For example
27 * you would read the following as "Joe Jacob's great grandson is the submitter
28 * pointed to by the @XREF:SUBM@":
29 * 0 INDI
30 * 1 NAME Joe /Jacob/
31 * 1 ASSO @<XREF:SUBM>@
32 * 2 RELA great grandson
33 */
34class RelationIsDescriptor extends AbstractElement
35{
36    protected const MAXIMUM_LENGTH = 25;
37
38    /**
39     * A list of controlled values for this element
40     *
41     * @param string $sex - the text depends on the sex of the *linked* individual
42     *
43     * @return array<int|string,string>
44     */
45    public function values(string $sex = 'U'): array
46    {
47        $values = [
48            'M' => [
49                ''                 => '',
50                'attendant'        => I18N::translateContext('MALE', 'Attendant'),
51                'attending'        => I18N::translateContext('MALE', 'Attending'),
52                'best_man'         => I18N::translate('Best man'),
53                'bridesmaid'       => I18N::translate('Bridesmaid'),
54                'buyer'            => I18N::translateContext('MALE', 'Buyer'),
55                'circumciser'      => I18N::translate('Circumciser'),
56                'civil_registrar'  => I18N::translateContext('MALE', 'Civil registrar'),
57                'employee'         => I18N::translateContext('MALE', 'Employee'),
58                'employer'         => I18N::translateContext('MALE', 'Employer'),
59                'foster_child'     => I18N::translate('Foster child'),
60                'foster_father'    => I18N::translate('Foster father'),
61                'foster_mother'    => I18N::translate('Foster mother'),
62                'friend'           => I18N::translateContext('MALE', 'Friend'),
63                'godfather'        => I18N::translate('Godfather'),
64                'godmother'        => I18N::translate('Godmother'),
65                'godparent'        => I18N::translate('Godparent'),
66                'godson'           => I18N::translate('Godson'),
67                'goddaughter'      => I18N::translate('Goddaughter'),
68                'godchild'         => I18N::translate('Godchild'),
69                'guardian'         => I18N::translateContext('MALE', 'Guardian'),
70                'informant'        => I18N::translateContext('MALE', 'Informant'),
71                'lodger'           => I18N::translateContext('MALE', 'Lodger'),
72                'nanny'            => I18N::translate('Nanny'),
73                'nurse'            => I18N::translateContext('MALE', 'Nurse'),
74                'owner'            => I18N::translateContext('MALE', 'Owner'),
75                'priest'           => I18N::translate('Priest'),
76                'rabbi'            => I18N::translate('Rabbi'),
77                'registry_officer' => I18N::translateContext('MALE', 'Registry officer'),
78                'seller'           => I18N::translateContext('MALE', 'Seller'),
79                'servant'          => I18N::translateContext('MALE', 'Servant'),
80                'slave'            => I18N::translateContext('MALE', 'Slave'),
81                'ward'             => I18N::translateContext('MALE', 'Ward'),
82                'witness'          => I18N::translate('Witness'),
83            ],
84            'F' => [
85                'attendant'        => I18N::translateContext('FEMALE', 'Attendant'),
86                'attending'        => I18N::translateContext('FEMALE', 'Attending'),
87                'best_man'         => I18N::translate('Best man'),
88                'bridesmaid'       => I18N::translate('Bridesmaid'),
89                'buyer'            => I18N::translateContext('FEMALE', 'Buyer'),
90                'circumciser'      => I18N::translate('Circumciser'),
91                'civil_registrar'  => I18N::translateContext('FEMALE', 'Civil registrar'),
92                'employee'         => I18N::translateContext('FEMALE', 'Employee'),
93                'employer'         => I18N::translateContext('FEMALE', 'Employer'),
94                'foster_child'     => I18N::translate('Foster child'),
95                'foster_father'    => I18N::translate('Foster father'),
96                'foster_mother'    => I18N::translate('Foster mother'),
97                'friend'           => I18N::translateContext('FEMALE', 'Friend'),
98                'godfather'        => I18N::translate('Godfather'),
99                'godmother'        => I18N::translate('Godmother'),
100                'godparent'        => I18N::translate('Godparent'),
101                'godson'           => I18N::translate('Godson'),
102                'goddaughter'      => I18N::translate('Goddaughter'),
103                'godchild'         => I18N::translate('Godchild'),
104                'guardian'         => I18N::translateContext('FEMALE', 'Guardian'),
105                'informant'        => I18N::translateContext('FEMALE', 'Informant'),
106                'lodger'           => I18N::translateContext('FEMALE', 'Lodger'),
107                'nanny'            => I18N::translate('Nanny'),
108                'nurse'            => I18N::translateContext('FEMALE', 'Nurse'),
109                'owner'            => I18N::translateContext('FEMALE', 'Owner'),
110                'priest'           => I18N::translate('Priest'),
111                'rabbi'            => I18N::translate('Rabbi'),
112                'registry_officer' => I18N::translateContext('FEMALE', 'Registry officer'),
113                'seller'           => I18N::translateContext('FEMALE', 'Seller'),
114                'servant'          => I18N::translateContext('FEMALE', 'Servant'),
115                'slave'            => I18N::translateContext('FEMALE', 'Slave'),
116                'ward'             => I18N::translateContext('FEMALE', 'Ward'),
117                'witness'          => I18N::translate('Witness'),
118            ],
119            'U' => [
120                'attendant'        => I18N::translate('Attendant'),
121                'attending'        => I18N::translate('Attending'),
122                'best_man'         => I18N::translate('Best man'),
123                'bridesmaid'       => I18N::translate('Bridesmaid'),
124                'buyer'            => I18N::translate('Buyer'),
125                'circumciser'      => I18N::translate('Circumciser'),
126                'civil_registrar'  => I18N::translate('Civil registrar'),
127                'employee'         => I18N::translate('Employee'),
128                'employer'         => I18N::translate('Employer'),
129                'foster_child'     => I18N::translate('Foster child'),
130                'foster_father'    => I18N::translate('Foster father'),
131                'foster_mother'    => I18N::translate('Foster mother'),
132                'friend'           => I18N::translate('Friend'),
133                'godfather'        => I18N::translate('Godfather'),
134                'godmother'        => I18N::translate('Godmother'),
135                'godparent'        => I18N::translate('Godparent'),
136                'godson'           => I18N::translate('Godson'),
137                'goddaughter'      => I18N::translate('Goddaughter'),
138                'godchild'         => I18N::translate('Godchild'),
139                'guardian'         => I18N::translate('Guardian'),
140                'informant'        => I18N::translate('Informant'),
141                'lodger'           => I18N::translate('Lodger'),
142                'nanny'            => I18N::translate('Nanny'),
143                'nurse'            => I18N::translate('Nurse'),
144                'owner'            => I18N::translate('Owner'),
145                'priest'           => I18N::translate('Priest'),
146                'rabbi'            => I18N::translate('Rabbi'),
147                'registry_officer' => I18N::translate('Registry officer'),
148                'seller'           => I18N::translate('Seller'),
149                'servant'          => I18N::translate('Servant'),
150                'slave'            => I18N::translate('Slave'),
151                'ward'             => I18N::translate('Ward'),
152                'witness'          => I18N::translate('Witness'),
153            ],
154        ];
155
156        return $values[$sex] ?? $values['U'];
157    }
158}
159