Use local context to get messages
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Thu, 5 Apr 2012 19:39:22 +0000 (21:39 +0200)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Thu, 5 Apr 2012 19:40:54 +0000 (21:40 +0200)
Change-Id: I73e0d08f684c67ec5257953eadfda3acdfa4e71f

includes/specials/SpecialMovepage.php

index 393cf7e..6b817d2 100644 (file)
@@ -141,13 +141,13 @@ class MovePageForm extends UnlistedSpecialPage {
                        && $newTitle->quickUserCan( 'delete', $user )
                ) {
                        $out->addWikiMsg( 'delete_and_move_text', $newTitle->getPrefixedText() );
-                       $movepagebtn = wfMsg( 'delete_and_move' );
+                       $movepagebtn = $this->msg( 'delete_and_move' )->text();
                        $submitVar = 'wpDeleteAndMove';
                        $confirm = "
                                <tr>
                                        <td></td>
                                        <td class='mw-input'>" .
-                                               Xml::checkLabel( wfMsg( 'delete_and_move_confirm' ), 'wpConfirm', 'wpConfirm' ) .
+                                               Xml::checkLabel( $this->msg( 'delete_and_move_confirm' )->text(), 'wpConfirm', 'wpConfirm' ) .
                                        "</td>
                                </tr>";
                        $err = array();
@@ -157,7 +157,7 @@ class MovePageForm extends UnlistedSpecialPage {
                        }
                        $out->addWikiMsg( $wgFixDoubleRedirects ? 'movepagetext' :
                                'movepagetext-noredirectfixer' );
-                       $movepagebtn = wfMsg( 'movepagebtn' );
+                       $movepagebtn = $this->msg( 'movepagebtn' )->text();
                        $submitVar = 'wpMove';
                        $confirm = false;
                }
@@ -249,11 +249,11 @@ class MovePageForm extends UnlistedSpecialPage {
                $out->addHTML(
                         Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getTitle()->getLocalURL( 'action=submit' ), 'id' => 'movepage' ) ) .
                         Xml::openElement( 'fieldset' ) .
-                        Xml::element( 'legend', null, wfMsg( 'move-page-legend' ) ) .
+                        Xml::element( 'legend', null, $this->msg( 'move-page-legend' )->text() ) .
                         Xml::openElement( 'table', array( 'border' => '0', 'id' => 'mw-movepage-table' ) ) .
                         "<tr>
                                <td class='mw-label'>" .
-                                       wfMsgHtml( 'movearticle' ) .
+                                       $this->msg( 'movearticle' )->escaped() .
                                "</td>
                                <td class='mw-input'>
                                        <strong>{$oldTitleLink}</strong>
