Skip to content

Commit

Permalink
Issue #45: Update php-rrule to v2.5.0 (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
indigoxela authored Jun 21, 2024
1 parent c19e9e9 commit 985b59d
Show file tree
Hide file tree
Showing 17 changed files with 404 additions and 39 deletions.
18 changes: 17 additions & 1 deletion libraries/php-rrule/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

## [Unreleased]

## [2.5.0] - 2024-06-08

### Fixed

- Swedish: Corrects the spelling of monday and the grammar of enumeration partials. [#134](https://github.com/rlanvin/php-rrule/pull/134)
- Spanish: Improve clarity in daily and weekly recurrence translation [#147](https://github.com/rlanvin/php-rrule/pull/147)
- Dutch: weekdays and months are written in lowercase [#136](https://github.com/rlanvin/php-rrule/pull/136)
- Better handle TZ with Exchange / M365 generated iCal files [#143](https://github.com/rlanvin/php-rrule/pull/143)

### Added

- Human readable time of day option [#124](https://github.com/rlanvin/php-rrule/pull/124)
- Japanese translation [#139](https://github.com/rlanvin/php-rrule/pull/139)
- Czech translation [#137](https://github.com/rlanvin/php-rrule/pull/137)

## [2.4.1] - 2023-06-07

### Fixed
Expand Down Expand Up @@ -250,7 +265,8 @@

- First release, everything before that was unversioned (`dev-master` was used).

[Unreleased]: https://github.com/rlanvin/php-rrule/compare/v2.4.1...HEAD
[Unreleased]: https://github.com/rlanvin/php-rrule/compare/v2.5.0...HEAD
[2.5.0]: https://github.com/rlanvin/php-rrule/compare/v2.4.1...v2.5.0
[2.4.1]: https://github.com/rlanvin/php-rrule/compare/v2.4.0...v2.4.1
[2.4.0]: https://github.com/rlanvin/php-rrule/compare/v2.3.2...v2.4.0
[2.3.2]: https://github.com/rlanvin/php-rrule/compare/v2.3.1...v2.3.2
Expand Down
20 changes: 14 additions & 6 deletions libraries/php-rrule/src/RRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -2068,9 +2068,10 @@ static protected function i18nLoad($locale, $fallback = null, $use_intl = null,
* | `locale` | string | The locale to use (autodetect)
* | `fallback` | string | Fallback locale if main locale is not found (default en)
* | `date_formatter` | callable| Function used to format the date (takes date, returns formatted)
* | `explicit_inifite`| bool | Mention "forever" if the rule is infinite (true)
* | `explicit_infinite`| bool | Mention "forever" if the rule is infinite (true)
* | `dtstart` | bool | Mention the start date (true)
* | `include_start` | bool |
* | `start_time_only` | bool | Mention the time of day only, without the date
* | `include_until` | bool |
* | `custom_path` | string |
*
Expand All @@ -2091,6 +2092,7 @@ public function humanReadable(array $opt = array())
'fallback' => 'en',
'explicit_infinite' => true,
'include_start' => true,
'start_time_only' => false,
'include_until' => true,
'custom_path' => null
);
Expand All @@ -2106,15 +2108,15 @@ public function humanReadable(array $opt = array())
}

if ($opt['use_intl']) {
$default_opt['date_format'] = \IntlDateFormatter::SHORT;
$default_opt['date_format'] = isset($opt['start_time_only']) && $opt['start_time_only'] ? \IntlDateFormatter::NONE : \IntlDateFormatter::SHORT;
if ($this->freq >= self::SECONDLY || not_empty($this->rule['BYSECOND'])) {
$default_opt['time_format'] = \IntlDateFormatter::LONG;
}
elseif ($this->freq >= self::HOURLY || not_empty($this->rule['BYHOUR']) || not_empty($this->rule['BYMINUTE'])) {
$default_opt['time_format'] = \IntlDateFormatter::SHORT;
}
else {
$default_opt['time_format'] = \IntlDateFormatter::NONE;
$default_opt['time_format'] = isset($opt['start_time_only']) && $opt['start_time_only'] ? \IntlDateFormatter::SHORT : \IntlDateFormatter::NONE;
}
}

Expand Down Expand Up @@ -2149,8 +2151,9 @@ public function humanReadable(array $opt = array())
};
}
else {
$opt['date_formatter'] = function($date) {
return $date->format('Y-m-d H:i:s');
$opt['date_formatter'] = function ($date) use ($opt) {
$format = $opt['start_time_only'] ? 'H:i:s' : 'Y-m-d H:i:s';
return $date->format($format);
};
}
}
Expand Down Expand Up @@ -2362,7 +2365,12 @@ public function humanReadable(array $opt = array())

if ($opt['include_start']) {
// from X
$parts['start'] = strtr($i18n['dtstart'], array(
if ($opt['start_time_only']) {
$value = $this->freq >= self::HOURLY ? 'startingtimeofday' : 'timeofday';
} else {
$value = 'dtstart';
}
$parts['start'] = strtr($i18n[$value], array(
'%{date}' => $opt['date_formatter']($this->dtstart)
));
}
Expand Down
6 changes: 3 additions & 3 deletions libraries/php-rrule/src/RfcParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ static public function parseRDate($line)
foreach ($property['params'] as $name => $value) {
switch (strtoupper($name)) {
case 'TZID':
$tz = new \DateTimeZone($value);
$tz = self::parseTimeZone($value);
break;
case 'VALUE':
switch ($value) {
Expand Down Expand Up @@ -284,7 +284,7 @@ static public function parseExDate($line)
// Ignore optional words
break;
case 'TZID':
$tz = new \DateTimeZone($value);
$tz = self::parseTimeZone($value);
break;
default:
throw new \InvalidArgumentException("Unknown property parameter: $name");
Expand Down Expand Up @@ -325,4 +325,4 @@ static public function parseTimeZone($tzid)

return new \DateTimeZone($tzid);
}
}
}
174 changes: 174 additions & 0 deletions libraries/php-rrule/src/i18n/cz.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
<?php

/**
* Translation file for Czech language.
*
* Most strings can be an array, with a value as the key. The system will
* pick the translation corresponding to the key. The key "else" will be picked
* if no matching value is found. This is useful for plurals.
*
* Licensed under the MIT license.
*
* For the full copyright and license information, please view the LICENSE file.
*
* @author Jakub Kluvánek <[email protected]>
* @link https://github.com/rlanvin/php-rrule
*/
return array(
'yearly' => array(
'1' => 'ročně',
'2' => 'každé %{interval} roky',
'3' => 'každé %{interval} roky',
'4' => 'každé %{interval} roky',
'else' => 'každých %{interval} let'
),
'monthly' => array(
'1' => 'měsíčně',
'2' => 'každé %{interval} měsíce',
'3' => 'každé %{interval} měsíce',
'4' => 'každé %{interval} měsíce',
'else' => 'každých %{interval} měsíců'
),
'weekly' => array(
'1' => 'týdně',
'2' => 'každé %{interval} týdny',
'3' => 'každé %{interval} týdny',
'4' => 'každé %{interval} týdny',
'else' => 'každých %{interval} týdnů'
),
'daily' => array(
'1' => 'denně',
'2' => 'každé %{interval} dny',
'3' => 'každé %{interval} dny',
'4' => 'každé %{interval} dny',
'5' => 'každé %{interval} dny',
'else' => 'každých %{interval} dnů'
),
'hourly' => array(
'1' => 'každou hodinu',
'2' => 'každé %{interval} hodiny',
'3' => 'každé %{interval} hodiny',
'4' => 'každé %{interval} hodiny',
'else' => 'každých %{interval} hodin'
),
'minutely' => array(
'1' => 'každou minutu',
'2' => 'každé %{interval} minuty',
'3' => 'každé %{interval} minuty',
'4' => 'každé %{interval} minuty',
'else' => 'každých %{interval} minut'
),
'secondly' => array(
'1' => 'každou sekundu',
'2' => 'každé %{interval} sekundy',
'3' => 'každé %{interval} sekundy',
'4' => 'každé %{interval} sekundy',
'else' => 'každých %{interval} sekund'
),
'dtstart' => ', počínaje %{date}',
'timeofday' => ' v %{date}',
'startingtimeofday' => ' začínající v %{date}',
'infinite' => ', navždy',
'until' => ', do %{date}',
'count' => array(
'1' => ', jednou',
'else' => ', %{count}x'
),
'and' => 'a ',
'x_of_the_y' => array(
'yearly' => '%{x} roku', // e.g. the first Monday of the year, or the first day of the year
'monthly' => '%{x} měsíce'
),
'bymonth' => ' v %{months}',
'months' => array(
1 => 'leden',
2 => 'únor',
3 => 'březen',
4 => 'duben',
5 => 'květen',
6 => 'červen',
7 => 'červenec',
8 => 'srpen',
9 => 'září',
10 => 'říjen',
11 => 'listopad',
12 => 'prosinec'
),
'byweekday' => ' v %{weekdays}',
'weekdays' => array(
1 => 'pondělí',
2 => 'úterý',
3 => 'středa',
4 => 'čtvrtek',
5 => 'pátek',
6 => 'sobota',
7 => 'neděle'
),
'nth_weekday' => array(
'1' => 'první %{weekday}', // e.g. the first Monday
'2' => 'druhé %{weekday}',
'3' => 'třetí %{weekday}',
'else' => '%{n}. %{weekday}'
),
'-nth_weekday' => array(
'-1' => 'poslední %{weekday}', // e.g. the last Monday
'-2' => 'předposlední %{weekday}',
'else' => '%{n}. od konce %{weekday}'
),
'byweekno' => array(
'1' => ' v týdnu %{weeks}',
'else' => ' v týdnech č.%{weeks}'
),
'nth_weekno' => '%{n}',
'bymonthday' => ' ve dnech %{monthdays}',
'nth_monthday' => array(
'else' => '%{n}.'
),
'-nth_monthday' => array(
'-1' => 'poslední',
'-2' => 'předposlední',
'else' => '%{n}. od konce'
),
'byyearday' => array(
'1' => ' ve dnu %{yeardays}',
'else' => ' ve dnech %{yeardays}'
),
'nth_yearday' => array(
'1' => 'první',
'2' => 'druhý',
'3' => 'třetí',
'else' => '%{n}.'
),
'-nth_yearday' => array(
'-1' => 'poslední',
'-2' => 'předposlední',
'else' => '%{n}. od konce'
),
'byhour' => array(
'1' => ' v hodině %{hours}',
'else' => ' v hodiny %{hours}'
),
'nth_hour' => '%{n}h',
'byminute' => array(
'1' => ' v minutu %{minutes}',
'else' => ' v minuty %{minutes}'
),
'nth_minute' => '%{n}',
'bysecond' => array(
'1' => ' v sekundě %{seconds}',
'else' => ' v sekundy %{seconds}'
),
'nth_second' => '%{n}',
'bysetpos' => ', ale pouze %{setpos} instance sady',
'nth_setpos' => array(
'1' => 'první',
'2' => 'druhá',
'3' => 'třetí',
'else' => ' %{n}.'
),
'-nth_setpos' => array(
'-1' => 'poslední',
'-2' => 'předposlední',
'else' => '%{n}. od konce'
)
);
2 changes: 2 additions & 0 deletions libraries/php-rrule/src/i18n/de.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
'else' => 'Alle %{interval} Sekunden'
),
'dtstart' => ', ab dem %{date}',
'timeofday' => ' um %{date}',
'startingtimeofday' => ' ab %{date}',
'infinite' => ', für immer',
'until' => ', bis zum %{date}',
'count' => array(
Expand Down
2 changes: 2 additions & 0 deletions libraries/php-rrule/src/i18n/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
'else' => 'every %{interval} seconds'
),
'dtstart' => ', starting from %{date}',
'timeofday' => ' at %{date}',
'startingtimeofday' => ' starting at %{date}',
'infinite' => ', forever',
'until' => ', until %{date}',
'count' => array(
Expand Down
6 changes: 4 additions & 2 deletions libraries/php-rrule/src/i18n/es.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
),
'weekly' => array(
'1' => 'semanal',
'2' => 'cualquier otra semana',
'2' => 'semana por medio',
'else' => 'cada %{interval} semanas' // cada 8 semanas
),
'daily' => array(
'1' => 'diario',
'2' => 'cualquier otro día',
'2' => 'día por medio',
'else' => 'cada %{interval} días' // cada 8 días
),
'hourly' => array(
Expand All @@ -39,6 +39,8 @@
'else' => 'cada %{interval} segundos'// cada 8 segundos
),
'dtstart' => ', empezando desde %{date}',
'timeofday' => ' a las %{date}',
'startingtimeofday' => ' empezando desde %{date}',
'infinite' => ', por siempre',
'until' => ', hasta %{date}',
'count' => array(
Expand Down
2 changes: 2 additions & 0 deletions libraries/php-rrule/src/i18n/fa.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
'else' => 'هر %{interval} ثانیه'
),
'dtstart' => ', از %{date}',
'timeofday' => ' از %{date}',
'startingtimeofday' => ' از %{date}',
'infinite' => ', همیشه',
'until' => ', تا %{date}',
'count' => array(
Expand Down
2 changes: 2 additions & 0 deletions libraries/php-rrule/src/i18n/fi.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
'else' => 'joka %{interval} sekunti'
),
'dtstart' => ', alkaen %{date}',
'timeofday' => ' klo %{date}',
'startingtimeofday' => ' alkaen %{date}',
'infinite' => ', jatkuvasti',
'until' => ', %{date} asti',
'count' => array(
Expand Down
2 changes: 2 additions & 0 deletions libraries/php-rrule/src/i18n/fr.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
'else' => 'toutes les %{interval} secondes'
),
'dtstart' => ', à partir du %{date}',
'timeofday' => ' à %{date}',
'startingtimeofday' => ' à partir du %{date}',
'infinite' => ', indéfiniment',
'until' => ', jusqu\'au %{date}',
'count' => array(
Expand Down
2 changes: 2 additions & 0 deletions libraries/php-rrule/src/i18n/he.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
'else' => 'כל %{interval} שניות'
),
'dtstart' => ', החל מ%{date}',
'timeofday' => ' החל מ%{date}',
'startingtimeofday' => ' החל מ%{date}',
'infinite' => ', לעד',
'until' => ', עד %{date}',
'count' => array(
Expand Down
2 changes: 2 additions & 0 deletions libraries/php-rrule/src/i18n/it.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
'else' => 'ogni %{interval} secondi'
),
'dtstart' => ', a partire dal %{date}',
'timeofday' => ' alle %{date}',
'startingtimeofday' => ' a partire dal %{date}',
'infinite' => ', per sempre',
'until' => ', fino al %{date}',
'count' => array(
Expand Down
Loading

0 comments on commit 985b59d

Please sign in to comment.