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\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 => '', 52a25f0a04SGreg Roach 1 => /* I18N: a month in the French republican calendar */ I18N::translate_c('NOMINATIVE', 'Vendémiaire'), 53a25f0a04SGreg Roach 2 => /* I18N: a month in the French republican calendar */ I18N::translate_c('NOMINATIVE', 'Brumaire'), 54a25f0a04SGreg Roach 3 => /* I18N: a month in the French republican calendar */ I18N::translate_c('NOMINATIVE', 'Frimaire'), 55a25f0a04SGreg Roach 4 => /* I18N: a month in the French republican calendar */ I18N::translate_c('NOMINATIVE', 'Nivôse'), 56a25f0a04SGreg Roach 5 => /* I18N: a month in the French republican calendar */ I18N::translate_c('NOMINATIVE', 'Pluviôse'), 57a25f0a04SGreg Roach 6 => /* I18N: a month in the French republican calendar */ I18N::translate_c('NOMINATIVE', 'Ventôse'), 58a25f0a04SGreg Roach 7 => /* I18N: a month in the French republican calendar */ I18N::translate_c('NOMINATIVE', 'Germinal'), 59a25f0a04SGreg Roach 8 => /* I18N: a month in the French republican calendar */ I18N::translate_c('NOMINATIVE', 'Floréal'), 60a25f0a04SGreg Roach 9 => /* I18N: a month in the French republican calendar */ I18N::translate_c('NOMINATIVE', 'Prairial'), 61a25f0a04SGreg Roach 10 => /* I18N: a month in the French republican calendar */ I18N::translate_c('NOMINATIVE', 'Messidor'), 62a25f0a04SGreg Roach 11 => /* I18N: a month in the French republican calendar */ I18N::translate_c('NOMINATIVE', 'Thermidor'), 63a25f0a04SGreg Roach 12 => /* I18N: a month in the French republican calendar */ I18N::translate_c('NOMINATIVE', 'Fructidor'), 64a25f0a04SGreg Roach 13 => /* I18N: a month in the French republican calendar */ I18N::translate_c('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 => '', 78a25f0a04SGreg Roach 1 => /* I18N: a month in the French republican calendar */ I18N::translate_c('GENITIVE', 'Vendémiaire'), 79a25f0a04SGreg Roach 2 => /* I18N: a month in the French republican calendar */ I18N::translate_c('GENITIVE', 'Brumaire'), 80a25f0a04SGreg Roach 3 => /* I18N: a month in the French republican calendar */ I18N::translate_c('GENITIVE', 'Frimaire'), 81a25f0a04SGreg Roach 4 => /* I18N: a month in the French republican calendar */ I18N::translate_c('GENITIVE', 'Nivôse'), 82a25f0a04SGreg Roach 5 => /* I18N: a month in the French republican calendar */ I18N::translate_c('GENITIVE', 'Pluviôse'), 83a25f0a04SGreg Roach 6 => /* I18N: a month in the French republican calendar */ I18N::translate_c('GENITIVE', 'Ventôse'), 84a25f0a04SGreg Roach 7 => /* I18N: a month in the French republican calendar */ I18N::translate_c('GENITIVE', 'Germinal'), 85a25f0a04SGreg Roach 8 => /* I18N: a month in the French republican calendar */ I18N::translate_c('GENITIVE', 'Floréal'), 86a25f0a04SGreg Roach 9 => /* I18N: a month in the French republican calendar */ I18N::translate_c('GENITIVE', 'Prairial'), 87a25f0a04SGreg Roach 10 => /* I18N: a month in the French republican calendar */ I18N::translate_c('GENITIVE', 'Messidor'), 88a25f0a04SGreg Roach 11 => /* I18N: a month in the French republican calendar */ I18N::translate_c('GENITIVE', 'Thermidor'), 89a25f0a04SGreg Roach 12 => /* I18N: a month in the French republican calendar */ I18N::translate_c('GENITIVE', 'Fructidor'), 90a25f0a04SGreg Roach 13 => /* I18N: a month in the French republican calendar */ I18N::translate_c('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 => '', 104a25f0a04SGreg Roach 1 => /* I18N: a month in the French republican calendar */ I18N::translate_c('LOCATIVE', 'Vendémiaire'), 105a25f0a04SGreg Roach 2 => /* I18N: a month in the French republican calendar */ I18N::translate_c('LOCATIVE', 'Brumaire'), 106a25f0a04SGreg Roach 3 => /* I18N: a month in the French republican calendar */ I18N::translate_c('LOCATIVE', 'Frimaire'), 107a25f0a04SGreg Roach 4 => /* I18N: a month in the French republican calendar */ I18N::translate_c('LOCATIVE', 'Nivôse'), 108a25f0a04SGreg Roach 5 => /* I18N: a month in the French republican calendar */ I18N::translate_c('LOCATIVE', 'Pluviôse'), 109a25f0a04SGreg Roach 6 => /* I18N: a month in the French republican calendar */ I18N::translate_c('LOCATIVE', 'Ventôse'), 110a25f0a04SGreg Roach 7 => /* I18N: a month in the French republican calendar */ I18N::translate_c('LOCATIVE', 'Germinal'), 111a25f0a04SGreg Roach 8 => /* I18N: a month in the French republican calendar */ I18N::translate_c('LOCATIVE', 'Floréal'), 112a25f0a04SGreg Roach 9 => /* I18N: a month in the French republican calendar */ I18N::translate_c('LOCATIVE', 'Prairial'), 113a25f0a04SGreg Roach 10 => /* I18N: a month in the French republican calendar */ I18N::translate_c('LOCATIVE', 'Messidor'), 114a25f0a04SGreg Roach 11 => /* I18N: a month in the French republican calendar */ I18N::translate_c('LOCATIVE', 'Thermidor'), 115a25f0a04SGreg Roach 12 => /* I18N: a month in the French republican calendar */ I18N::translate_c('LOCATIVE', 'Fructidor'), 116a25f0a04SGreg Roach 13 => /* I18N: a month in the French republican calendar */ I18N::translate_c('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 => '', 130a25f0a04SGreg Roach 1 => /* I18N: a month in the French republican calendar */ I18N::translate_c('INSTRUMENTAL', 'Vendémiaire'), 131a25f0a04SGreg Roach 2 => /* I18N: a month in the French republican calendar */ I18N::translate_c('INSTRUMENTAL', 'Brumaire'), 132a25f0a04SGreg Roach 3 => /* I18N: a month in the French republican calendar */ I18N::translate_c('INSTRUMENTAL', 'Frimaire'), 133a25f0a04SGreg Roach 4 => /* I18N: a month in the French republican calendar */ I18N::translate_c('INSTRUMENTAL', 'Nivôse'), 134a25f0a04SGreg Roach 5 => /* I18N: a month in the French republican calendar */ I18N::translate_c('INSTRUMENTAL', 'Pluviôse'), 135a25f0a04SGreg Roach 6 => /* I18N: a month in the French republican calendar */ I18N::translate_c('INSTRUMENTAL', 'Ventôse'), 136a25f0a04SGreg Roach 7 => /* I18N: a month in the French republican calendar */ I18N::translate_c('INSTRUMENTAL', 'Germinal'), 137a25f0a04SGreg Roach 8 => /* I18N: a month in the French republican calendar */ I18N::translate_c('INSTRUMENTAL', 'Floréal'), 138a25f0a04SGreg Roach 9 => /* I18N: a month in the French republican calendar */ I18N::translate_c('INSTRUMENTAL', 'Prairial'), 139a25f0a04SGreg Roach 10 => /* I18N: a month in the French republican calendar */ I18N::translate_c('INSTRUMENTAL', 'Messidor'), 140a25f0a04SGreg Roach 11 => /* I18N: a month in the French republican calendar */ I18N::translate_c('INSTRUMENTAL', 'Thermidor'), 141a25f0a04SGreg Roach 12 => /* I18N: a month in the French republican calendar */ I18N::translate_c('INSTRUMENTAL', 'Fructidor'), 142a25f0a04SGreg Roach 13 => /* I18N: a month in the French republican calendar */ I18N::translate_c('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