diff options
| author | Greg Roach <fisharebest@gmail.com> | 2015-03-31 18:45:38 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2015-04-03 08:57:06 +0100 |
| commit | 4e6225d53a8a7b56681ba35a19239662ca20d718 (patch) | |
| tree | 245c65d70359dc3dc318928bb33be1e492631e36 /app | |
| parent | 7231a557514e784a0eafe6ac24342f24bcf671ae (diff) | |
| download | webtrees-4e6225d53a8a7b56681ba35a19239662ca20d718.tar.gz webtrees-4e6225d53a8a7b56681ba35a19239662ca20d718.tar.bz2 webtrees-4e6225d53a8a7b56681ba35a19239662ca20d718.zip | |
Refactor static function from CalendarDate
Diffstat (limited to 'app')
| -rw-r--r-- | app/Date.php | 17 | ||||
| -rw-r--r-- | app/Date/CalendarDate.php | 9 | ||||
| -rw-r--r-- | app/Date/FrenchDate.php | 5 | ||||
| -rw-r--r-- | app/Date/GregorianDate.php | 6 | ||||
| -rw-r--r-- | app/Date/HijriDate.php | 6 | ||||
| -rw-r--r-- | app/Date/JalaliDate.php | 6 | ||||
| -rw-r--r-- | app/Date/JewishDate.php | 6 | ||||
| -rw-r--r-- | app/Date/JulianDate.php | 6 | ||||
| -rw-r--r-- | app/Module/YahrzeitModule.php | 4 |
9 files changed, 19 insertions, 46 deletions
diff --git a/app/Date.php b/app/Date.php index af93905dca..fb7f2a19f2 100644 --- a/app/Date.php +++ b/app/Date.php @@ -199,6 +199,23 @@ class Date { } } + + /** + * A list of supported calendars and their names. + * + * @return string[] + */ + public static function calendarNames() { + return array( + 'gregorian' => /* I18N: The gregorian calendar */ I18N::translate('Gregorian'), + 'julian' => /* I18N: The julian calendar */ I18N::translate('Julian'), + 'french' => /* I18N: The French calendar */ I18N::translate('French'), + 'jewish' => /* I18N: The Hebrew/Jewish calendar */ I18N::translate('Jewish'), + 'hijri' => /* I18N: The Arabic/Hijri calendar */ I18N::translate('Hijri'), + 'jalali' => /* I18N: The Persian/Jalali calendar */ I18N::translate('Jalali'), + ); + } + /** * Convert a date to the preferred format and calendar(s) display. * diff --git a/app/Date/CalendarDate.php b/app/Date/CalendarDate.php index 479ce76656..8ed5d31a89 100644 --- a/app/Date/CalendarDate.php +++ b/app/Date/CalendarDate.php @@ -136,15 +136,6 @@ class CalendarDate { } /** - * What is this calendar called? - * - * @return string - */ - public static function calendarName() { - return /* I18N: The French calendar */ I18N::translate('French'); - } - - /** * Is the current year a leap year? * * @return boolean diff --git a/app/Date/FrenchDate.php b/app/Date/FrenchDate.php index 79e765d8e9..ab6650a29b 100644 --- a/app/Date/FrenchDate.php +++ b/app/Date/FrenchDate.php @@ -38,11 +38,6 @@ class FrenchDate extends CalendarDate { } /** {@inheritdoc} */ - public static function calendarName() { - return /* I18N: The French calendar */ I18N::translate('French'); - } - - /** {@inheritdoc} */ public static function monthNameNominativeCase($month_number, $leap_year) { static $translated_month_names; diff --git a/app/Date/GregorianDate.php b/app/Date/GregorianDate.php index 8105dade2d..7f04c121a8 100644 --- a/app/Date/GregorianDate.php +++ b/app/Date/GregorianDate.php @@ -30,10 +30,4 @@ class GregorianDate extends CalendarDate { $this->calendar = new GregorianCalendar; parent::__construct($date); } - - /** {@inheritdoc} */ - public static function calendarName() { - return /* I18N: The gregorian calendar */ - I18N::translate('Gregorian'); - } } diff --git a/app/Date/HijriDate.php b/app/Date/HijriDate.php index a4693e0332..0a5d24afd3 100644 --- a/app/Date/HijriDate.php +++ b/app/Date/HijriDate.php @@ -38,12 +38,6 @@ class HijriDate extends CalendarDate { } /** {@inheritdoc} */ - public static function calendarName() { - return /* I18N: The Arabic/Hijri calendar */ - I18N::translate('Hijri'); - } - - /** {@inheritdoc} */ public static function monthNameNominativeCase($month_number, $leap_year) { static $translated_month_names; diff --git a/app/Date/JalaliDate.php b/app/Date/JalaliDate.php index 78e02381f4..88c7df638a 100644 --- a/app/Date/JalaliDate.php +++ b/app/Date/JalaliDate.php @@ -35,12 +35,6 @@ class JalaliDate extends CalendarDate { } /** {@inheritdoc} */ - public static function calendarName() { - return /* I18N: The Persian/Jalali calendar */ - I18N::translate('Jalali'); - } - - /** {@inheritdoc} */ public static function monthNameNominativeCase($month_number, $leap_year) { static $translated_month_names; diff --git a/app/Date/JewishDate.php b/app/Date/JewishDate.php index 5ddceb6887..c97b5944fe 100644 --- a/app/Date/JewishDate.php +++ b/app/Date/JewishDate.php @@ -39,12 +39,6 @@ class JewishDate extends CalendarDate { } /** {@inheritdoc} */ - public static function calendarName() { - return /* I18N: The Hebrew/Jewish calendar */ - I18N::translate('Jewish'); - } - - /** {@inheritdoc} */ function formatDayZeros() { if (WT_LOCALE == 'he') { return $this->numberToHebrewNumerals($this->d); diff --git a/app/Date/JulianDate.php b/app/Date/JulianDate.php index 45b3e1b9b9..995623afcc 100644 --- a/app/Date/JulianDate.php +++ b/app/Date/JulianDate.php @@ -35,12 +35,6 @@ class JulianDate extends CalendarDate { } /** {@inheritdoc} */ - public static function calendarName() { - return /* I18N: The julian calendar */ - I18N::translate('Julian'); - } - - /** {@inheritdoc} */ protected static function nextYear($year) { if ($year == -1) { return 1; diff --git a/app/Module/YahrzeitModule.php b/app/Module/YahrzeitModule.php index 00a4820daf..d7e444acc1 100644 --- a/app/Module/YahrzeitModule.php +++ b/app/Module/YahrzeitModule.php @@ -260,8 +260,8 @@ class YahrzeitModule extends AbstractModule implements ModuleBlockInterface { echo I18N::translate('Calendar'); echo '</td><td class="optionbox">'; echo select_edit_control('calendar', array( - 'jewish' => JewishDate::calendarName(), - 'gregorian'=> GregorianDate::calendarName(), + 'jewish' => /* I18N: The Hebrew/Jewish calendar */ I18N::translate('Jewish'), + 'gregorian'=> /* I18N: The gregorian calendar */ I18N::translate('Gregorian'), ), null, $calendar, ''); echo '</td></tr>'; |
