1a25f0a04SGreg Roach<?php 2dd04c183SGreg Roachnamespace Fisharebest\Webtrees; 3a25f0a04SGreg Roach 4a25f0a04SGreg Roach/** 5a25f0a04SGreg Roach * webtrees: online genealogy 6a25f0a04SGreg Roach * Copyright (C) 2015 webtrees development team 7a25f0a04SGreg Roach * This program is free software: you can redistribute it and/or modify 8a25f0a04SGreg Roach * it under the terms of the GNU General Public License as published by 9a25f0a04SGreg Roach * the Free Software Foundation, either version 3 of the License, or 10a25f0a04SGreg Roach * (at your option) any later version. 11a25f0a04SGreg Roach * This program is distributed in the hope that it will be useful, 12a25f0a04SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 13a25f0a04SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14a25f0a04SGreg Roach * GNU General Public License for more details. 15a25f0a04SGreg Roach * You should have received a copy of the GNU General Public License 16a25f0a04SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 17a25f0a04SGreg Roach */ 18a25f0a04SGreg Roach 19a25f0a04SGreg Roachuse Fisharebest\ExtCalendar\ArabicCalendar; 20a25f0a04SGreg Roach 21a25f0a04SGreg Roach/** 22a25f0a04SGreg Roach * Class HijriDate - Definitions for the Hijri calendar. 23a25f0a04SGreg Roach * 24a25f0a04SGreg Roach * Note that these are "theoretical" dates. 25a25f0a04SGreg Roach * "True" dates are based on local lunar observations, and can be a +/- one day. 26a25f0a04SGreg Roach */ 27a25f0a04SGreg Roachclass HijriDate extends CalendarDate { 28a25f0a04SGreg Roach /** {@inheritdoc} */ 29a25f0a04SGreg Roach 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); 30a25f0a04SGreg Roach 31a25f0a04SGreg Roach /** {@inheritdoc} */ 32a25f0a04SGreg Roach public function __construct($date) { 33a25f0a04SGreg Roach $this->calendar = new ArabicCalendar; 34a25f0a04SGreg Roach parent::__construct($date); 35a25f0a04SGreg Roach } 36a25f0a04SGreg Roach 37a25f0a04SGreg Roach /** {@inheritdoc} */ 38a25f0a04SGreg Roach public static function monthNameNominativeCase($month_number, $leap_year) { 39a25f0a04SGreg Roach static $translated_month_names; 40a25f0a04SGreg Roach 41a25f0a04SGreg Roach if ($translated_month_names === null) { 42a25f0a04SGreg Roach $translated_month_names = array( 43a25f0a04SGreg Roach 0 => '', 44764a01d9SGreg Roach 1 => /* I18N: http://en.wikipedia.org/wiki/Muharram */ I18N::translateContext('NOMINATIVE', 'Muharram'), 45764a01d9SGreg Roach 2 => /* I18N: http://en.wikipedia.org/wiki/Safar */ I18N::translateContext('NOMINATIVE', 'Safar'), 46764a01d9SGreg Roach 3 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-awwal */ I18N::translateContext('NOMINATIVE', 'Rabi’ al-awwal'), 47764a01d9SGreg Roach 4 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-thani */ I18N::translateContext('NOMINATIVE', 'Rabi’ al-thani'), 48764a01d9SGreg Roach 5 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-awwal */ I18N::translateContext('NOMINATIVE', 'Jumada al-awwal'), 49764a01d9SGreg Roach 6 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-thani */ I18N::translateContext('NOMINATIVE', 'Jumada al-thani'), 50764a01d9SGreg Roach 7 => /* I18N: http://en.wikipedia.org/wiki/Rajab */ I18N::translateContext('NOMINATIVE', 'Rajab'), 51764a01d9SGreg Roach 8 => /* I18N: http://en.wikipedia.org/wiki/Sha%27aban */ I18N::translateContext('NOMINATIVE', 'Sha’aban'), 52764a01d9SGreg Roach 9 => /* I18N: http://en.wikipedia.org/wiki/Ramadan_%28calendar_month%29 */ I18N::translateContext('NOMINATIVE', 'Ramadan'), 53764a01d9SGreg Roach 10 => /* I18N: http://en.wikipedia.org/wiki/Shawwal */ I18N::translateContext('NOMINATIVE', 'Shawwal'), 54764a01d9SGreg Roach 11 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Qi%27dah */ I18N::translateContext('NOMINATIVE', 'Dhu al-Qi’dah'), 55764a01d9SGreg Roach 12 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Hijjah */ I18N::translateContext('NOMINATIVE', 'Dhu al-Hijjah'), 56a25f0a04SGreg Roach ); 57a25f0a04SGreg Roach } 58a25f0a04SGreg Roach 59a25f0a04SGreg Roach return $translated_month_names[$month_number]; 60a25f0a04SGreg Roach } 61a25f0a04SGreg Roach 62a25f0a04SGreg Roach /** {@inheritdoc} */ 63*17920f94SGreg Roach protected function monthNameGenitiveCase($month_number, $leap_year) { 64a25f0a04SGreg Roach static $translated_month_names; 65a25f0a04SGreg Roach 66a25f0a04SGreg Roach if ($translated_month_names === null) { 67a25f0a04SGreg Roach $translated_month_names = array( 68a25f0a04SGreg Roach 0 => '', 69764a01d9SGreg Roach 1 => /* I18N: http://en.wikipedia.org/wiki/Muharram */ I18N::translateContext('GENITIVE', 'Muharram'), 70764a01d9SGreg Roach 2 => /* I18N: http://en.wikipedia.org/wiki/Safar */ I18N::translateContext('GENITIVE', 'Safar'), 71764a01d9SGreg Roach 3 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-awwal */ I18N::translateContext('GENITIVE', 'Rabi’ al-awwal'), 72764a01d9SGreg Roach 4 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-thani */ I18N::translateContext('GENITIVE', 'Rabi’ al-thani'), 73764a01d9SGreg Roach 5 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-awwal */ I18N::translateContext('GENITIVE', 'Jumada al-awwal'), 74764a01d9SGreg Roach 6 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-thani */ I18N::translateContext('GENITIVE', 'Jumada al-thani'), 75764a01d9SGreg Roach 7 => /* I18N: http://en.wikipedia.org/wiki/Rajab */ I18N::translateContext('GENITIVE', 'Rajab'), 76764a01d9SGreg Roach 8 => /* I18N: http://en.wikipedia.org/wiki/Sha%27aban */ I18N::translateContext('GENITIVE', 'Sha’aban'), 77764a01d9SGreg Roach 9 => /* I18N: http://en.wikipedia.org/wiki/Ramadan_%28calendar_month%29 */ I18N::translateContext('GENITIVE', 'Ramadan'), 78764a01d9SGreg Roach 10 => /* I18N: http://en.wikipedia.org/wiki/Shawwal */ I18N::translateContext('GENITIVE', 'Shawwal'), 79764a01d9SGreg Roach 11 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Qi%27dah */ I18N::translateContext('GENITIVE', 'Dhu al-Qi’dah'), 80764a01d9SGreg Roach 12 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Hijjah */ I18N::translateContext('GENITIVE', 'Dhu al-Hijjah'), 81a25f0a04SGreg Roach ); 82a25f0a04SGreg Roach } 83a25f0a04SGreg Roach 84a25f0a04SGreg Roach return $translated_month_names[$month_number]; 85a25f0a04SGreg Roach } 86a25f0a04SGreg Roach 87a25f0a04SGreg Roach /** {@inheritdoc} */ 88*17920f94SGreg Roach protected function monthNameLocativeCase($month_number, $leap_year) { 89a25f0a04SGreg Roach static $translated_month_names; 90a25f0a04SGreg Roach 91a25f0a04SGreg Roach if ($translated_month_names === null) { 92a25f0a04SGreg Roach $translated_month_names = array( 93a25f0a04SGreg Roach 0 => '', 94764a01d9SGreg Roach 1 => /* I18N: http://en.wikipedia.org/wiki/Muharram */ I18N::translateContext('LOCATIVE', 'Muharram'), 95764a01d9SGreg Roach 2 => /* I18N: http://en.wikipedia.org/wiki/Safar */ I18N::translateContext('LOCATIVE', 'Safar'), 96764a01d9SGreg Roach 3 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-awwal */ I18N::translateContext('LOCATIVE', 'Rabi’ al-awwal'), 97764a01d9SGreg Roach 4 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-thani */ I18N::translateContext('LOCATIVE', 'Rabi’ al-thani'), 98764a01d9SGreg Roach 5 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-awwal */ I18N::translateContext('LOCATIVE', 'Jumada al-awwal'), 99764a01d9SGreg Roach 6 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-thani */ I18N::translateContext('LOCATIVE', 'Jumada al-thani'), 100764a01d9SGreg Roach 7 => /* I18N: http://en.wikipedia.org/wiki/Rajab */ I18N::translateContext('LOCATIVE', 'Rajab'), 101764a01d9SGreg Roach 8 => /* I18N: http://en.wikipedia.org/wiki/Sha%27aban */ I18N::translateContext('LOCATIVE', 'Sha’aban'), 102764a01d9SGreg Roach 9 => /* I18N: http://en.wikipedia.org/wiki/Ramadan_%28calendar_month%29 */ I18N::translateContext('LOCATIVE', 'Ramadan'), 103764a01d9SGreg Roach 10 => /* I18N: http://en.wikipedia.org/wiki/Shawwal */ I18N::translateContext('LOCATIVE', 'Shawwal'), 104764a01d9SGreg Roach 11 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Qi%27dah */ I18N::translateContext('LOCATIVE', 'Dhu al-Qi’dah'), 105764a01d9SGreg Roach 12 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Hijjah */ I18N::translateContext('LOCATIVE', 'Dhu al-Hijjah'), 106a25f0a04SGreg Roach ); 107a25f0a04SGreg Roach } 108a25f0a04SGreg Roach 109a25f0a04SGreg Roach return $translated_month_names[$month_number]; 110a25f0a04SGreg Roach } 111a25f0a04SGreg Roach 112a25f0a04SGreg Roach /** {@inheritdoc} */ 113*17920f94SGreg Roach protected function monthNameInstrumentalCase($month_number, $leap_year) { 114a25f0a04SGreg Roach static $translated_month_names; 115a25f0a04SGreg Roach 116a25f0a04SGreg Roach if ($translated_month_names === null) { 117a25f0a04SGreg Roach $translated_month_names = array( 118a25f0a04SGreg Roach 0 => '', 119764a01d9SGreg Roach 1 => /* I18N: http://en.wikipedia.org/wiki/Muharram */ I18N::translateContext('INSTRUMENTAL', 'Muharram'), 120764a01d9SGreg Roach 2 => /* I18N: http://en.wikipedia.org/wiki/Safar */ I18N::translateContext('INSTRUMENTAL', 'Safar'), 121764a01d9SGreg Roach 3 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-awwal */ I18N::translateContext('INSTRUMENTAL', 'Rabi’ al-awwal'), 122764a01d9SGreg Roach 4 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-thani */ I18N::translateContext('INSTRUMENTAL', 'Rabi’ al-thani'), 123764a01d9SGreg Roach 5 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-awwal */ I18N::translateContext('INSTRUMENTAL', 'Jumada al-awwal'), 124764a01d9SGreg Roach 6 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-thani */ I18N::translateContext('INSTRUMENTAL', 'Jumada al-thani'), 125764a01d9SGreg Roach 7 => /* I18N: http://en.wikipedia.org/wiki/Rajab */ I18N::translateContext('INSTRUMENTAL', 'Rajab'), 126764a01d9SGreg Roach 8 => /* I18N: http://en.wikipedia.org/wiki/Sha%27aban */ I18N::translateContext('INSTRUMENTAL', 'Sha’aban'), 127764a01d9SGreg Roach 9 => /* I18N: http://en.wikipedia.org/wiki/Ramadan_%28calendar_month%29 */ I18N::translateContext('INSTRUMENTAL', 'Ramadan'), 128764a01d9SGreg Roach 10 => /* I18N: http://en.wikipedia.org/wiki/Shawwal */ I18N::translateContext('INSTRUMENTAL', 'Shawwal'), 129764a01d9SGreg Roach 11 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Qi%27dah */ I18N::translateContext('INSTRUMENTAL', 'Dhu al-Qi’dah'), 130764a01d9SGreg Roach 12 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Hijjah */ I18N::translateContext('INSTRUMENTAL', 'Dhu al-Hijjah'), 131a25f0a04SGreg Roach ); 132a25f0a04SGreg Roach } 133a25f0a04SGreg Roach 134a25f0a04SGreg Roach return $translated_month_names[$month_number]; 135a25f0a04SGreg Roach } 136a25f0a04SGreg Roach 137a25f0a04SGreg Roach /** {@inheritdoc} */ 138*17920f94SGreg Roach protected function monthNameAbbreviated($month_number, $leap_year) { 139a25f0a04SGreg Roach return self::monthNameNominativeCase($month_number, $leap_year); 140a25f0a04SGreg Roach } 141a25f0a04SGreg Roach} 142