fix translation bug for likers

This commit is contained in:
rabuzarus 2015-10-14 19:48:57 +02:00
parent c855c9ba67
commit 642f3fca1a

View file

@ -1025,26 +1025,9 @@ function format_like($cnt,$arr,$type,$id) {
$o = '';
$expanded = '';
if($cnt == 1)
if($cnt == 1) {
$likers = $arr[0];
else {
$total = count($arr);
if($total >= MAX_LIKERS)
$arr = array_slice($arr, 0, MAX_LIKERS - 1);
if($total < MAX_LIKERS) {
$last = t('and') . ' ' . $arr[count($arr)-1];
$arr2 = array_slice($arr, 0, -1);
$str = implode(', ', $arr2) . ' ' . $last;
}
if($total >= MAX_LIKERS) {
$str = implode(', ', $arr);
$str .= sprintf( t(', and %d other people'), $total - MAX_LIKERS );
}
$likers = $str;
}
// Phrase if there is only one liker. In other cases it will be uses for the expanded
// list which show all likers
switch($type) {
@ -1064,34 +1047,50 @@ function format_like($cnt,$arr,$type,$id) {
$phrase = sprintf( t('%s attends maybe.'), $likers);
break;
}
}
if($cnt > 1) {
$total = count($arr);
if($total >= MAX_LIKERS)
$arr = array_slice($arr, 0, MAX_LIKERS - 1);
if($total < MAX_LIKERS) {
$last = t('and') . ' ' . $arr[count($arr)-1];
$arr2 = array_slice($arr, 0, -1);
$str = implode(', ', $arr2) . ' ' . $last;
}
if($total >= MAX_LIKERS) {
$str = implode(', ', $arr);
$str .= sprintf( t(', and %d other people'), $total - MAX_LIKERS );
}
$likers = $str;
$spanatts = "class=\"fakelink\" onclick=\"openClose('{$type}list-$id');\"";
$expanded .= "\t" . '<div class="wall-item-' . $type . '-expanded" id="' . $type . 'list-' . $id . '" style="display: none;" >' . $phrase . EOL . '</div>';
switch($type) {
case 'like':
$phrase = sprintf( t('<span %1$s>%2$d people</span> like this'), $spanatts, $cnt);
$explikers = sprintf( t('%s like this.'), $likers);
break;
case 'dislike':
$phrase = sprintf( t('<span %1$s>%2$d people</span> don\'t like this'), $spanatts, $cnt);
$explikers = sprintf( t('%s don\'t like this.'), $likers);
break;
case 'attendyes':
$phrase = sprintf( t('<span %1$s>%2$d people</span> attend'), $spanatts, $cnt);
$explikers = sprintf( t('%s attend.'), $likers);
break;
case 'attendno':
$phrase = sprintf( t('<span %1$s>%2$d people</span> don\'t attend'), $spanatts, $cnt);
$explikers = sprintf( t('%s don\'t attend.'), $likers);
break;
case 'attendmaybe':
$phrase = sprintf( t('<span %1$s>%2$d people</span> anttend maybe'), $spanatts, $cnt);
case 'agree':
$phrase = sprintf( t('<span %1$s>%2$d people</span> agree'), $spanatts, $cnt);
$explikers = sprintf( t('%s anttend maybe.'), $likers);
break;
case 'disagree':
$phrase = sprintf( t('<span %1$s>%2$d people</span> don\'t agree'), $spanatts, $cnt);
break;
case 'abstain':
$phrase = sprintf( t('<span %1$s>%2$d people</span> abstains'), $spanatts, $cnt);
}
$expanded .= "\t" . '<div class="wall-item-' . $type . '-expanded" id="' . $type . 'list-' . $id . '" style="display: none;" >' . $explikers . EOL . '</div>';
}
$phrase .= EOL ;