* Add $forContent option to Language::commaList
authorChad Horohoe <demon@users.mediawiki.org>
Tue, 30 Sep 2008 16:24:23 +0000 (16:24 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Tue, 30 Sep 2008 16:24:23 +0000 (16:24 +0000)
* Add pipeList() for similar lists separated by pipes
* More docs.

languages/Language.php
languages/messages/MessagesEn.php
maintenance/language/messageTypes.inc
maintenance/language/messages.inc

index fa485d1..4c878d0 100644 (file)
@@ -1902,12 +1902,34 @@ class Language {
        /**
         * Take a list of strings and build a locale-friendly comma-separated
         * list, using the local comma-separator message.
-        * @fixme Fix this so it can work for $wgContLang too
+        * @param $list array of strings to put in a comma list
+        * @param $forContent bool Use $wgContentLang instead of the UI lang
+        * @return string
+        */
+       function commaList( $list, $forContent = false ) {
+               $params = array( 'escapenoentities' );
+               if ( $forContent === true ) {
+                       $params[] = 'content';
+               }
+               return implode(
+                       $list,
+                       wfMsgExt( 'comma-separator', $params ) );
+       }
+       
+       /**
+        * Same as commaList, but separate it with the pipe instead.
+        * @param $list array of strings to put in a pipe list
+        * @param $forContent bool Use $wgContentLang instead of the UI lang
+        * @return string
         */
-       function commaList( $list ) {
+       function pipeList( $list, $forContent = false ) {
+               $params = array( 'escapenoentities' );
+               if ( $forContent === true ) {
+                       $params[] = 'content';
+               }
                return implode(
                        $list,
-                       wfMsgExt( 'comma-separator', 'escapenoentities' ) );
+                       wfMsgExt( 'pipe-separator', $params ) );
        }
 
        /**
index 2dbefc6..7f66051 100644 (file)
@@ -3437,6 +3437,7 @@ $1',
 'comma-separator'     => ',&#32;', # only translate this message to other languages if you have to change it
 'colon-separator'     => ':&#32;', # only translate this message to other languages if you have to change it
 'autocomment-prefix'  => '-&#32;', # only translate this message to other languages if you have to change it
+'pipe-separator'      => '|', # only translate this message to other languages if you have to change it
 
 # Multipage image navigation
 'imgmultipageprev' => '← previous page',
index 1feeeb1..6b77ec9 100644 (file)
@@ -315,6 +315,7 @@ $wgOptionalMessages = array(
        'comma-separator',
        'colon-separator',
        'autocomment-prefix',
+       'pipe-separator',
        'listgrouprights-right-display',
        'timezone-utc',
        'whatlinkshere-backlink',
index 91ccfc2..2cfbb9a 100644 (file)
@@ -2566,6 +2566,7 @@ $wgMessageStructure = array(
                'comma-separator',
                'colon-separator',
                'autocomment-prefix',
+               'pipe-separator',
        ),
        'imgmulti' => array(
                'imgmultipageprev',