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\FrenchCalendar; 20a25f0a04SGreg Roach 21a25f0a04SGreg Roach/** 22a25f0a04SGreg Roach * Class FrenchDate - Definitions for the French Republican calendar 23a25f0a04SGreg Roach */ 24a25f0a04SGreg Roachclass FrenchDate extends CalendarDate { 25a25f0a04SGreg Roach const CALENDAR_ESCAPE = '@#DFRENCH R@'; 26a25f0a04SGreg Roach const MONTHS_IN_YEAR = 13; 27a25f0a04SGreg Roach const CAL_START_JD = 2375840; // 22 SEP 1792 = 01 VEND 0001 28a25f0a04SGreg Roach const CAL_END_JD = 2380687; // 31 DEC 1805 = 10 NIVO 0014 29a25f0a04SGreg Roach const DAYS_IN_WEEK = 10; // A metric week of 10 unimaginatively named days. 30a25f0a04SGreg Roach 31a25f0a04SGreg Roach /** {@inheritdoc} */ 32a25f0a04SGreg Roach public static $MONTH_ABBREV = array('' => 0, 'VEND' => 1, 'BRUM' => 2, 'FRIM' => 3, 'NIVO' => 4, 'PLUV' => 5, 'VENT' => 6, 'GERM' => 7, 'FLOR' => 8, 'PRAI' => 9, 'MESS' => 10, 'THER' => 11, 'FRUC' => 12, 'COMP' => 13); 33a25f0a04SGreg Roach 34a25f0a04SGreg Roach /** {@inheritdoc} */ 35a25f0a04SGreg Roach public function __construct($date) { 36a25f0a04SGreg Roach $this->calendar = new FrenchCalendar; 37a25f0a04SGreg Roach parent::__construct($date); 38a25f0a04SGreg Roach } 39a25f0a04SGreg Roach 40a25f0a04SGreg Roach /** {@inheritdoc} */ 41a25f0a04SGreg Roach public static function calendarName() { 42a25f0a04SGreg Roach return /* I18N: The French calendar */ I18N::translate('French'); 43a25f0a04SGreg Roach } 44a25f0a04SGreg Roach 45a25f0a04SGreg Roach /** {@inheritdoc} */ 46a25f0a04SGreg Roach public static function monthNameNominativeCase($month_number, $leap_year) { 47a25f0a04SGreg Roach static $translated_month_names; 48a25f0a04SGreg Roach 49a25f0a04SGreg Roach if ($translated_month_names === null) { 50a25f0a04SGreg Roach $translated_month_names = array( 51a25f0a04SGreg Roach 0 => '', 52*764a01d9SGreg Roach 1 => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Vendémiaire'), 53*764a01d9SGreg Roach 2 => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Brumaire'), 54*764a01d9SGreg Roach 3 => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Frimaire'), 55*764a01d9SGreg Roach 4 => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Nivôse'), 56*764a01d9SGreg Roach 5 => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Pluviôse'), 57*764a01d9SGreg Roach 6 => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Ventôse'), 58*764a01d9SGreg Roach 7 => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Germinal'), 59*764a01d9SGreg Roach 8 => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Floréal'), 60*764a01d9SGreg Roach 9 => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Prairial'), 61*764a01d9SGreg Roach 10 => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Messidor'), 62*764a01d9SGreg Roach 11 => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Thermidor'), 63*764a01d9SGreg Roach 12 => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Fructidor'), 64*764a01d9SGreg Roach 13 => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'jours complémentaires'), 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: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Vendémiaire'), 79*764a01d9SGreg Roach 2 => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Brumaire'), 80*764a01d9SGreg Roach 3 => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Frimaire'), 81*764a01d9SGreg Roach 4 => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Nivôse'), 82*764a01d9SGreg Roach 5 => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Pluviôse'), 83*764a01d9SGreg Roach 6 => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Ventôse'), 84*764a01d9SGreg Roach 7 => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Germinal'), 85*764a01d9SGreg Roach 8 => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Floréal'), 86*764a01d9SGreg Roach 9 => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Prairial'), 87*764a01d9SGreg Roach 10 => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Messidor'), 88*764a01d9SGreg Roach 11 => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Thermidor'), 89*764a01d9SGreg Roach 12 => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Fructidor'), 90*764a01d9SGreg Roach 13 => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'jours complémentaires'), 91a25f0a04SGreg Roach ); 92a25f0a04SGreg Roach } 93a25f0a04SGreg Roach 94a25f0a04SGreg Roach return $translated_month_names[$month_number]; 95a25f0a04SGreg Roach } 96a25f0a04SGreg Roach 97a25f0a04SGreg Roach /** {@inheritdoc} */ 98a25f0a04SGreg Roach static function monthNameLocativeCase($month_number, $leap_year) { 99a25f0a04SGreg Roach static $translated_month_names; 100a25f0a04SGreg Roach 101a25f0a04SGreg Roach if ($translated_month_names === null) { 102a25f0a04SGreg Roach $translated_month_names = array( 103a25f0a04SGreg Roach 0 => '', 104*764a01d9SGreg Roach 1 => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Vendémiaire'), 105*764a01d9SGreg Roach 2 => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Brumaire'), 106*764a01d9SGreg Roach 3 => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Frimaire'), 107*764a01d9SGreg Roach 4 => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Nivôse'), 108*764a01d9SGreg Roach 5 => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Pluviôse'), 109*764a01d9SGreg Roach 6 => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Ventôse'), 110*764a01d9SGreg Roach 7 => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Germinal'), 111*764a01d9SGreg Roach 8 => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Floréal'), 112*764a01d9SGreg Roach 9 => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Prairial'), 113*764a01d9SGreg Roach 10 => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Messidor'), 114*764a01d9SGreg Roach 11 => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Thermidor'), 115*764a01d9SGreg Roach 12 => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Fructidor'), 116*764a01d9SGreg Roach 13 => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'jours complémentaires'), 117a25f0a04SGreg Roach ); 118a25f0a04SGreg Roach } 119a25f0a04SGreg Roach 120a25f0a04SGreg Roach return $translated_month_names[$month_number]; 121a25f0a04SGreg Roach } 122a25f0a04SGreg Roach 123a25f0a04SGreg Roach /** {@inheritdoc} */ 124a25f0a04SGreg Roach static function monthNameInstrumentalCase($month_number, $leap_year) { 125a25f0a04SGreg Roach static $translated_month_names; 126a25f0a04SGreg Roach 127a25f0a04SGreg Roach if ($translated_month_names === null) { 128a25f0a04SGreg Roach $translated_month_names = array( 129a25f0a04SGreg Roach 0 => '', 130*764a01d9SGreg Roach 1 => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Vendémiaire'), 131*764a01d9SGreg Roach 2 => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Brumaire'), 132*764a01d9SGreg Roach 3 => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Frimaire'), 133*764a01d9SGreg Roach 4 => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Nivôse'), 134*764a01d9SGreg Roach 5 => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Pluviôse'), 135*764a01d9SGreg Roach 6 => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Ventôse'), 136*764a01d9SGreg Roach 7 => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Germinal'), 137*764a01d9SGreg Roach 8 => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Floréal'), 138*764a01d9SGreg Roach 9 => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Prairial'), 139*764a01d9SGreg Roach 10 => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Messidor'), 140*764a01d9SGreg Roach 11 => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Thermidor'), 141*764a01d9SGreg Roach 12 => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Fructidor'), 142*764a01d9SGreg Roach 13 => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'jours complémentaires'), 143a25f0a04SGreg Roach ); 144a25f0a04SGreg Roach } 145a25f0a04SGreg Roach 146a25f0a04SGreg Roach return $translated_month_names[$month_number]; 147a25f0a04SGreg Roach } 148a25f0a04SGreg Roach 149a25f0a04SGreg Roach /** {@inheritdoc} */ 150a25f0a04SGreg Roach protected static function monthNameAbbreviated($month_number, $leap_year) { 151a25f0a04SGreg Roach return self::monthNameNominativeCase($month_number, $leap_year); 152a25f0a04SGreg Roach } 153a25f0a04SGreg Roach 154a25f0a04SGreg Roach /** {@inheritdoc} */ 155a25f0a04SGreg Roach public static function dayNames($day_number) { 156a25f0a04SGreg Roach static $translated_day_names; 157a25f0a04SGreg Roach 158a25f0a04SGreg Roach if ($translated_day_names === null) { 159a25f0a04SGreg Roach $translated_day_names = array( 160a25f0a04SGreg Roach 0 => /* I18N: a day in the French republican calendar */ I18N::translate('Primidi'), 161a25f0a04SGreg Roach 1 => /* I18N: a day in the French republican calendar */ I18N::translate('Duodi'), 162a25f0a04SGreg Roach 2 => /* I18N: a day in the French republican calendar */ I18N::translate('Tridi'), 163a25f0a04SGreg Roach 3 => /* I18N: a day in the French republican calendar */ I18N::translate('Quartidi'), 164a25f0a04SGreg Roach 4 => /* I18N: a day in the French republican calendar */ I18N::translate('Quintidi'), 165a25f0a04SGreg Roach 5 => /* I18N: a day in the French republican calendar */ I18N::translate('Sextidi'), 166a25f0a04SGreg Roach 6 => /* I18N: a day in the French republican calendar */ I18N::translate('Septidi'), 167a25f0a04SGreg Roach 7 => /* I18N: a day in the French republican calendar */ I18N::translate('Octidi'), 168a25f0a04SGreg Roach 8 => /* I18N: a day in the French republican calendar */ I18N::translate('Nonidi'), 169a25f0a04SGreg Roach 9 => /* I18N: a day in the French republican calendar */ I18N::translate('Decidi'), 170a25f0a04SGreg Roach ); 171a25f0a04SGreg Roach } 172a25f0a04SGreg Roach 173a25f0a04SGreg Roach return $translated_day_names[$day_number]; 174a25f0a04SGreg Roach } 175a25f0a04SGreg Roach 176a25f0a04SGreg Roach /** {@inheritdoc} */ 177a25f0a04SGreg Roach protected static function dayNamesAbbreviated($day_number) { 178a25f0a04SGreg Roach return self::dayNames($day_number); 179a25f0a04SGreg Roach } 180a25f0a04SGreg Roach 181a25f0a04SGreg Roach /** {@inheritdoc} */ 182a25f0a04SGreg Roach protected function formatLongYear() { 183a25f0a04SGreg Roach return $this->numberToRomanNumerals($this->y); 184a25f0a04SGreg Roach } 185a25f0a04SGreg Roach} 186