mirror of
https://github.com/rlanvin/php-rrule.git
synced 2024-11-28 05:24:10 +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 `bin/review_translations.php` as a helper for translators and contributors
|
||||
- Added Hebrew translation [#95](https://github.com/rlanvin/php-rrule/pull/95)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix Finnish translation [#94](https://github.com/rlanvin/php-rrule/issues/94)
|
||||
- Update French translation
|
||||
- Update German translation
|
||||
|
||||
## [2.2.2] - 2021-01-09
|
||||
|
@ -1929,7 +1929,7 @@ class RRule implements RRuleInterface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
static protected function i18nList(array $array, $and = 'and')
|
||||
static protected function i18nList(array $array, $and = 'and ')
|
||||
{
|
||||
if (count($array) > 1) {
|
||||
$last = array_splice($array, -1);
|
||||
@ -2246,28 +2246,36 @@ class RRule implements RRuleInterface
|
||||
));
|
||||
$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'])) {
|
||||
$parts['byweekday'] = array();
|
||||
if ($this->byweekday) {
|
||||
$tmp = $this->byweekday;
|
||||
$shorten_weekdays_in_list = !empty($i18n['shorten_weekdays_in_list']) && count($tmp) > 1;
|
||||
if ($shorten_weekdays_in_list) {
|
||||
$daysnames = $i18n['weekdays_shortened_for_list'];
|
||||
}
|
||||
else {
|
||||
$daysnames = $i18n['weekdays'];
|
||||
}
|
||||
foreach ($tmp as & $value) {
|
||||
$value = $daysnames[$value];
|
||||
|
||||
$selector = 'weekdays';
|
||||
$days_names = $i18n['weekdays'];
|
||||
$prefix = '';
|
||||
if (!empty($i18n['shorten_weekdays_in_list']) && count($tmp) > 1) {
|
||||
// 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'];
|
||||
}
|
||||
$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(
|
||||
'%{weekdays}' => $prefix . self::i18nList($tmp, $i18n['and'])
|
||||
'%{weekdays}' => $prefix . self::i18nList($tmp, $i18n['and'])
|
||||
));
|
||||
}
|
||||
|
||||
if ($this->byweekday_nth) {
|
||||
$tmp = $this->byweekday_nth;
|
||||
foreach ($tmp as & $value) {
|
||||
|
103
src/i18n/he.php
103
src/i18n/he.php
@ -1,17 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Translation file for English 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.
|
||||
* Translation file for Hebrew language.
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
return array(
|
||||
@ -74,36 +69,36 @@ return array(
|
||||
),
|
||||
'byweekday' => ' ב%{weekdays}',
|
||||
'weekdays' => array(
|
||||
1 => "יום ב'",
|
||||
2 => "יום ג'",
|
||||
3 => "יום ד'",
|
||||
4 => "יום ה'",
|
||||
5 => "יום ו'",
|
||||
6 => "שבת",
|
||||
7 => "יום א'",
|
||||
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 => "ראשון",
|
||||
),
|
||||
'shorten_weekdays_in_list' => true,
|
||||
'shorten_weekdays_days' => 'ימים ',
|
||||
'weekdays_shortened_for_list' => array(
|
||||
1 => "שני",
|
||||
2 => "שלישי",
|
||||
3 => "רביעי",
|
||||
4 => "חמישי",
|
||||
5 => "שישי",
|
||||
6 => "שבת",
|
||||
7 => "ראשון",
|
||||
),
|
||||
'nth_weekday' => array(
|
||||
'1' => '%{weekday} הראשון', // e.g. the first Monday
|
||||
'2' => '%{weekday} השני',
|
||||
'3' => '%{weekday} השלישי',
|
||||
'4' => '%{weekday} הרביעי',
|
||||
'5' => '%{weekday} החמישי',
|
||||
'6' => '%{weekday} השישי',
|
||||
'7' => '%{weekday} השביעי',
|
||||
'8' => '%{weekday} השמיני',
|
||||
'9' => '%{weekday} התשיעי',
|
||||
'10' => '%{weekday} העשירי',
|
||||
'3' => '%{weekday} השלישי',
|
||||
'4' => '%{weekday} הרביעי',
|
||||
'5' => '%{weekday} החמישי',
|
||||
'6' => '%{weekday} השישי',
|
||||
'7' => '%{weekday} השביעי',
|
||||
'8' => '%{weekday} השמיני',
|
||||
'9' => '%{weekday} התשיעי',
|
||||
'10' => '%{weekday} העשירי',
|
||||
'else' => '%{weekday} ה-%{n}'
|
||||
),
|
||||
'-nth_weekday' => array(
|
||||
@ -133,13 +128,13 @@ return array(
|
||||
'1' => 'הראשון',
|
||||
'2' => 'השני',
|
||||
'3' => 'השלישי',
|
||||
'4' => 'הרביעי',
|
||||
'5' => 'החמישי',
|
||||
'6' => 'השישי',
|
||||
'7' => 'השביעי',
|
||||
'8' => 'השמיני',
|
||||
'9' => 'התשיעי',
|
||||
'10' => 'העשירי',
|
||||
'4' => 'הרביעי',
|
||||
'5' => 'החמישי',
|
||||
'6' => 'השישי',
|
||||
'7' => 'השביעי',
|
||||
'8' => 'השמיני',
|
||||
'9' => 'התשיעי',
|
||||
'10' => 'העשירי',
|
||||
'else' => 'ה-%{n}'
|
||||
),
|
||||
'-nth_yearday' => array(
|
||||
@ -165,22 +160,22 @@ return array(
|
||||
'nth_second' => '%{n}',
|
||||
'bysetpos' => ', אבל רק %{setpos} פעמים בסדרה זו',
|
||||
'nth_setpos' => array(
|
||||
'1' => 'הראשון',
|
||||
'2' => 'השני',
|
||||
'3' => 'השלישי',
|
||||
'4' => 'הרביעי',
|
||||
'5' => 'החמישי',
|
||||
'6' => 'השישי',
|
||||
'7' => 'השביעי',
|
||||
'8' => 'השמיני',
|
||||
'9' => 'התשיעי',
|
||||
'10' => 'העשירי',
|
||||
'else' => 'ה-%{n}'
|
||||
'1' => 'הראשון',
|
||||
'2' => 'השני',
|
||||
'3' => 'השלישי',
|
||||
'4' => 'הרביעי',
|
||||
'5' => 'החמישי',
|
||||
'6' => 'השישי',
|
||||
'7' => 'השביעי',
|
||||
'8' => 'השמיני',
|
||||
'9' => 'התשיעי',
|
||||
'10' => 'העשירי',
|
||||
'else' => 'ה-%{n}'
|
||||
),
|
||||
'-nth_setpos' => array(
|
||||
'-1' => 'האחרון',
|
||||
'-2' => 'לפני האחרון',
|
||||
'-3' => 'שניים לפני האחרון',
|
||||
'else' => 'ה %{n} מהסוף'
|
||||
'-1' => 'האחרון',
|
||||
'-2' => 'לפני האחרון',
|
||||
'-3' => 'שניים לפני האחרון',
|
||||
'else' => 'ה %{n} מהסוף'
|
||||
)
|
||||
);
|
||||
|
@ -57,7 +57,7 @@ return array(
|
||||
'1' => ', ett tillfälle',
|
||||
'else' => ', %{count} tillfällen'
|
||||
),
|
||||
'and' => 'och',
|
||||
'and' => 'och ',
|
||||
'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
|
||||
'monthly' => '%{x} i månaden',
|
||||
|
Loading…
Reference in New Issue
Block a user