xref: /webtrees/app/Date/FrenchDate.php (revision 17920f94befaa1d6150480429428429b0bee7e3a)
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	/** {@inheritdoc} */
26a25f0a04SGreg 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);
27a25f0a04SGreg Roach
28a25f0a04SGreg Roach	/** {@inheritdoc} */
29a25f0a04SGreg Roach	public function __construct($date) {
30a25f0a04SGreg Roach		$this->calendar = new FrenchCalendar;
31a25f0a04SGreg Roach		parent::__construct($date);
32a25f0a04SGreg Roach	}
33a25f0a04SGreg Roach
34a25f0a04SGreg Roach	/** {@inheritdoc} */
35a25f0a04SGreg Roach	public static function monthNameNominativeCase($month_number, $leap_year) {
36a25f0a04SGreg Roach		static $translated_month_names;
37a25f0a04SGreg Roach
38a25f0a04SGreg Roach		if ($translated_month_names === null) {
39a25f0a04SGreg Roach			$translated_month_names = array(
40a25f0a04SGreg Roach				0  => '',
41764a01d9SGreg Roach				1  => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Vendémiaire'),
42764a01d9SGreg Roach				2  => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Brumaire'),
43764a01d9SGreg Roach				3  => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Frimaire'),
44764a01d9SGreg Roach				4  => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Nivôse'),
45764a01d9SGreg Roach				5  => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Pluviôse'),
46764a01d9SGreg Roach				6  => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Ventôse'),
47764a01d9SGreg Roach				7  => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Germinal'),
48764a01d9SGreg Roach				8  => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Floréal'),
49764a01d9SGreg Roach				9  => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Prairial'),
50764a01d9SGreg Roach				10 => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Messidor'),
51764a01d9SGreg Roach				11 => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Thermidor'),
52764a01d9SGreg Roach				12 => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'Fructidor'),
53764a01d9SGreg Roach				13 => /* I18N: a month in the French republican calendar */ I18N::translateContext('NOMINATIVE', 'jours complémentaires'),
54a25f0a04SGreg Roach			);
55a25f0a04SGreg Roach		}
56a25f0a04SGreg Roach
57a25f0a04SGreg Roach		return $translated_month_names[$month_number];
58a25f0a04SGreg Roach	}
59a25f0a04SGreg Roach
60a25f0a04SGreg Roach	/** {@inheritdoc} */
61*17920f94SGreg Roach	protected function monthNameGenitiveCase($month_number, $leap_year) {
62a25f0a04SGreg Roach		static $translated_month_names;
63a25f0a04SGreg Roach
64a25f0a04SGreg Roach		if ($translated_month_names === null) {
65a25f0a04SGreg Roach			$translated_month_names = array(
66a25f0a04SGreg Roach				0  => '',
67764a01d9SGreg Roach				1  => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Vendémiaire'),
68764a01d9SGreg Roach				2  => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Brumaire'),
69764a01d9SGreg Roach				3  => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Frimaire'),
70764a01d9SGreg Roach				4  => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Nivôse'),
71764a01d9SGreg Roach				5  => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Pluviôse'),
72764a01d9SGreg Roach				6  => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Ventôse'),
73764a01d9SGreg Roach				7  => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Germinal'),
74764a01d9SGreg Roach				8  => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Floréal'),
75764a01d9SGreg Roach				9  => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Prairial'),
76764a01d9SGreg Roach				10 => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Messidor'),
77764a01d9SGreg Roach				11 => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Thermidor'),
78764a01d9SGreg Roach				12 => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'Fructidor'),
79764a01d9SGreg Roach				13 => /* I18N: a month in the French republican calendar */ I18N::translateContext('GENITIVE', 'jours complémentaires'),
80a25f0a04SGreg Roach			);
81a25f0a04SGreg Roach		}
82a25f0a04SGreg Roach
83a25f0a04SGreg Roach		return $translated_month_names[$month_number];
84a25f0a04SGreg Roach	}
85a25f0a04SGreg Roach
86a25f0a04SGreg Roach	/** {@inheritdoc} */
87*17920f94SGreg Roach	protected function monthNameLocativeCase($month_number, $leap_year) {
88a25f0a04SGreg Roach		static $translated_month_names;
89a25f0a04SGreg Roach
90a25f0a04SGreg Roach		if ($translated_month_names === null) {
91a25f0a04SGreg Roach			$translated_month_names = array(
92a25f0a04SGreg Roach				0  => '',
93764a01d9SGreg Roach				1  => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Vendémiaire'),
94764a01d9SGreg Roach				2  => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Brumaire'),
95764a01d9SGreg Roach				3  => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Frimaire'),
96764a01d9SGreg Roach				4  => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Nivôse'),
97764a01d9SGreg Roach				5  => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Pluviôse'),
98764a01d9SGreg Roach				6  => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Ventôse'),
99764a01d9SGreg Roach				7  => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Germinal'),
100764a01d9SGreg Roach				8  => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Floréal'),
101764a01d9SGreg Roach				9  => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Prairial'),
102764a01d9SGreg Roach				10 => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Messidor'),
103764a01d9SGreg Roach				11 => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Thermidor'),
104764a01d9SGreg Roach				12 => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'Fructidor'),
105764a01d9SGreg Roach				13 => /* I18N: a month in the French republican calendar */ I18N::translateContext('LOCATIVE', 'jours complémentaires'),
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: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Vendémiaire'),
120764a01d9SGreg Roach				2  => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Brumaire'),
121764a01d9SGreg Roach				3  => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Frimaire'),
122764a01d9SGreg Roach				4  => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Nivôse'),
123764a01d9SGreg Roach				5  => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Pluviôse'),
124764a01d9SGreg Roach				6  => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Ventôse'),
125764a01d9SGreg Roach				7  => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Germinal'),
126764a01d9SGreg Roach				8  => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Floréal'),
127764a01d9SGreg Roach				9  => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Prairial'),
128764a01d9SGreg Roach				10 => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Messidor'),
129764a01d9SGreg Roach				11 => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Thermidor'),
130764a01d9SGreg Roach				12 => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'Fructidor'),
131764a01d9SGreg Roach				13 => /* I18N: a month in the French republican calendar */ I18N::translateContext('INSTRUMENTAL', 'jours complémentaires'),
132a25f0a04SGreg Roach			);
133a25f0a04SGreg Roach		}
134a25f0a04SGreg Roach
135a25f0a04SGreg Roach		return $translated_month_names[$month_number];
136a25f0a04SGreg Roach	}
137a25f0a04SGreg Roach
138a25f0a04SGreg Roach	/** {@inheritdoc} */
139*17920f94SGreg Roach	protected function monthNameAbbreviated($month_number, $leap_year) {
140a25f0a04SGreg Roach		return self::monthNameNominativeCase($month_number, $leap_year);
141a25f0a04SGreg Roach	}
142a25f0a04SGreg Roach
143a25f0a04SGreg Roach	/** {@inheritdoc} */
144*17920f94SGreg Roach	public function dayNames($day_number) {
145a25f0a04SGreg Roach		static $translated_day_names;
146a25f0a04SGreg Roach
147a25f0a04SGreg Roach		if ($translated_day_names === null) {
148a25f0a04SGreg Roach			$translated_day_names = array(
149a25f0a04SGreg Roach				0  => /* I18N: a day in the French republican calendar */ I18N::translate('Primidi'),
150a25f0a04SGreg Roach				1  => /* I18N: a day in the French republican calendar */ I18N::translate('Duodi'),
151a25f0a04SGreg Roach				2  => /* I18N: a day in the French republican calendar */ I18N::translate('Tridi'),
152a25f0a04SGreg Roach				3  => /* I18N: a day in the French republican calendar */ I18N::translate('Quartidi'),
153a25f0a04SGreg Roach				4  => /* I18N: a day in the French republican calendar */ I18N::translate('Quintidi'),
154a25f0a04SGreg Roach				5  => /* I18N: a day in the French republican calendar */ I18N::translate('Sextidi'),
155a25f0a04SGreg Roach				6  => /* I18N: a day in the French republican calendar */ I18N::translate('Septidi'),
156a25f0a04SGreg Roach				7  => /* I18N: a day in the French republican calendar */ I18N::translate('Octidi'),
157a25f0a04SGreg Roach				8  => /* I18N: a day in the French republican calendar */ I18N::translate('Nonidi'),
158a25f0a04SGreg Roach				9  => /* I18N: a day in the French republican calendar */ I18N::translate('Decidi'),
159a25f0a04SGreg Roach			);
160a25f0a04SGreg Roach		}
161a25f0a04SGreg Roach
162a25f0a04SGreg Roach		return $translated_day_names[$day_number];
163a25f0a04SGreg Roach	}
164a25f0a04SGreg Roach
165a25f0a04SGreg Roach	/** {@inheritdoc} */
166*17920f94SGreg Roach	protected function dayNamesAbbreviated($day_number) {
167*17920f94SGreg Roach		return $this->dayNames($day_number);
168a25f0a04SGreg Roach	}
169a25f0a04SGreg Roach
170a25f0a04SGreg Roach	/** {@inheritdoc} */
171a25f0a04SGreg Roach	protected function formatLongYear() {
172a25f0a04SGreg Roach		return $this->numberToRomanNumerals($this->y);
173a25f0a04SGreg Roach	}
174a25f0a04SGreg Roach}
175