@@ -261,7 +261,7 @@ class MovePageForm extends UnlistedSpecialPage {
                        </tr>
                        <tr>
                                <td class='mw-label'>" .
-                                       Xml::label( wfMsg( 'newtitle' ), 'wpNewTitleMain' ) .
+                                       Xml::label( $this->msg( 'newtitle' )->text(), 'wpNewTitleMain' ) .
                                "</td>
                                <td class='mw-input'>" .
                                        Html::namespaceSelector(
@@ -278,7 +278,7 @@ class MovePageForm extends UnlistedSpecialPage {
                        </tr>
                        <tr>
                                <td class='mw-label'>" .
-                                       Xml::label( wfMsg( 'movereason' ), 'wpReason' ) .
+                                       Xml::label( $this->msg( 'movereason' )->text(), 'wpReason' ) .
                                "</td>
                                <td class='mw-input'>" .
                                        Html::element( 'textarea', array( 'name' => 'wpReason', 'id' => 'wpReason', 'cols' => 60, 'rows' => 2,
@@ -292,7 +292,7 @@ class MovePageForm extends UnlistedSpecialPage {
                                <tr>
                                        <td></td>
                                        <td class='mw-input'>" .
-                                               Xml::checkLabel( wfMsg( 'movetalk' ), 'wpMovetalk', 'wpMovetalk', $this->moveTalk ) .
+                                               Xml::checkLabel( $this->msg( 'movetalk' )->text(), 'wpMovetalk', 'wpMovetalk', $this->moveTalk ) .
                                        "</td>
                                </tr>"
                        );
@@ -303,7 +303,7 @@ class MovePageForm extends UnlistedSpecialPage {
                                <tr>
                                        <td></td>
                                        <td class='mw-input' >" .
-                                               Xml::checkLabel( wfMsg( 'move-leave-redirect' ), 'wpLeaveRedirect',
+                                               Xml::checkLabel( $this->msg( 'move-leave-redirect' )->text(), 'wpLeaveRedirect',
                                                        'wpLeaveRedirect', $this->leaveRedirect ) .
                                        "</td>
                                </tr>"
@@ -315,7 +315,7 @@ class MovePageForm extends UnlistedSpecialPage {
                                <tr>
                                        <td></td>
                                        <td class='mw-input' >" .
-                                               Xml::checkLabel( wfMsg( 'fix-double-redirects' ), 'wpFixRedirects',
+                                               Xml::checkLabel( $this->msg( 'fix-double-redirects' )->text(), 'wpFixRedirects',
                                                        'wpFixRedirects', $this->fixRedirects ) .
                                        "</td>
                                </tr>"
@@ -335,15 +335,11 @@ class MovePageForm extends UnlistedSpecialPage {
                                        array( 'id' => 'wpMovesubpages' )
                                ) . '&#160;' .
                                Xml::tags( 'label', array( 'for' => 'wpMovesubpages' ),
-                                       wfMsgExt(
+                                       $this->msg(
                                                ( $this->oldTitle->hasSubpages()
                                                        ? 'move-subpages'
-                                                       : 'move-talk-subpages' ),
-                                               array( 'parseinline' ),
-                                               $this->getLanguage()->formatNum( $wgMaximumMovedPages ),
-                                               # $2 to allow use of PLURAL in message.
-                                               $wgMaximumMovedPages
-                                       )
+                                                       : 'move-talk-subpages' )
+                                               )->numParams( $wgMaximumMovedPages )->params( $wgMaximumMovedPages )->parse()
                                ) .
                                        "</td>
                                </tr>"
@@ -358,7 +354,7 @@ class MovePageForm extends UnlistedSpecialPage {
                        <tr>
                                <td></td>
                                <td class='mw-input'>" .
-                                       Xml::checkLabel( wfMsg( 'move-watch' ), 'wpWatch', 'watch', $watchChecked ) .
+                                       Xml::checkLabel( $this->msg( 'move-watch' )->text(), 'wpWatch', 'watch', $watchChecked ) .
                                "</td>
                        </tr>");
                }
@@ -421,7 +417,7 @@ class MovePageForm extends UnlistedSpecialPage {
                                return;
                        }
 
-                       $reason = wfMessage( 'delete_and_move_reason', $ot )->inContentLanguage()->text();
+                       $reason = $this->msg( 'delete_and_move_reason', $ot )->inContentLanguage()->text();
 
                        // Delete an associated image if there is
                        if ( $nt->getNamespace() == NS_FILE ) {
@@ -472,7 +468,7 @@ class MovePageForm extends UnlistedSpecialPage {
                $newText = $nt->getPrefixedText();
 
                $msgName = $createRedirect ? 'movepage-moved-redirect' : 'movepage-moved-noredirect';
-               $out->addHTML( wfMessage( 'movepage-moved' )->rawParams( $oldLink,
+               $out->addHTML( $this->msg( 'movepage-moved' )->rawParams( $oldLink,
                        $newLink )->params( $oldText, $newText )->parseAsBlock() );
                $out->addWikiMsg( $msgName );
 
@@ -562,15 +558,15 @@ class MovePageForm extends UnlistedSpecialPage {
                        $newSubpage = Title::makeTitleSafe( $newNs, $newPageName );
                        if( !$newSubpage ) {
                                $oldLink = Linker::linkKnown( $oldSubpage );
-                               $extraOutput []= wfMsgHtml( 'movepage-page-unmoved', $oldLink,
-                                       htmlspecialchars(Title::makeName( $newNs, $newPageName )));
+                               $extraOutput []= $this->msg( 'movepage-page-unmoved' )->rawParams( $oldLink
+                                       )->params( Title::makeName( $newNs, $newPageName ) )->escaped();
                                continue;
                        }
 
                        # This was copy-pasted from Renameuser, bleh.
                        if ( $newSubpage->exists() && !$oldSubpage->isValidMoveTarget( $newSubpage ) ) {
                                $link = Linker::linkKnown( $newSubpage );
-                               $extraOutput []= wfMsgHtml( 'movepage-page-exists', $link );
+                               $extraOutput []= $this->msg( 'movepage-page-exists' )->rawParams( $link )->escaped();
                        } else {
                                $success = $oldSubpage->moveTo( $newSubpage, true, $this->reason, $createRedirect );
                                if( $success === true ) {
@@ -584,16 +580,16 @@ class MovePageForm extends UnlistedSpecialPage {
                                                array( 'redirect' => 'no' )
                                        );
                                        $newLink = Linker::linkKnown( $newSubpage );
-                                       $extraOutput []= wfMsgHtml( 'movepage-page-moved', $oldLink, $newLink );
+                                       $extraOutput []= $this->msg( 'movepage-page-moved' )->rawParams( $oldLink, $newLink )->escaped();
                                        ++$count;
                                        if( $count >= $wgMaximumMovedPages ) {
-                                               $extraOutput []= wfMsgExt( 'movepage-max-pages', array( 'parsemag', 'escape' ), $this->getLanguage()->formatNum( $wgMaximumMovedPages ) );
+                                               $extraOutput []= $this->msg( 'movepage-max-pages' )->numParams( $wgMaximumMovedPages )->escaped();
                                                break;
                                        }
                                } else {
                                        $oldLink = Linker::linkKnown( $oldSubpage );
                                        $newLink = Linker::link( $newSubpage );
-                                       $extraOutput []= wfMsgHtml( 'movepage-page-unmoved', $oldLink, $newLink );
+                                       $extraOutput []= $this->msg( 'movepage-page-unmoved' )->rawParams( $oldLink, $newLink )->escaped();
                                }
                        }