Fix for section title when creating new talk page
authordaniel <daniel.kinzler@wikimedia.de>
Thu, 30 Aug 2012 12:27:40 +0000 (14:27 +0200)
committerdaniel <daniel.kinzler@wikimedia.de>
Thu, 30 Aug 2012 12:27:40 +0000 (14:27 +0200)
Includes some cleanup for WikitextContent::addSectionHeader, etc

Change-Id: I61e6ee79d25914c8d7ea9e16ae717dc1f0eba5ac

includes/Content.php
includes/EditPage.php

index 8dfcd1c..d2fce05 100644 (file)
@@ -1028,7 +1028,9 @@ class WikitextContent extends TextContent {
                } if ( $section == 'new' ) {
                        # Inserting a new section
                        if ( $sectionTitle ) {
-                               $subject = wfMsgForContent( 'newsectionheaderdefaultlevel', $sectionTitle ) . "\n\n";
+                               $subject = wfMessage( 'newsectionheaderdefaultlevel' )
+                                                       ->inContentLanguage()->params( $sectionTitle )->text();
+                               $subject .= "\n\n";
                        } else {
                                $subject = '';
                        }
@@ -1058,8 +1060,10 @@ class WikitextContent extends TextContent {
         * @return Content
         */
        public function addSectionHeader( $header ) {
-               $text = wfMsgForContent( 'newsectionheaderdefaultlevel', $header ) . "\n\n" . 
-                       $this->getNativeData();
+               $text = wfMessage( 'newsectionheaderdefaultlevel' )
+                               ->inContentLanguage()->params( $header )->text();
+               $text .= "\n\n";
+               $text .= $this->getNativeData();
 
                return new WikitextContent( $text );
        }
index 98b4d4d..db00aeb 100644 (file)
@@ -1377,7 +1377,7 @@ class EditPage {
                                        }
                                } elseif ( $this->summary !== '' ) {
                                        // Insert the section title above the content.
-                                       $content = $content->addSectionHeader( $this->sectiontitle );
+                                       $content = $content->addSectionHeader( $this->summary );
 
                                        // Jump to the new section
                                        $result['sectionanchor'] = $wgParser->guessLegacySectionNameFromWikiText( $this->summary );