Commit 58d39153 authored by Brion Vibber's avatar Brion Vibber

Favored lists in progress: 'foo, bar and baz'

parent 6c236ab0
......@@ -361,12 +361,12 @@ class ThreadedNoticeListFavesItem extends NoticeListItem
$count = count($links);
if ($count == 1 && $you) {
// darn first person being different from third person!
$msg = _m('FAVELIST', 'You have favored this notice');
$msg = _m('FAVELIST', 'You have favored this notice.');
} else {
// if 'you' is the first item...
$msg = _m('FAVELIST', '%1$s has favored this notice', '%1$s have favored this notice', $count);
// if 'you' is the first item,
$msg = _m('FAVELIST', '%1$s has favored this notice.', '%1$s have favored this notice.', $count);
}
$out = sprintf($msg, implode(', ', $links));
$out = sprintf($msg, $this->magicList($links));
$this->out->elementStart('li', array('class' => 'notice-faves'));
$this->out->raw($out);
......@@ -376,4 +376,18 @@ class ThreadedNoticeListFavesItem extends NoticeListItem
return 0;
}
}
function magicList($items)
{
if (count($items) == 0) {
return '';
} else if (count($items) == 1) {
return $items[0];
} else {
$first = array_slice($items, 0, -1);
$last = array_slice($items, -1, 1);
// TRANS For building a list such as "You, bob, mary and 5 others have favored this notice".
return sprintf(_m('FAVELIST', '%1$s and %2$s'), implode(', ', $first), implode(', ', $last));
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment