1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
<?php
/**
* Finnish Date Functions that can be used by any page in PGV
* Other functions that are specific to Finnish can be added here too
*
* The functions in this file are common to all PGV pages and include date conversion
* routines and sorting functions.
*
* webtrees: Web based Family History software
* Copyright (C) 2010 webtrees development team.
*
* Derived from PhpGedView
* Copyright (C) 2002 to 2003 John Finlay and Others
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @package webtrees
* @version $Id$
*/
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
define('WT_FUNCTIONS_FI_PHP', '');
////////////////////////////////////////////////////////////////////////////////
// Localise a date. "[qualifier] date [qualifier date] [qualifier]"
////////////////////////////////////////////////////////////////////////////////
function date_localisation_fi(&$q1, &$d1, &$q2, &$d2, &$q3) {
// Constant 'ta' is appended to the Finnish month values, if a day value exists
$d1=preg_replace("/(\b\d{1,2}\D+kuu\b)/", "$1ta", $d1);
$d2=preg_replace("/(\b\d{1,2}\D+kuu\b)/", "$1ta", $d2);
}
//-- functions to calculate finnish specific genitive names
// NOTE this function is incomplete and probably very inefficient.
// I've decided that for now the task is beyond me, I have looked
// for a freely availiable algorithm and failed to find one.
// it is best left to a finnish speaker
function getFirstRelationsName_fi($pid)
{
// In Finnish we want the genitive form of the name
$person=Person::getInstance($pid);
if ($person) {
$name=$person->getFullName();
} else {
$name='';
}
// for now I have been asked to remove the body of this function - if any Finnish
// speaker can sort this out I would be grateful.
return $name;
// First we look for Consonant gradation
if(preg_match("/kki$/", $name))
{
preg_replace("/kki$/", "kin", $name);
}
else if(preg_match("/kka$/", $name))
{
preg_replace("/kka$/", "kan", $name);
}
else if(preg_match("/ppi$/", $name))
{
preg_replace("/ppi$/", "pin", $name);
}
else if(preg_match("/ppa$/", $name))
{
preg_replace("/ppa$/", "pan", $name);
}
else if(preg_match("/tti$/", $name))
{
preg_replace("/tti$/", "tin", $name);
}
else if(preg_match("/tta$/", $name))
{
preg_replace("/tta$/", "tan", $name);
}
else if(preg_match("/nti$/", $name))
{
preg_replace("/nti$/", "nnin", $name);
}
else if(preg_match("/nta$/", $name))
{
preg_replace("/nta$/", "nnan", $name);
}
//Now we sort out endings
// Names ending in 'e' now end 'een'
else if(preg_match("/e$/", $name))
{
$name = $name . "en";
}
// Names ending 'nen' now end 'sen'
else if(preg_match("/nen$/", $name))
{
preg_replace("/nen$/", "sen", $name);
}
// Names ending 'n' now end 'men'
else if(preg_match("/n$/", $name))
{
preg_replace("/n$/", "men", $name);
}
// Names ending 'si' now end 'den'
else if(preg_match("/si$/", $name))
{
preg_replace("/si$/", "den", $name);
}
// Names ending 'is' now end 'iin'
else if(preg_match("/is$/", $name))
{
preg_replace("/is$/", "iin", $name);
}
// Names ending 'as' now end 'aan'
else if(preg_match("/as$/", $name))
{
preg_replace("/as$/", "aan", $name);
}
// Names ending 'a' now end 'aan'
else if(preg_match("/a$/", $name))
{
preg_replace("/a$/", "aan", $name);
}
// Names ending 'us' now end 'ksen'
else if(preg_match("/us$/", $name))
{
preg_replace("/us$/", "ksen", $name);
}
// Names ending 'ys' now end 'ksen'
else if(preg_match("/ys$/", $name))
{
preg_replace("/ys$/", "ksen", $name);
}
// Names ending 'os' now end 'ksen'
else if(preg_match("/os$/", $name))
{
preg_replace("/os$/", "ksen", $name);
}
// Names ending 'ös' now end 'ksen'
else if(preg_match("/ös$/", $name))
{
preg_replace("/ös$/", "ksen", $name);
}
// All other names have 'n' appended
else
{
$name = $name . "n";
}
return $name;
}
?>
|