Apply conversion on namespace names on Special:Search
authorLiangent <liangent@gmail.com>
Thu, 14 Mar 2013 15:26:29 +0000 (23:26 +0800)
committerSiebrand Mazeland <s.mazeland@xs4all.nl>
Thu, 8 Aug 2013 08:17:35 +0000 (10:17 +0200)
Change-Id: I2dc8d1a28dd6b273a63dc6e5a06d3c18c720b3f7

includes/specials/SpecialSearch.php

index 8a2163b..4182846 100644 (file)
@@ -875,6 +875,8 @@ class SpecialSearch extends SpecialPage {
         * @return String: HTML form
         */
        protected function powerSearchBox( $term, $opts ) {
+               global $wgContLang;
+
                // Groups namespaces into rows according to subject
                $rows = array();
                foreach ( SearchEngine::searchableNamespaces() as $namespace => $name ) {
@@ -882,10 +884,12 @@ class SpecialSearch extends SpecialPage {
                        if ( !array_key_exists( $subject, $rows ) ) {
                                $rows[$subject] = "";
                        }
-                       $name = str_replace( '_', ' ', $name );
+
+                       $name = $wgContLang->getConverter()->convertNamespace( $namespace );
                        if ( $name == '' ) {
                                $name = $this->msg( 'blanknamespace' )->text();
                        }
+
                        $rows[$subject] .=
                                Xml::openElement(
                                        'td', array( 'style' => 'white-space: nowrap' )
@@ -898,6 +902,7 @@ class SpecialSearch extends SpecialPage {
                                ) .
                                Xml::closeElement( 'td' );
                }
+
                $rows = array_values( $rows );
                $numRows = count( $rows );
 
@@ -909,9 +914,11 @@ class SpecialSearch extends SpecialPage {
                                'table',
                                array( 'cellpadding' => 0, 'cellspacing' => 0 )
                        );
+
                        for ( $j = $i; $j < $i + 4 && $j < $numRows; $j++ ) {
                                $namespaceTables .= Xml::tags( 'tr', null, $rows[$j] );
                        }
+
                        $namespaceTables .= Xml::closeElement( 'table' );
                }