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
|
<?php
namespace Fisharebest\Webtrees\Date;
/**
* 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\PersianCalendar;
use Fisharebest\Webtrees\I18N;
/**
* Class JalaliDate - Definitions for the Jalali calendar
*/
class JalaliDate extends CalendarDate {
/** {@inheritdoc} */
public static $MONTH_ABBREV = array('' => 0, 'FARVA' => 1, 'ORDIB' => 2, 'KHORD' => 3, 'TIR' => 4, 'MORDA' => 5, 'SHAHR' => 6, 'MEHR' => 7, 'ABAN' => 8, 'AZAR' => 9, 'DEY' => 10, 'BAHMA' => 11, 'ESFAN' => 12);
/** {@inheritdoc} */
public function __construct($date) {
$this->calendar = new PersianCalendar;
parent::__construct($date);
}
/** {@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: 1st month in the Persian/Jalali calendar */ I18N::translateContext('NOMINATIVE', 'Farvardin'),
2 => /* I18N: 2nd month in the Persian/Jalali calendar */ I18N::translateContext('NOMINATIVE', 'Ordibehesht'),
3 => /* I18N: 3rd month in the Persian/Jalali calendar */ I18N::translateContext('NOMINATIVE', 'Khordad'),
4 => /* I18N: 4th month in the Persian/Jalali calendar */ I18N::translateContext('NOMINATIVE', 'Tir'),
5 => /* I18N: 5th month in the Persian/Jalali calendar */ I18N::translateContext('NOMINATIVE', 'Mordad'),
6 => /* I18N: 6th month in the Persian/Jalali calendar */ I18N::translateContext('NOMINATIVE', 'Shahrivar'),
7 => /* I18N: 7th month in the Persian/Jalali calendar */ I18N::translateContext('NOMINATIVE', 'Mehr'),
8 => /* I18N: 8th month in the Persian/Jalali calendar */ I18N::translateContext('NOMINATIVE', 'Aban'),
9 => /* I18N: 9th month in the Persian/Jalali calendar */ I18N::translateContext('NOMINATIVE', 'Azar'),
10 => /* I18N: 10th month in the Persian/Jalali calendar */ I18N::translateContext('NOMINATIVE', 'Dey'),
11 => /* I18N: 11th month in the Persian/Jalali calendar */ I18N::translateContext('NOMINATIVE', 'Bahman'),
12 => /* I18N: 12th month in the Persian/Jalali calendar */ I18N::translateContext('NOMINATIVE', 'Esfand'),
);
}
return $translated_month_names[$month_number];
}
/** {@inheritdoc} */
protected function monthNameGenitiveCase($month_number, $leap_year) {
static $translated_month_names;
if ($translated_month_names === null) {
$translated_month_names = array(
0 => '',
1 => /* I18N: 1st month in the Persian/Jalali calendar */ I18N::translateContext('GENITIVE', 'Farvardin'),
2 => /* I18N: 2nd month in the Persian/Jalali calendar */ I18N::translateContext('GENITIVE', 'Ordibehesht'),
3 => /* I18N: 3rd month in the Persian/Jalali calendar */ I18N::translateContext('GENITIVE', 'Khordad'),
4 => /* I18N: 4th month in the Persian/Jalali calendar */ I18N::translateContext('GENITIVE', 'Tir'),
5 => /* I18N: 5th month in the Persian/Jalali calendar */ I18N::translateContext('GENITIVE', 'Mordad'),
6 => /* I18N: 6th month in the Persian/Jalali calendar */ I18N::translateContext('GENITIVE', 'Shahrivar'),
7 => /* I18N: 7th month in the Persian/Jalali calendar */ I18N::translateContext('GENITIVE', 'Mehr'),
8 => /* I18N: 8th month in the Persian/Jalali calendar */ I18N::translateContext('GENITIVE', 'Aban'),
9 => /* I18N: 9th month in the Persian/Jalali calendar */ I18N::translateContext('GENITIVE', 'Azar'),
10 => /* I18N: 10th month in the Persian/Jalali calendar */ I18N::translateContext('GENITIVE', 'Dey'),
11 => /* I18N: 11th month in the Persian/Jalali calendar */ I18N::translateContext('GENITIVE', 'Bahman'),
12 => /* I18N: 12th month in the Persian/Jalali calendar */ I18N::translateContext('GENITIVE', 'Esfand'),
);
}
return $translated_month_names[$month_number];
}
/** {@inheritdoc} */
protected function monthNameLocativeCase($month_number, $leap_year) {
static $translated_month_names;
if ($translated_month_names === null) {
$translated_month_names = array(
0 => '',
1 => /* I18N: 1st month in the Persian/Jalali calendar */ I18N::translateContext('LOCATIVE', 'Farvardin'),
2 => /* I18N: 2nd month in the Persian/Jalali calendar */ I18N::translateContext('LOCATIVE', 'Ordibehesht'),
3 => /* I18N: 3rd month in the Persian/Jalali calendar */ I18N::translateContext('LOCATIVE', 'Khordad'),
4 => /* I18N: 4th month in the Persian/Jalali calendar */ I18N::translateContext('LOCATIVE', 'Tir'),
5 => /* I18N: 5th month in the Persian/Jalali calendar */ I18N::translateContext('LOCATIVE', 'Mordad'),
6 => /* I18N: 6th month in the Persian/Jalali calendar */ I18N::translateContext('LOCATIVE', 'Shahrivar'),
7 => /* I18N: 7th month in the Persian/Jalali calendar */ I18N::translateContext('LOCATIVE', 'Mehr'),
8 => /* I18N: 8th month in the Persian/Jalali calendar */ I18N::translateContext('LOCATIVE', 'Aban'),
9 => /* I18N: 9th month in the Persian/Jalali calendar */ I18N::translateContext('LOCATIVE', 'Azar'),
10 => /* I18N: 10th month in the Persian/Jalali calendar */ I18N::translateContext('LOCATIVE', 'Dey'),
11 => /* I18N: 11th month in the Persian/Jalali calendar */ I18N::translateContext('LOCATIVE', 'Bahman'),
12 => /* I18N: 12th month in the Persian/Jalali calendar */ I18N::translateContext('LOCATIVE', 'Esfand'),
);
}
return $translated_month_names[$month_number];
}
/** {@inheritdoc} */
protected function monthNameInstrumentalCase($month_number, $leap_year) {
static $translated_month_names;
if ($translated_month_names === null) {
$translated_month_names = array(
0 => '',
1 => /* I18N: 1st month in the Persian/Jalali calendar */ I18N::translateContext('INSTRUMENTAL', 'Farvardin'),
2 => /* I18N: 2nd month in the Persian/Jalali calendar */ I18N::translateContext('INSTRUMENTAL', 'Ordibehesht'),
3 => /* I18N: 3rd month in the Persian/Jalali calendar */ I18N::translateContext('INSTRUMENTAL', 'Khordad'),
4 => /* I18N: 4th month in the Persian/Jalali calendar */ I18N::translateContext('INSTRUMENTAL', 'Tir'),
5 => /* I18N: 5th month in the Persian/Jalali calendar */ I18N::translateContext('INSTRUMENTAL', 'Mordad'),
6 => /* I18N: 6th month in the Persian/Jalali calendar */ I18N::translateContext('INSTRUMENTAL', 'Shahrivar'),
7 => /* I18N: 7th month in the Persian/Jalali calendar */ I18N::translateContext('INSTRUMENTAL', 'Mehr'),
8 => /* I18N: 8th month in the Persian/Jalali calendar */ I18N::translateContext('INSTRUMENTAL', 'Aban'),
9 => /* I18N: 9th month in the Persian/Jalali calendar */ I18N::translateContext('INSTRUMENTAL', 'Azar'),
10 => /* I18N: 10th month in the Persian/Jalali calendar */ I18N::translateContext('INSTRUMENTAL', 'Dey'),
11 => /* I18N: 11th month in the Persian/Jalali calendar */ I18N::translateContext('INSTRUMENTAL', 'Bahman'),
12 => /* I18N: 12th month in the Persian/Jalali calendar */ I18N::translateContext('INSTRUMENTAL', 'Esfand'),
);
}
return $translated_month_names[$month_number];
}
/** {@inheritdoc} */
protected function monthNameAbbreviated($month_number, $leap_year) {
static $translated_month_names;
if ($translated_month_names === null) {
$translated_month_names = array(
0 => '',
1 => I18N::translateContext('Abbreviation for Persian month: Farvardin', 'Far'),
2 => I18N::translateContext('Abbreviation for Persian month: Ordibehesht', 'Ord'),
3 => I18N::translateContext('Abbreviation for Persian month: Khordad', 'Khor'),
4 => I18N::translateContext('Abbreviation for Persian month: Tir', 'Tir'),
5 => I18N::translateContext('Abbreviation for Persian month: Mordad', 'Mor'),
6 => I18N::translateContext('Abbreviation for Persian month: Shahrivar', 'Shah'),
7 => I18N::translateContext('Abbreviation for Persian month: Mehr', 'Mehr'),
8 => I18N::translateContext('Abbreviation for Persian month: Aban', 'Aban'),
9 => I18N::translateContext('Abbreviation for Persian month: Azar', 'Azar'),
10 => I18N::translateContext('Abbreviation for Persian month: Dey', 'Dey'),
11 => I18N::translateContext('Abbreviation for Persian month: Bahman', 'Bah'),
12 => I18N::translateContext('Abbreviation for Persian month: Esfand', 'Esf'),
);
}
return $translated_month_names[$month_number];
}
}
|