* Bug 16484 Remove an unneeded extra comma in user rights log (and other lists)
authorRaimond Spekking <raymond@users.mediawiki.org>
Sat, 27 Dec 2008 19:58:11 +0000 (19:58 +0000)
committerRaimond Spekking <raymond@users.mediawiki.org>
Sat, 27 Dec 2008 19:58:11 +0000 (19:58 +0000)
** Removed the comma from MediaWiki:and (@Translatewiki staff: no fuzzying needed)
** Special case for two messages in log
** Function description updated
Based on a patch by Nakon

CREDITS
languages/Language.php
languages/messages/MessagesEn.php

diff --git a/CREDITS b/CREDITS
index 6590f09..d9846fb 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -69,6 +69,7 @@ following names for their contribution to the product.
 * Michael De La Rue
 * Mike Horvath
 * Mormegil
+* Nakon
 * Nathan Larson
 * Nikolaos S. Karastathis
 * Olaf Lenz
index 26554be..e161298 100644 (file)
@@ -1938,26 +1938,33 @@ class Language {
 
 
        /**
-        * For the credit list in includes/Credits.php (action=credits)
+        * Take a list of strings and build a locale-friendly comma-separated
+        * list, using the local comma-separator message.
+        * The last two strings are chained with an "and".
         *
         * @param $l Array
         * @return string
         */
        function listToText( $l ) {
                $s = '';
-               $m = count($l) - 1;
-               for ($i = $m; $i >= 0; $i--) {
-                       if ($i == $m) {
-                               $s = $l[$i];
-                       } else if ($i == $m - 1) {
-                               $s = $l[$i] . $this->getMessageFromDB( 'and' ) . $this->getMessageFromDB( 'word-separator' ) . $s;
-                       } else {
-                               $s = $l[$i] . $this->getMessageFromDB( 'comma-separator' ) . $s;
+               $m = count( $l ) - 1;
+               if( $m == 1 ) {
+                       return $l[0] . $this->getMessageFromDB( 'and' ) . $this->getMessageFromDB( 'word-separator' ) . $l[1];
+               }
+               else {
+                       for ( $i = $m; $i >= 0; $i-- ) {
+                               if ( $i == $m ) {
+                                       $s = $l[$i];
+                               } else if( $i == $m - 1 ) {
+                                       $s = $l[$i] . $this->getMessageFromDB( 'and' ) . $this->getMessageFromDB( 'word-separator' ) . $s;
+                               } else {
+                                       $s = $l[$i] . $this->getMessageFromDB( 'comma-separator' ) . $s;
+                               }
                        }
+                       return $s;
                }
-               return $s;
        }
-       
+
        /**
         * Take a list of strings and build a locale-friendly comma-separated
         * list, using the local comma-separator message.
index 3d8ec64..78e8a2d 100644 (file)
@@ -629,7 +629,7 @@ XHTML id names.
 'mytalk'         => 'My talk',
 'anontalk'       => 'Talk for this IP',
 'navigation'     => 'Navigation',
-'and'            => ',&#32;and',
+'and'            => '&#32;and',
 
 # Metadata in edit box
 'metadata_help' => 'Metadata:',