1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* webtrees: online genealogy |
5
|
|
|
* Copyright (C) 2022 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
|
|
|
|
18
|
|
|
declare(strict_types=1); |
19
|
|
|
|
20
|
|
|
namespace Fisharebest\Webtrees\Elements; |
21
|
|
|
|
22
|
|
|
use Fisharebest\Webtrees\I18N; |
23
|
|
|
|
24
|
|
|
use function strtoupper; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* NAME_TYPE := {Size=5:30} |
28
|
|
|
* [ aka | birth | immigrant | maiden | married | <user defined>] |
29
|
|
|
* Indicates the name type, for example the name issued or assumed as an immigrant. |
30
|
|
|
* aka = also known as, alias, etc. |
31
|
|
|
* birth = name given on birth certificate. |
32
|
|
|
* immigrant = name assumed at the time of immigration. |
33
|
|
|
* maiden = maiden name, name before first marriage. |
34
|
|
|
* married =name was persons previous married name. |
35
|
|
|
* user_defined = other text name that defines the name type. |
36
|
|
|
*/ |
37
|
|
|
class NameType extends AbstractElement |
38
|
|
|
{ |
39
|
|
|
public const VALUE_ADOPTED = 'ADOPTED'; |
40
|
|
|
public const VALUE_AKA = 'AKA'; |
41
|
|
|
public const VALUE_BIRTH = 'BIRTH'; |
42
|
|
|
public const VALUE_CHANGE = 'CHANGE'; |
43
|
|
|
public const VALUE_ESTATE = 'ESTATE'; |
44
|
|
|
public const VALUE_IMMIGRANT = 'IMMIGRANT'; |
45
|
|
|
public const VALUE_MAIDEN = 'MAIDEN'; |
46
|
|
|
public const VALUE_MARRIED = 'MARRIED'; |
47
|
|
|
public const VALUE_RELIGIOUS = 'RELIGIOUS'; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Convert a value to a canonical form. |
51
|
|
|
* |
52
|
|
|
* @param string $value |
53
|
|
|
* |
54
|
|
|
* @return string |
55
|
|
|
*/ |
56
|
|
|
public function canonical(string $value): string |
57
|
|
|
{ |
58
|
|
|
return strtoupper(parent::canonical($value)); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* A list of controlled values for this element |
63
|
|
|
* |
64
|
|
|
* @return array<int|string,string> |
65
|
|
|
*/ |
66
|
|
|
public function values(): array |
67
|
|
|
{ |
68
|
|
|
return [ |
69
|
|
|
'' => '', |
70
|
|
|
/* I18N: The name given to a child by its adoptive parents */ |
71
|
|
|
self::VALUE_ADOPTED => I18N::translate('adopted name'), |
72
|
|
|
/* I18N: The name by which an individual is also known. e.g. a professional name or a stage name */ |
73
|
|
|
self::VALUE_AKA => I18N::translate('also known as'), |
74
|
|
|
/* I18N: The name given to an individual at their birth */ |
75
|
|
|
self::VALUE_BIRTH => I18N::translate('birth name'), |
76
|
|
|
/* I18N: A name chosen by an individual, to replace their existing name (whether legal or otherwise) */ |
77
|
|
|
self::VALUE_CHANGE => I18N::translate('change of name'), |
78
|
|
|
/* I18N: A name given to an individual, from the farm or estate on which they lived or worked */ |
79
|
|
|
self::VALUE_ESTATE => I18N::translate('estate name'), |
80
|
|
|
/* I18N: A name taken on immigration - e.g. migrants to the USA frequently anglicized their names */ |
81
|
|
|
self::VALUE_IMMIGRANT => I18N::translate('immigration name'), |
82
|
|
|
/* I18N: A woman’s name, before she marries (in cultures where women take their new husband’s name on marriage) */ |
83
|
|
|
self::VALUE_MAIDEN => I18N::translate('maiden name'), |
84
|
|
|
/* I18N: A name taken on marriage - usually the wife takes the husband’s surname */ |
85
|
|
|
self::VALUE_MARRIED => I18N::translate('married name'), |
86
|
|
|
/* I18N: A name taken when entering a religion or a religious order */ |
87
|
|
|
self::VALUE_RELIGIOUS => I18N::translate('religious name'), |
88
|
|
|
]; |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|