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 const CALENDAR_ESCAPE = '@#DHIJRI@'; 29a25f0a04SGreg Roach const CAL_START_JD = 1948440; // @#DHIJRI@ 1 MUHAR 0001 = @#JULIAN@ 16 JUL 0622 30a25f0a04SGreg Roach 31a25f0a04SGreg Roach /** {@inheritdoc} */ 32a25f0a04SGreg 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); 33a25f0a04SGreg Roach 34a25f0a04SGreg Roach /** {@inheritdoc} */ 35a25f0a04SGreg Roach public function __construct($date) { 36a25f0a04SGreg Roach $this->calendar = new ArabicCalendar; 37a25f0a04SGreg Roach parent::__construct($date); 38a25f0a04SGreg Roach } 39a25f0a04SGreg Roach 40a25f0a04SGreg Roach /** {@inheritdoc} */ 41a25f0a04SGreg Roach public static function calendarName() { 42a25f0a04SGreg Roach return /* I18N: The Arabic/Hijri calendar */ 43a25f0a04SGreg Roach I18N::translate('Hijri'); 44a25f0a04SGreg Roach } 45a25f0a04SGreg Roach 46a25f0a04SGreg Roach /** {@inheritdoc} */ 47a25f0a04SGreg Roach public static function monthNameNominativeCase($month_number, $leap_year) { 48a25f0a04SGreg Roach static $translated_month_names; 49a25f0a04SGreg Roach 50a25f0a04SGreg Roach if ($translated_month_names === null) { 51a25f0a04SGreg Roach $translated_month_names = array( 52a25f0a04SGreg Roach 0 => '', 53*764a01d9SGreg Roach 1 => /* I18N: http://en.wikipedia.org/wiki/Muharram */ I18N::translateContext('NOMINATIVE', 'Muharram'), 54*764a01d9SGreg Roach 2 => /* I18N: http://en.wikipedia.org/wiki/Safar */ I18N::translateContext('NOMINATIVE', 'Safar'), 55*764a01d9SGreg Roach 3 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-awwal */ I18N::translateContext('NOMINATIVE', 'Rabi’ al-awwal'), 56*764a01d9SGreg Roach 4 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-thani */ I18N::translateContext('NOMINATIVE', 'Rabi’ al-thani'), 57*764a01d9SGreg Roach 5 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-awwal */ I18N::translateContext('NOMINATIVE', 'Jumada al-awwal'), 58*764a01d9SGreg Roach 6 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-thani */ I18N::translateContext('NOMINATIVE', 'Jumada al-thani'), 59*764a01d9SGreg Roach 7 => /* I18N: http://en.wikipedia.org/wiki/Rajab */ I18N::translateContext('NOMINATIVE', 'Rajab'), 60*764a01d9SGreg Roach 8 => /* I18N: http://en.wikipedia.org/wiki/Sha%27aban */ I18N::translateContext('NOMINATIVE', 'Sha’aban'), 61*764a01d9SGreg Roach 9 => /* I18N: http://en.wikipedia.org/wiki/Ramadan_%28calendar_month%29 */ I18N::translateContext('NOMINATIVE', 'Ramadan'), 62*764a01d9SGreg Roach 10 => /* I18N: http://en.wikipedia.org/wiki/Shawwal */ I18N::translateContext('NOMINATIVE', 'Shawwal'), 63*764a01d9SGreg Roach 11 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Qi%27dah */ I18N::translateContext('NOMINATIVE', 'Dhu al-Qi’dah'), 64*764a01d9SGreg Roach 12 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Hijjah */ I18N::translateContext('NOMINATIVE', 'Dhu al-Hijjah'), 65a25f0a04SGreg Roach ); 66a25f0a04SGreg Roach } 67a25f0a04SGreg Roach 68a25f0a04SGreg Roach return $translated_month_names[$month_number]; 69a25f0a04SGreg Roach } 70a25f0a04SGreg Roach 71a25f0a04SGreg Roach /** {@inheritdoc} */ 72a25f0a04SGreg Roach static function monthNameGenitiveCase($month_number, $leap_year) { 73a25f0a04SGreg Roach static $translated_month_names; 74a25f0a04SGreg Roach 75a25f0a04SGreg Roach if ($translated_month_names === null) { 76a25f0a04SGreg Roach $translated_month_names = array( 77a25f0a04SGreg Roach 0 => '', 78*764a01d9SGreg Roach 1 => /* I18N: http://en.wikipedia.org/wiki/Muharram */ I18N::translateContext('GENITIVE', 'Muharram'), 79*764a01d9SGreg Roach 2 => /* I18N: http://en.wikipedia.org/wiki/Safar */ I18N::translateContext('GENITIVE', 'Safar'), 80*764a01d9SGreg Roach 3 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-awwal */ I18N::translateContext('GENITIVE', 'Rabi’ al-awwal'), 81*764a01d9SGreg Roach 4 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-thani */ I18N::translateContext('GENITIVE', 'Rabi’ al-thani'), 82*764a01d9SGreg Roach 5 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-awwal */ I18N::translateContext('GENITIVE', 'Jumada al-awwal'), 83*764a01d9SGreg Roach 6 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-thani */ I18N::translateContext('GENITIVE', 'Jumada al-thani'), 84*764a01d9SGreg Roach 7 => /* I18N: http://en.wikipedia.org/wiki/Rajab */ I18N::translateContext('GENITIVE', 'Rajab'), 85*764a01d9SGreg Roach 8 => /* I18N: http://en.wikipedia.org/wiki/Sha%27aban */ I18N::translateContext('GENITIVE', 'Sha’aban'), 86*764a01d9SGreg Roach 9 => /* I18N: http://en.wikipedia.org/wiki/Ramadan_%28calendar_month%29 */ I18N::translateContext('GENITIVE', 'Ramadan'), 87*764a01d9SGreg Roach 10 => /* I18N: http://en.wikipedia.org/wiki/Shawwal */ I18N::translateContext('GENITIVE', 'Shawwal'), 88*764a01d9SGreg Roach 11 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Qi%27dah */ I18N::translateContext('GENITIVE', 'Dhu al-Qi’dah'), 89*764a01d9SGreg Roach 12 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Hijjah */ I18N::translateContext('GENITIVE', 'Dhu al-Hijjah'), 90a25f0a04SGreg Roach ); 91a25f0a04SGreg Roach } 92a25f0a04SGreg Roach 93a25f0a04SGreg Roach return $translated_month_names[$month_number]; 94a25f0a04SGreg Roach } 95a25f0a04SGreg Roach 96a25f0a04SGreg Roach /** {@inheritdoc} */ 97a25f0a04SGreg Roach static function monthNameLocativeCase($month_number, $leap_year) { 98a25f0a04SGreg Roach static $translated_month_names; 99a25f0a04SGreg Roach 100a25f0a04SGreg Roach if ($translated_month_names === null) { 101a25f0a04SGreg Roach $translated_month_names = array( 102a25f0a04SGreg Roach 0 => '', 103*764a01d9SGreg Roach 1 => /* I18N: http://en.wikipedia.org/wiki/Muharram */ I18N::translateContext('LOCATIVE', 'Muharram'), 104*764a01d9SGreg Roach 2 => /* I18N: http://en.wikipedia.org/wiki/Safar */ I18N::translateContext('LOCATIVE', 'Safar'), 105*764a01d9SGreg Roach 3 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-awwal */ I18N::translateContext('LOCATIVE', 'Rabi’ al-awwal'), 106*764a01d9SGreg Roach 4 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-thani */ I18N::translateContext('LOCATIVE', 'Rabi’ al-thani'), 107*764a01d9SGreg Roach 5 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-awwal */ I18N::translateContext('LOCATIVE', 'Jumada al-awwal'), 108*764a01d9SGreg Roach 6 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-thani */ I18N::translateContext('LOCATIVE', 'Jumada al-thani'), 109*764a01d9SGreg Roach 7 => /* I18N: http://en.wikipedia.org/wiki/Rajab */ I18N::translateContext('LOCATIVE', 'Rajab'), 110*764a01d9SGreg Roach 8 => /* I18N: http://en.wikipedia.org/wiki/Sha%27aban */ I18N::translateContext('LOCATIVE', 'Sha’aban'), 111*764a01d9SGreg Roach 9 => /* I18N: http://en.wikipedia.org/wiki/Ramadan_%28calendar_month%29 */ I18N::translateContext('LOCATIVE', 'Ramadan'), 112*764a01d9SGreg Roach 10 => /* I18N: http://en.wikipedia.org/wiki/Shawwal */ I18N::translateContext('LOCATIVE', 'Shawwal'), 113*764a01d9SGreg Roach 11 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Qi%27dah */ I18N::translateContext('LOCATIVE', 'Dhu al-Qi’dah'), 114*764a01d9SGreg Roach 12 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Hijjah */ I18N::translateContext('LOCATIVE', 'Dhu al-Hijjah'), 115a25f0a04SGreg Roach ); 116a25f0a04SGreg Roach } 117a25f0a04SGreg Roach 118a25f0a04SGreg Roach return $translated_month_names[$month_number]; 119a25f0a04SGreg Roach } 120a25f0a04SGreg Roach 121a25f0a04SGreg Roach /** {@inheritdoc} */ 122a25f0a04SGreg Roach static function monthNameInstrumentalCase($month_number, $leap_year) { 123a25f0a04SGreg Roach static $translated_month_names; 124a25f0a04SGreg Roach 125a25f0a04SGreg Roach if ($translated_month_names === null) { 126a25f0a04SGreg Roach $translated_month_names = array( 127a25f0a04SGreg Roach 0 => '', 128*764a01d9SGreg Roach 1 => /* I18N: http://en.wikipedia.org/wiki/Muharram */ I18N::translateContext('INSTRUMENTAL', 'Muharram'), 129*764a01d9SGreg Roach 2 => /* I18N: http://en.wikipedia.org/wiki/Safar */ I18N::translateContext('INSTRUMENTAL', 'Safar'), 130*764a01d9SGreg Roach 3 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-awwal */ I18N::translateContext('INSTRUMENTAL', 'Rabi’ al-awwal'), 131*764a01d9SGreg Roach 4 => /* I18N: http://en.wikipedia.org/wiki/Rabi%27_al-thani */ I18N::translateContext('INSTRUMENTAL', 'Rabi’ al-thani'), 132*764a01d9SGreg Roach 5 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-awwal */ I18N::translateContext('INSTRUMENTAL', 'Jumada al-awwal'), 133*764a01d9SGreg Roach 6 => /* I18N: http://en.wikipedia.org/wiki/Jumada_al-thani */ I18N::translateContext('INSTRUMENTAL', 'Jumada al-thani'), 134*764a01d9SGreg Roach 7 => /* I18N: http://en.wikipedia.org/wiki/Rajab */ I18N::translateContext('INSTRUMENTAL', 'Rajab'), 135*764a01d9SGreg Roach 8 => /* I18N: http://en.wikipedia.org/wiki/Sha%27aban */ I18N::translateContext('INSTRUMENTAL', 'Sha’aban'), 136*764a01d9SGreg Roach 9 => /* I18N: http://en.wikipedia.org/wiki/Ramadan_%28calendar_month%29 */ I18N::translateContext('INSTRUMENTAL', 'Ramadan'), 137*764a01d9SGreg Roach 10 => /* I18N: http://en.wikipedia.org/wiki/Shawwal */ I18N::translateContext('INSTRUMENTAL', 'Shawwal'), 138*764a01d9SGreg Roach 11 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Qi%27dah */ I18N::translateContext('INSTRUMENTAL', 'Dhu al-Qi’dah'), 139*764a01d9SGreg Roach 12 => /* I18N: http://en.wikipedia.org/wiki/Dhu_al-Hijjah */ I18N::translateContext('INSTRUMENTAL', 'Dhu al-Hijjah'), 140a25f0a04SGreg Roach ); 141a25f0a04SGreg Roach } 142a25f0a04SGreg Roach 143a25f0a04SGreg Roach return $translated_month_names[$month_number]; 144a25f0a04SGreg Roach } 145a25f0a04SGreg Roach 146a25f0a04SGreg Roach /** {@inheritdoc} */ 147a25f0a04SGreg Roach static function monthNameAbbreviated($month_number, $leap_year) { 148a25f0a04SGreg Roach return self::monthNameNominativeCase($month_number, $leap_year); 149a25f0a04SGreg Roach } 150a25f0a04SGreg Roach} 151