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
|
<?php
namespace Fisharebest\Webtrees;
/**
* webtrees: online genealogy
* Copyright (C) 2015 webtrees development team
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
use Fisharebest\ExtCalendar\ArabicCalendar;
/**
* Class HijriDate - Definitions for the Hijri calendar.
*
* Note that these are "theoretical" dates.
* "True" dates are based on local lunar observations, and can be a +/- one day.
*/
class HijriDate extends CalendarDate {
const CALENDAR_ESCAPE = '@#DHIJRI@';
const CAL_START_JD = 1948440; // @#DHIJRI@ 1 MUHAR 0001 = @#JULIAN@ 16 JUL 0622
/** {@inheritdoc} */
public static $MONTH_ABBREV = array('' => 0, 'MUHAR' => 1, 'SAFAR' => 2, 'RABIA' => 3, 'RABIT' => 4, 'JUMAA' => 5, 'JUMAT' => 6, 'RAJAB' => 7, 'SHAAB' => 8, 'RAMAD' => 9, 'SHAWW' => 10, 'DHUAQ' => 11, 'DHUAH' => 12);
/** {@inheritdoc} */
public function __construct($date) {
$this->calendar = new ArabicCalendar;
parent::__construct($date);
}
/** {@inheritdoc} */
public static function calendarName() {
return /* I18N: The Arabic/Hijri calendar */
I18N::translate('Hijri');
}
/** {@inheritdoc} */
public static function monthNameNominativeCase($month_number, $leap_year) {
static $translated_month_names;
if ($translated_month_names === null) {
$translated_month_names = array(
0 => '',
1 => /* I18N: http://en.wikipedia.org/wiki/Muharram */ I18N::translate_c('NOMINATIVE', 'Muharram'),
2 => /* I18N: http://en.wikipedia.org/wiki/Safar */ I18N::translate_c('NOMINATIVE', 'Safar'),
3 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-awwal */ I18N::translate_c('NOMINATIVE', 'Rabi’ al-awwal'),
4 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-thani */ I18N::translate_c('NOMINATIVE', 'Rabi’ al-thani'),
5 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-awwal */ I18N::translate_c('NOMINATIVE', 'Jumada al-awwal'),
6 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-thani */ I18N::translate_c('NOMINATIVE', 'Jumada al-thani'),
7 => /* I18N: http://en.wikipedia.org/wiki/Rajab */ I18N::translate_c('NOMINATIVE', 'Rajab'),
8 => /* I18N: http://en.wikipedia.org/wiki/Sha%27aban */ I18N::translate_c('NOMINATIVE', 'Sha’aban'),
9 => /* I18N: http://en.wikipedia.org/wiki/Ramadan_%28calendar_month%29 */ I18N::translate_c('NOMINATIVE', 'Ramadan'),
10 => /* I18N: http://en.wikipedia.org/wiki/Shawwal */ I18N::translate_c('NOMINATIVE', 'Shawwal'),
11 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Qi%27dah */ I18N::translate_c('NOMINATIVE', 'Dhu al-Qi’dah'),
12 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Hijjah */ I18N::translate_c('NOMINATIVE', 'Dhu al-Hijjah'),
);
}
return $translated_month_names[$month_number];
}
/** {@inheritdoc} */
static function monthNameGenitiveCase($month_number, $leap_year) {
static $translated_month_names;
if ($translated_month_names === null) {
$translated_month_names = array(
0 => '',
1 => /* I18N: http://en.wikipedia.org/wiki/Muharram */ I18N::translate_c('GENITIVE', 'Muharram'),
2 => /* I18N: http://en.wikipedia.org/wiki/Safar */ I18N::translate_c('GENITIVE', 'Safar'),
3 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-awwal */ I18N::translate_c('GENITIVE', 'Rabi’ al-awwal'),
4 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-thani */ I18N::translate_c('GENITIVE', 'Rabi’ al-thani'),
5 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-awwal */ I18N::translate_c('GENITIVE', 'Jumada al-awwal'),
6 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-thani */ I18N::translate_c('GENITIVE', 'Jumada al-thani'),
7 => /* I18N: http://en.wikipedia.org/wiki/Rajab */ I18N::translate_c('GENITIVE', 'Rajab'),
8 => /* I18N: http://en.wikipedia.org/wiki/Sha%27aban */ I18N::translate_c('GENITIVE', 'Sha’aban'),
9 => /* I18N: http://en.wikipedia.org/wiki/Ramadan_%28calendar_month%29 */ I18N::translate_c('GENITIVE', 'Ramadan'),
10 => /* I18N: http://en.wikipedia.org/wiki/Shawwal */ I18N::translate_c('GENITIVE', 'Shawwal'),
11 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Qi%27dah */ I18N::translate_c('GENITIVE', 'Dhu al-Qi’dah'),
12 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Hijjah */ I18N::translate_c('GENITIVE', 'Dhu al-Hijjah'),
);
}
return $translated_month_names[$month_number];
}
/** {@inheritdoc} */
static function monthNameLocativeCase($month_number, $leap_year) {
static $translated_month_names;
if ($translated_month_names === null) {
$translated_month_names = array(
0 => '',
1 => /* I18N: http://en.wikipedia.org/wiki/Muharram */ I18N::translate_c('LOCATIVE', 'Muharram'),
2 => /* I18N: http://en.wikipedia.org/wiki/Safar */ I18N::translate_c('LOCATIVE', 'Safar'),
3 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-awwal */ I18N::translate_c('LOCATIVE', 'Rabi’ al-awwal'),
4 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-thani */ I18N::translate_c('LOCATIVE', 'Rabi’ al-thani'),
5 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-awwal */ I18N::translate_c('LOCATIVE', 'Jumada al-awwal'),
6 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-thani */ I18N::translate_c('LOCATIVE', 'Jumada al-thani'),
7 => /* I18N: http://en.wikipedia.org/wiki/Rajab */ I18N::translate_c('LOCATIVE', 'Rajab'),
8 => /* I18N: http://en.wikipedia.org/wiki/Sha%27aban */ I18N::translate_c('LOCATIVE', 'Sha’aban'),
9 => /* I18N: http://en.wikipedia.org/wiki/Ramadan_%28calendar_month%29 */ I18N::translate_c('LOCATIVE', 'Ramadan'),
10 => /* I18N: http://en.wikipedia.org/wiki/Shawwal */ I18N::translate_c('LOCATIVE', 'Shawwal'),
11 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Qi%27dah */ I18N::translate_c('LOCATIVE', 'Dhu al-Qi’dah'),
12 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Hijjah */ I18N::translate_c('LOCATIVE', 'Dhu al-Hijjah'),
);
}
return $translated_month_names[$month_number];
}
/** {@inheritdoc} */
static function monthNameInstrumentalCase($month_number, $leap_year) {
static $translated_month_names;
if ($translated_month_names === null) {
$translated_month_names = array(
0 => '',
1 => /* I18N: http://en.wikipedia.org/wiki/Muharram */ I18N::translate_c('INSTRUMENTAL', 'Muharram'),
2 => /* I18N: http://en.wikipedia.org/wiki/Safar */ I18N::translate_c('INSTRUMENTAL', 'Safar'),
3 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-awwal */ I18N::translate_c('INSTRUMENTAL', 'Rabi’ al-awwal'),
4 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-thani */ I18N::translate_c('INSTRUMENTAL', 'Rabi’ al-thani'),
5 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-awwal */ I18N::translate_c('INSTRUMENTAL', 'Jumada al-awwal'),
6 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-thani */ I18N::translate_c('INSTRUMENTAL', 'Jumada al-thani'),
7 => /* I18N: http://en.wikipedia.org/wiki/Rajab */ I18N::translate_c('INSTRUMENTAL', 'Rajab'),
8 => /* I18N: http://en.wikipedia.org/wiki/Sha%27aban */ I18N::translate_c('INSTRUMENTAL', 'Sha’aban'),
9 => /* I18N: http://en.wikipedia.org/wiki/Ramadan_%28calendar_month%29 */ I18N::translate_c('INSTRUMENTAL', 'Ramadan'),
10 => /* I18N: http://en.wikipedia.org/wiki/Shawwal */ I18N::translate_c('INSTRUMENTAL', 'Shawwal'),
11 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Qi%27dah */ I18N::translate_c('INSTRUMENTAL', 'Dhu al-Qi’dah'),
12 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Hijjah */ I18N::translate_c('INSTRUMENTAL', 'Dhu al-Hijjah'),
);
}
return $translated_month_names[$month_number];
}
/** {@inheritdoc} */
static function monthNameAbbreviated($month_number, $leap_year) {
return self::monthNameNominativeCase($month_number, $leap_year);
}
}
|