From 99b4430f306a89fecca5c39c66d7388462e71cf6 Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 30 Aug 2012 14:27:40 +0200 Subject: [PATCH] Fix for section title when creating new talk page Includes some cleanup for WikitextContent::addSectionHeader, etc Change-Id: I61e6ee79d25914c8d7ea9e16ae717dc1f0eba5ac --- includes/Content.php | 10 +++++++--- includes/EditPage.php | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/includes/Content.php b/includes/Content.php index 8dfcd1c6e0..d2fce059a0 100644 --- a/includes/Content.php +++ b/includes/Content.php @@ -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 ); } diff --git a/includes/EditPage.php b/includes/EditPage.php index 98b4d4d39f..db00aeb739 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -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 ); -- 2.20.1