mirror of
https://github.com/rlanvin/php-rrule.git
synced 2025-02-26 15:54:14 +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
|
||||||
|
@ -1929,7 +1929,7 @@ class RRule implements RRuleInterface
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
static protected function i18nList(array $array, $and = 'and')
|
static protected function i18nList(array $array, $and = 'and ')
|
||||||
{
|
{
|
||||||
if (count($array) > 1) {
|
if (count($array) > 1) {
|
||||||
$last = array_splice($array, -1);
|
$last = array_splice($array, -1);
|
||||||
@ -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
|
||||||
foreach ($tmp as & $value) {
|
$selector = 'weekdays_shortened_for_list';
|
||||||
$value = $daysnames[$value];
|
$prefix = $i18n['shorten_weekdays_days'];
|
||||||
}
|
}
|
||||||
$prefix = $shorten_weekdays_in_list ? $i18n['shorten_weekdays_days'] : "";
|
|
||||||
|
foreach ($tmp as & $value) {
|
||||||
|
$value = $i18n[$selector][$value];
|
||||||
|
}
|
||||||
|
|
||||||
$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) {
|
||||||
|
103
src/i18n/he.php
103
src/i18n/he.php
@ -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(
|
||||||
@ -74,36 +69,36 @@ return array(
|
|||||||
),
|
),
|
||||||
'byweekday' => ' ב%{weekdays}',
|
'byweekday' => ' ב%{weekdays}',
|
||||||
'weekdays' => array(
|
'weekdays' => array(
|
||||||
1 => "יום ב'",
|
1 => "יום ב'",
|
||||||
2 => "יום ג'",
|
2 => "יום ג'",
|
||||||
3 => "יום ד'",
|
3 => "יום ד'",
|
||||||
4 => "יום ה'",
|
4 => "יום ה'",
|
||||||
5 => "יום ו'",
|
5 => "יום ו'",
|
||||||
6 => "שבת",
|
6 => "שבת",
|
||||||
7 => "יום א'",
|
7 => "יום א'",
|
||||||
|
),
|
||||||
|
'shorten_weekdays_in_list' => true,
|
||||||
|
'shorten_weekdays_days' => 'ימים ',
|
||||||
|
'weekdays_shortened_for_list' => array(
|
||||||
|
1 => "שני",
|
||||||
|
2 => "שלישי",
|
||||||
|
3 => "רביעי",
|
||||||
|
4 => "חמישי",
|
||||||
|
5 => "שישי",
|
||||||
|
6 => "שבת",
|
||||||
|
7 => "ראשון",
|
||||||
),
|
),
|
||||||
'shorten_weekdays_in_list' => true,
|
|
||||||
'shorten_weekdays_days' => 'ימים ',
|
|
||||||
'weekdays_shortened_for_list' => array(
|
|
||||||
1 => "שני",
|
|
||||||
2 => "שלישי",
|
|
||||||
3 => "רביעי",
|
|
||||||
4 => "חמישי",
|
|
||||||
5 => "שישי",
|
|
||||||
6 => "שבת",
|
|
||||||
7 => "ראשון",
|
|
||||||
),
|
|
||||||
'nth_weekday' => array(
|
'nth_weekday' => array(
|
||||||
'1' => '%{weekday} הראשון', // e.g. the first Monday
|
'1' => '%{weekday} הראשון', // e.g. the first Monday
|
||||||
'2' => '%{weekday} השני',
|
'2' => '%{weekday} השני',
|
||||||
'3' => '%{weekday} השלישי',
|
'3' => '%{weekday} השלישי',
|
||||||
'4' => '%{weekday} הרביעי',
|
'4' => '%{weekday} הרביעי',
|
||||||
'5' => '%{weekday} החמישי',
|
'5' => '%{weekday} החמישי',
|
||||||
'6' => '%{weekday} השישי',
|
'6' => '%{weekday} השישי',
|
||||||
'7' => '%{weekday} השביעי',
|
'7' => '%{weekday} השביעי',
|
||||||
'8' => '%{weekday} השמיני',
|
'8' => '%{weekday} השמיני',
|
||||||
'9' => '%{weekday} התשיעי',
|
'9' => '%{weekday} התשיעי',
|
||||||
'10' => '%{weekday} העשירי',
|
'10' => '%{weekday} העשירי',
|
||||||
'else' => '%{weekday} ה-%{n}'
|
'else' => '%{weekday} ה-%{n}'
|
||||||
),
|
),
|
||||||
'-nth_weekday' => array(
|
'-nth_weekday' => array(
|
||||||
@ -133,13 +128,13 @@ return array(
|
|||||||
'1' => 'הראשון',
|
'1' => 'הראשון',
|
||||||
'2' => 'השני',
|
'2' => 'השני',
|
||||||
'3' => 'השלישי',
|
'3' => 'השלישי',
|
||||||
'4' => 'הרביעי',
|
'4' => 'הרביעי',
|
||||||
'5' => 'החמישי',
|
'5' => 'החמישי',
|
||||||
'6' => 'השישי',
|
'6' => 'השישי',
|
||||||
'7' => 'השביעי',
|
'7' => 'השביעי',
|
||||||
'8' => 'השמיני',
|
'8' => 'השמיני',
|
||||||
'9' => 'התשיעי',
|
'9' => 'התשיעי',
|
||||||
'10' => 'העשירי',
|
'10' => 'העשירי',
|
||||||
'else' => 'ה-%{n}'
|
'else' => 'ה-%{n}'
|
||||||
),
|
),
|
||||||
'-nth_yearday' => array(
|
'-nth_yearday' => array(
|
||||||
@ -165,22 +160,22 @@ return array(
|
|||||||
'nth_second' => '%{n}',
|
'nth_second' => '%{n}',
|
||||||
'bysetpos' => ', אבל רק %{setpos} פעמים בסדרה זו',
|
'bysetpos' => ', אבל רק %{setpos} פעמים בסדרה זו',
|
||||||
'nth_setpos' => array(
|
'nth_setpos' => array(
|
||||||
'1' => 'הראשון',
|
'1' => 'הראשון',
|
||||||
'2' => 'השני',
|
'2' => 'השני',
|
||||||
'3' => 'השלישי',
|
'3' => 'השלישי',
|
||||||
'4' => 'הרביעי',
|
'4' => 'הרביעי',
|
||||||
'5' => 'החמישי',
|
'5' => 'החמישי',
|
||||||
'6' => 'השישי',
|
'6' => 'השישי',
|
||||||
'7' => 'השביעי',
|
'7' => 'השביעי',
|
||||||
'8' => 'השמיני',
|
'8' => 'השמיני',
|
||||||
'9' => 'התשיעי',
|
'9' => 'התשיעי',
|
||||||
'10' => 'העשירי',
|
'10' => 'העשירי',
|
||||||
'else' => 'ה-%{n}'
|
'else' => 'ה-%{n}'
|
||||||
),
|
),
|
||||||
'-nth_setpos' => array(
|
'-nth_setpos' => array(
|
||||||
'-1' => 'האחרון',
|
'-1' => 'האחרון',
|
||||||
'-2' => 'לפני האחרון',
|
'-2' => 'לפני האחרון',
|
||||||
'-3' => 'שניים לפני האחרון',
|
'-3' => 'שניים לפני האחרון',
|
||||||
'else' => 'ה %{n} מהסוף'
|
'else' => 'ה %{n} מהסוף'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -57,7 +57,7 @@ return array(
|
|||||||
'1' => ', ett tillfälle',
|
'1' => ', ett tillfälle',
|
||||||
'else' => ', %{count} tillfällen'
|
'else' => ', %{count} tillfällen'
|
||||||
),
|
),
|
||||||
'and' => 'och',
|
'and' => 'och ',
|
||||||
'x_of_the_y' => array(
|
'x_of_the_y' => array(
|
||||||
'yearly' => '%{x} på året', // ex. den första måndagen på året, eller den första dagen på året, e.g. the first Monday of the year, or the first day of the year
|
'yearly' => '%{x} på året', // ex. den första måndagen på året, eller den första dagen på året, e.g. the first Monday of the year, or the first day of the year
|
||||||
'monthly' => '%{x} i månaden',
|
'monthly' => '%{x} i månaden',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user