mirror of
https://github.com/rlanvin/php-rrule.git
synced 2025-02-20 09:54:16 +01:00
Fix double space bugs with 'and'
This commit is contained in:
parent
d118a932fc
commit
f77c9644c6
@ -6,10 +6,12 @@
|
|||||||
|
|
||||||
- Added Swedish translation [#96](https://github.com/rlanvin/php-rrule/pull/96/)
|
- Added Swedish translation [#96](https://github.com/rlanvin/php-rrule/pull/96/)
|
||||||
- Added `bin/review_translations.php` as a helper for translators and contributors
|
- Added `bin/review_translations.php` as a helper for translators and contributors
|
||||||
|
- Added Hebrew translation [#95](https://github.com/rlanvin/php-rrule/pull/95)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fix Finnish translation [#94](https://github.com/rlanvin/php-rrule/issues/94)
|
- Fix Finnish translation [#94](https://github.com/rlanvin/php-rrule/issues/94)
|
||||||
|
- Update French translation
|
||||||
- Update German translation
|
- Update German translation
|
||||||
|
|
||||||
## [2.2.2] - 2021-01-09
|
## [2.2.2] - 2021-01-09
|
||||||
|
@ -2246,28 +2246,36 @@ class RRule implements RRuleInterface
|
|||||||
));
|
));
|
||||||
$parts['bymonthday'][] = $tmp;
|
$parts['bymonthday'][] = $tmp;
|
||||||
}
|
}
|
||||||
$parts['bymonthday'] = implode(' '.$i18n['and'],$parts['bymonthday']);
|
// because the 'on the Xth day' strings start with the space, and the "and" ends with a space
|
||||||
|
// it's necessary to collapse double spaces into one
|
||||||
|
// this behaviour was introduced in https://github.com/rlanvin/php-rrule/pull/95
|
||||||
|
$parts['bymonthday'] = str_replace(' ',' ',implode(' '.$i18n['and'],$parts['bymonthday']));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (not_empty($this->rule['BYDAY'])) {
|
if (not_empty($this->rule['BYDAY'])) {
|
||||||
$parts['byweekday'] = array();
|
$parts['byweekday'] = array();
|
||||||
if ($this->byweekday) {
|
if ($this->byweekday) {
|
||||||
$tmp = $this->byweekday;
|
$tmp = $this->byweekday;
|
||||||
$shorten_weekdays_in_list = !empty($i18n['shorten_weekdays_in_list']) && count($tmp) > 1;
|
|
||||||
if ($shorten_weekdays_in_list) {
|
$selector = 'weekdays';
|
||||||
$daysnames = $i18n['weekdays_shortened_for_list'];
|
$days_names = $i18n['weekdays'];
|
||||||
}
|
$prefix = '';
|
||||||
else {
|
if (!empty($i18n['shorten_weekdays_in_list']) && count($tmp) > 1) {
|
||||||
$daysnames = $i18n['weekdays'];
|
// special case for Hebrew (and possibly other languages)
|
||||||
|
// see https://github.com/rlanvin/php-rrule/pull/95 for the reasoning
|
||||||
|
$selector = 'weekdays_shortened_for_list';
|
||||||
|
$prefix = $i18n['shorten_weekdays_days'];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($tmp as & $value) {
|
foreach ($tmp as & $value) {
|
||||||
$value = $daysnames[$value];
|
$value = $i18n[$selector][$value];
|
||||||
}
|
}
|
||||||
$prefix = $shorten_weekdays_in_list ? $i18n['shorten_weekdays_days'] : "";
|
|
||||||
$parts['byweekday'][] = strtr(self::i18nSelect($i18n['byweekday'], count($tmp)), array(
|
$parts['byweekday'][] = strtr(self::i18nSelect($i18n['byweekday'], count($tmp)), array(
|
||||||
'%{weekdays}' => $prefix . self::i18nList($tmp, $i18n['and'])
|
'%{weekdays}' => $prefix . self::i18nList($tmp, $i18n['and'])
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->byweekday_nth) {
|
if ($this->byweekday_nth) {
|
||||||
$tmp = $this->byweekday_nth;
|
$tmp = $this->byweekday_nth;
|
||||||
foreach ($tmp as & $value) {
|
foreach ($tmp as & $value) {
|
||||||
|
@ -1,17 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translation file for English language.
|
* Translation file for Hebrew 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.
|
* Licensed under the MIT license.
|
||||||
*
|
*
|
||||||
* For the full copyright and license information, please view the LICENSE file.
|
* For the full copyright and license information, please view the LICENSE file.
|
||||||
*
|
*
|
||||||
* @author Rémi Lanvin <remi@cloudconnected.fr>
|
|
||||||
* @link https://github.com/rlanvin/php-rrule
|
* @link https://github.com/rlanvin/php-rrule
|
||||||
*/
|
*/
|
||||||
return array(
|
return array(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user