1a25f0a04SGreg Roach<?php 2*dd04c183SGreg 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\PersianCalendar; 20a25f0a04SGreg Roach 21a25f0a04SGreg Roach/** 22a25f0a04SGreg Roach * Class JalaliDate - Definitions for the Jalali calendar 23a25f0a04SGreg Roach */ 24a25f0a04SGreg Roachclass JalaliDate extends CalendarDate { 25a25f0a04SGreg Roach const CALENDAR_ESCAPE = '@#DJALALI@'; 26a25f0a04SGreg Roach const CAL_START_JD = 1948321; 27a25f0a04SGreg Roach 28a25f0a04SGreg Roach /** {@inheritdoc} */ 29a25f0a04SGreg Roach 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); 30a25f0a04SGreg Roach 31a25f0a04SGreg Roach /** {@inheritdoc} */ 32a25f0a04SGreg Roach public function __construct($date) { 33a25f0a04SGreg Roach $this->calendar = new PersianCalendar; 34a25f0a04SGreg Roach parent::__construct($date); 35a25f0a04SGreg Roach } 36a25f0a04SGreg Roach 37a25f0a04SGreg Roach /** {@inheritdoc} */ 38a25f0a04SGreg Roach public static function calendarName() { 39a25f0a04SGreg Roach return /* I18N: The Persian/Jalali calendar */ 40a25f0a04SGreg Roach I18N::translate('Jalali'); 41a25f0a04SGreg Roach } 42a25f0a04SGreg Roach 43a25f0a04SGreg Roach /** {@inheritdoc} */ 44a25f0a04SGreg Roach public static function monthNameNominativeCase($month_number, $leap_year) { 45a25f0a04SGreg Roach static $translated_month_names; 46a25f0a04SGreg Roach 47a25f0a04SGreg Roach if ($translated_month_names === null) { 48a25f0a04SGreg Roach $translated_month_names = array( 49a25f0a04SGreg Roach 0 => '', 50a25f0a04SGreg Roach 1 => /* I18N: 1st month in the Persian/Jalali calendar */ I18N::translate_c('NOMINATIVE', 'Farvardin'), 51a25f0a04SGreg Roach 2 => /* I18N: 2nd month in the Persian/Jalali calendar */ I18N::translate_c('NOMINATIVE', 'Ordibehesht'), 52a25f0a04SGreg Roach 3 => /* I18N: 3rd month in the Persian/Jalali calendar */ I18N::translate_c('NOMINATIVE', 'Khordad'), 53a25f0a04SGreg Roach 4 => /* I18N: 4th month in the Persian/Jalali calendar */ I18N::translate_c('NOMINATIVE', 'Tir'), 54a25f0a04SGreg Roach 5 => /* I18N: 5th month in the Persian/Jalali calendar */ I18N::translate_c('NOMINATIVE', 'Mordad'), 55a25f0a04SGreg Roach 6 => /* I18N: 6th month in the Persian/Jalali calendar */ I18N::translate_c('NOMINATIVE', 'Shahrivar'), 56a25f0a04SGreg Roach 7 => /* I18N: 7th month in the Persian/Jalali calendar */ I18N::translate_c('NOMINATIVE', 'Mehr'), 57a25f0a04SGreg Roach 8 => /* I18N: 8th month in the Persian/Jalali calendar */ I18N::translate_c('NOMINATIVE', 'Aban'), 58a25f0a04SGreg Roach 9 => /* I18N: 9th month in the Persian/Jalali calendar */ I18N::translate_c('NOMINATIVE', 'Azar'), 59a25f0a04SGreg Roach 10 => /* I18N: 10th month in the Persian/Jalali calendar */ I18N::translate_c('NOMINATIVE', 'Dey'), 60a25f0a04SGreg Roach 11 => /* I18N: 11th month in the Persian/Jalali calendar */ I18N::translate_c('NOMINATIVE', 'Bahman'), 61a25f0a04SGreg Roach 12 => /* I18N: 12th month in the Persian/Jalali calendar */ I18N::translate_c('NOMINATIVE', 'Esfand'), 62a25f0a04SGreg Roach ); 63a25f0a04SGreg Roach } 64a25f0a04SGreg Roach 65a25f0a04SGreg Roach return $translated_month_names[$month_number]; 66a25f0a04SGreg Roach } 67a25f0a04SGreg Roach 68a25f0a04SGreg Roach /** {@inheritdoc} */ 69a25f0a04SGreg Roach static function monthNameGenitiveCase($month_number, $leap_year) { 70a25f0a04SGreg Roach static $translated_month_names; 71a25f0a04SGreg Roach 72a25f0a04SGreg Roach if ($translated_month_names === null) { 73a25f0a04SGreg Roach $translated_month_names = array( 74a25f0a04SGreg Roach 0 => '', 75a25f0a04SGreg Roach 1 => /* I18N: 1st month in the Persian/Jalali calendar */ I18N::translate_c('GENITIVE', 'Farvardin'), 76a25f0a04SGreg Roach 2 => /* I18N: 2nd month in the Persian/Jalali calendar */ I18N::translate_c('GENITIVE', 'Ordibehesht'), 77a25f0a04SGreg Roach 3 => /* I18N: 3rd month in the Persian/Jalali calendar */ I18N::translate_c('GENITIVE', 'Khordad'), 78a25f0a04SGreg Roach 4 => /* I18N: 4th month in the Persian/Jalali calendar */ I18N::translate_c('GENITIVE', 'Tir'), 79a25f0a04SGreg Roach 5 => /* I18N: 5th month in the Persian/Jalali calendar */ I18N::translate_c('GENITIVE', 'Mordad'), 80a25f0a04SGreg Roach 6 => /* I18N: 6th month in the Persian/Jalali calendar */ I18N::translate_c('GENITIVE', 'Shahrivar'), 81a25f0a04SGreg Roach 7 => /* I18N: 7th month in the Persian/Jalali calendar */ I18N::translate_c('GENITIVE', 'Mehr'), 82a25f0a04SGreg Roach 8 => /* I18N: 8th month in the Persian/Jalali calendar */ I18N::translate_c('GENITIVE', 'Aban'), 83a25f0a04SGreg Roach 9 => /* I18N: 9th month in the Persian/Jalali calendar */ I18N::translate_c('GENITIVE', 'Azar'), 84a25f0a04SGreg Roach 10 => /* I18N: 10th month in the Persian/Jalali calendar */ I18N::translate_c('GENITIVE', 'Dey'), 85a25f0a04SGreg Roach 11 => /* I18N: 11th month in the Persian/Jalali calendar */ I18N::translate_c('GENITIVE', 'Bahman'), 86a25f0a04SGreg Roach 12 => /* I18N: 12th month in the Persian/Jalali calendar */ I18N::translate_c('GENITIVE', 'Esfand'), 87a25f0a04SGreg Roach ); 88a25f0a04SGreg Roach } 89a25f0a04SGreg Roach 90a25f0a04SGreg Roach return $translated_month_names[$month_number]; 91a25f0a04SGreg Roach } 92a25f0a04SGreg Roach 93a25f0a04SGreg Roach /** {@inheritdoc} */ 94a25f0a04SGreg Roach static function monthNameLocativeCase($month_number, $leap_year) { 95a25f0a04SGreg Roach static $translated_month_names; 96a25f0a04SGreg Roach 97a25f0a04SGreg Roach if ($translated_month_names === null) { 98a25f0a04SGreg Roach $translated_month_names = array( 99a25f0a04SGreg Roach 0 => '', 100a25f0a04SGreg Roach 1 => /* I18N: 1st month in the Persian/Jalali calendar */ I18N::translate_c('LOCATIVE', 'Farvardin'), 101a25f0a04SGreg Roach 2 => /* I18N: 2nd month in the Persian/Jalali calendar */ I18N::translate_c('LOCATIVE', 'Ordibehesht'), 102a25f0a04SGreg Roach 3 => /* I18N: 3rd month in the Persian/Jalali calendar */ I18N::translate_c('LOCATIVE', 'Khordad'), 103a25f0a04SGreg Roach 4 => /* I18N: 4th month in the Persian/Jalali calendar */ I18N::translate_c('LOCATIVE', 'Tir'), 104a25f0a04SGreg Roach 5 => /* I18N: 5th month in the Persian/Jalali calendar */ I18N::translate_c('LOCATIVE', 'Mordad'), 105a25f0a04SGreg Roach 6 => /* I18N: 6th month in the Persian/Jalali calendar */ I18N::translate_c('LOCATIVE', 'Shahrivar'), 106a25f0a04SGreg Roach 7 => /* I18N: 7th month in the Persian/Jalali calendar */ I18N::translate_c('LOCATIVE', 'Mehr'), 107a25f0a04SGreg Roach 8 => /* I18N: 8th month in the Persian/Jalali calendar */ I18N::translate_c('LOCATIVE', 'Aban'), 108a25f0a04SGreg Roach 9 => /* I18N: 9th month in the Persian/Jalali calendar */ I18N::translate_c('LOCATIVE', 'Azar'), 109a25f0a04SGreg Roach 10 => /* I18N: 10th month in the Persian/Jalali calendar */ I18N::translate_c('LOCATIVE', 'Dey'), 110a25f0a04SGreg Roach 11 => /* I18N: 11th month in the Persian/Jalali calendar */ I18N::translate_c('LOCATIVE', 'Bahman'), 111a25f0a04SGreg Roach 12 => /* I18N: 12th month in the Persian/Jalali calendar */ I18N::translate_c('LOCATIVE', 'Esfand'), 112a25f0a04SGreg Roach ); 113a25f0a04SGreg Roach } 114a25f0a04SGreg Roach 115a25f0a04SGreg Roach return $translated_month_names[$month_number]; 116a25f0a04SGreg Roach } 117a25f0a04SGreg Roach 118a25f0a04SGreg Roach /** {@inheritdoc} */ 119a25f0a04SGreg Roach static function monthNameInstrumentalCase($month_number, $leap_year) { 120a25f0a04SGreg Roach static $translated_month_names; 121a25f0a04SGreg Roach 122a25f0a04SGreg Roach if ($translated_month_names === null) { 123a25f0a04SGreg Roach $translated_month_names = array( 124a25f0a04SGreg Roach 0 => '', 125a25f0a04SGreg Roach 1 => /* I18N: 1st month in the Persian/Jalali calendar */ I18N::translate_c('INSTRUMENTAL', 'Farvardin'), 126a25f0a04SGreg Roach 2 => /* I18N: 2nd month in the Persian/Jalali calendar */ I18N::translate_c('INSTRUMENTAL', 'Ordibehesht'), 127a25f0a04SGreg Roach 3 => /* I18N: 3rd month in the Persian/Jalali calendar */ I18N::translate_c('INSTRUMENTAL', 'Khordad'), 128a25f0a04SGreg Roach 4 => /* I18N: 4th month in the Persian/Jalali calendar */ I18N::translate_c('INSTRUMENTAL', 'Tir'), 129a25f0a04SGreg Roach 5 => /* I18N: 5th month in the Persian/Jalali calendar */ I18N::translate_c('INSTRUMENTAL', 'Mordad'), 130a25f0a04SGreg Roach 6 => /* I18N: 6th month in the Persian/Jalali calendar */ I18N::translate_c('INSTRUMENTAL', 'Shahrivar'), 131a25f0a04SGreg Roach 7 => /* I18N: 7th month in the Persian/Jalali calendar */ I18N::translate_c('INSTRUMENTAL', 'Mehr'), 132a25f0a04SGreg Roach 8 => /* I18N: 8th month in the Persian/Jalali calendar */ I18N::translate_c('INSTRUMENTAL', 'Aban'), 133a25f0a04SGreg Roach 9 => /* I18N: 9th month in the Persian/Jalali calendar */ I18N::translate_c('INSTRUMENTAL', 'Azar'), 134a25f0a04SGreg Roach 10 => /* I18N: 10th month in the Persian/Jalali calendar */ I18N::translate_c('INSTRUMENTAL', 'Dey'), 135a25f0a04SGreg Roach 11 => /* I18N: 11th month in the Persian/Jalali calendar */ I18N::translate_c('INSTRUMENTAL', 'Bahman'), 136a25f0a04SGreg Roach 12 => /* I18N: 12th month in the Persian/Jalali calendar */ I18N::translate_c('INSTRUMENTAL', 'Esfand'), 137a25f0a04SGreg Roach ); 138a25f0a04SGreg Roach } 139a25f0a04SGreg Roach 140a25f0a04SGreg Roach return $translated_month_names[$month_number]; 141a25f0a04SGreg Roach } 142a25f0a04SGreg Roach 143a25f0a04SGreg Roach /** {@inheritdoc} */ 144a25f0a04SGreg Roach static function monthNameAbbreviated($month_number, $leap_year) { 145a25f0a04SGreg Roach static $translated_month_names; 146a25f0a04SGreg Roach 147a25f0a04SGreg Roach if ($translated_month_names === null) { 148a25f0a04SGreg Roach $translated_month_names = array( 149a25f0a04SGreg Roach 0 => '', 150a25f0a04SGreg Roach 1 => I18N::translate_c('Abbreviation for Persian month: Farvardin', 'Far'), 151a25f0a04SGreg Roach 2 => I18N::translate_c('Abbreviation for Persian month: Ordibehesht', 'Ord'), 152a25f0a04SGreg Roach 3 => I18N::translate_c('Abbreviation for Persian month: Khordad', 'Khor'), 153a25f0a04SGreg Roach 4 => I18N::translate_c('Abbreviation for Persian month: Tir', 'Tir'), 154a25f0a04SGreg Roach 5 => I18N::translate_c('Abbreviation for Persian month: Mordad', 'Mor'), 155a25f0a04SGreg Roach 6 => I18N::translate_c('Abbreviation for Persian month: Shahrivar', 'Shah'), 156a25f0a04SGreg Roach 7 => I18N::translate_c('Abbreviation for Persian month: Mehr', 'Mehr'), 157a25f0a04SGreg Roach 8 => I18N::translate_c('Abbreviation for Persian month: Aban', 'Aban'), 158a25f0a04SGreg Roach 9 => I18N::translate_c('Abbreviation for Persian month: Azar', 'Azar'), 159a25f0a04SGreg Roach 10 => I18N::translate_c('Abbreviation for Persian month: Dey', 'Dey'), 160a25f0a04SGreg Roach 11 => I18N::translate_c('Abbreviation for Persian month: Bahman', 'Bah'), 161a25f0a04SGreg Roach 12 => I18N::translate_c('Abbreviation for Persian month: Esfand', 'Esf'), 162a25f0a04SGreg Roach ); 163a25f0a04SGreg Roach } 164a25f0a04SGreg Roach 165a25f0a04SGreg Roach return $translated_month_names[$month_number]; 166a25f0a04SGreg Roach } 167a25f0a04SGreg Roach} 168