r45101 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45100‎ | r45101 | r45102 >
Date:19:58, 27 December 2008
Author:raymond
Status:ok
Tags:
Comment:
* Bug 16484 Remove an unneeded extra comma in user rights log (and other lists)
** 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
Modified paths:
  • /trunk/phase3/CREDITS (modified) (history)
  • /trunk/phase3/languages/Language.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/CREDITS
@@ -69,6 +69,7 @@
7070 * Michael De La Rue
7171 * Mike Horvath
7272 * Mormegil
 73+* Nakon
7374 * Nathan Larson
7475 * Nikolaos S. Karastathis
7576 * Olaf Lenz
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -629,7 +629,7 @@
630630 'mytalk' => 'My talk',
631631 'anontalk' => 'Talk for this IP',
632632 'navigation' => 'Navigation',
633 -'and' => ', and',
 633+'and' => ' and',
634634
635635 # Metadata in edit box
636636 'metadata_help' => 'Metadata:',
Index: trunk/phase3/languages/Language.php
@@ -1938,26 +1938,33 @@
19391939
19401940
19411941 /**
1942 - * For the credit list in includes/Credits.php (action=credits)
 1942+ * Take a list of strings and build a locale-friendly comma-separated
 1943+ * list, using the local comma-separator message.
 1944+ * The last two strings are chained with an "and".
19431945 *
19441946 * @param $l Array
19451947 * @return string
19461948 */
19471949 function listToText( $l ) {
19481950 $s = '';
1949 - $m = count($l) - 1;
1950 - for ($i = $m; $i >= 0; $i--) {
1951 - if ($i == $m) {
1952 - $s = $l[$i];
1953 - } else if ($i == $m - 1) {
1954 - $s = $l[$i] . $this->getMessageFromDB( 'and' ) . $this->getMessageFromDB( 'word-separator' ) . $s;
1955 - } else {
1956 - $s = $l[$i] . $this->getMessageFromDB( 'comma-separator' ) . $s;
 1951+ $m = count( $l ) - 1;
 1952+ if( $m == 1 ) {
 1953+ return $l[0] . $this->getMessageFromDB( 'and' ) . $this->getMessageFromDB( 'word-separator' ) . $l[1];
 1954+ }
 1955+ else {
 1956+ for ( $i = $m; $i >= 0; $i-- ) {
 1957+ if ( $i == $m ) {
 1958+ $s = $l[$i];
 1959+ } else if( $i == $m - 1 ) {
 1960+ $s = $l[$i] . $this->getMessageFromDB( 'and' ) . $this->getMessageFromDB( 'word-separator' ) . $s;
 1961+ } else {
 1962+ $s = $l[$i] . $this->getMessageFromDB( 'comma-separator' ) . $s;
 1963+ }
19571964 }
 1965+ return $s;
19581966 }
1959 - return $s;
19601967 }
1961 -
 1968+
19621969 /**
19631970 * Take a list of strings and build a locale-friendly comma-separated
19641971 * list, using the local comma-separator message.

Status & tagging log