Fix for r41430: wfMsgExt() now accepts a Language object in the language key of ...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Tue, 30 Sep 2008 17:15:11 +0000 (17:15 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Tue, 30 Sep 2008 17:15:11 +0000 (17:15 +0000)
includes/GlobalFunctions.php
languages/Language.php

index 4ceb2c7..3119d22 100644 (file)
@@ -676,9 +676,9 @@ function wfMsgWikiHtml( $key ) {
  *   <i>parsemag</i>: transform the message using magic phrases
  *   <i>content</i>: fetch message for content language instead of interface
  * Also can accept a single associative argument, of the form 'language' => 'xx':
- *   <i>language</i>: language code to fetch message for (overriden by
- *       <i>content</i>), its behaviour with parser, parseinline and parsemag
- *       is undefined.
+ *   <i>language</i>: Language object or language code to fetch message for
+ *       (overriden by <i>content</i>), its behaviour with parser, parseinline
+ *       and parsemag is undefined.
  * Behavior for conflicting options (e.g., parse+parseinline) is undefined.
  */
 function wfMsgExt( $key, $options ) {
@@ -706,12 +706,7 @@ function wfMsgExt( $key, $options ) {
                $langCode = true;
        } elseif( array_key_exists('language', $options) ) {
                $forContent = false;
-               $langCode = $options['language'];
-               $validCodes = array_keys( Language::getLanguageNames() );
-               if( !in_array($options['language'], $validCodes) ) {
-                       # Fallback to en, instead of whatever interface language we might have
-                       $langCode = 'en';
-               }
+               $langCode = wfGetLangObj( $options['language'] );
        } else {
                $forContent = false;
                $langCode = false;
index 4c878d0..4aebb0c 100644 (file)
@@ -1903,33 +1903,23 @@ class Language {
         * Take a list of strings and build a locale-friendly comma-separated
         * list, using the local comma-separator message.
         * @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 ) );
+                       wfMsgExt( 'comma-separator', array( 'escapenoentities', 'language' => $this ) ) );
        }
        
        /**
         * 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 pipeList( $list, $forContent = false ) {
-               $params = array( 'escapenoentities' );
-               if ( $forContent === true ) {
-                       $params[] = 'content';
-               }
+       function pipeList( $list ) {
                return implode(
                        $list,
-                       wfMsgExt( 'pipe-separator', $params ) );
+                       wfMsgExt( 'pipe-separator', array( 'escapenoentities', 'language' => $this ) ) );
        }
 
        /**