jenkins-bot has submitted this change and it was merged. Change subject: EditPage: Generate all messages using $this->context so we have titles ......................................................................
EditPage: Generate all messages using $this->context so we have titles Change-Id: I5ba13f1677e1a1b4160e14357a483b5e1f11ea1c --- M includes/EditPage.php 1 file changed, 58 insertions(+), 56 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/EditPage.php b/includes/EditPage.php index 9d329e8..606b4cd 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -578,7 +578,7 @@ ) { $this->displayViewSourcePage( $this->getContentObject(), - wfMessage( + $this->context->msg( 'contentmodelediterror', $revision->getContentModel(), $this->contentModel @@ -715,7 +715,7 @@ Hooks::run( 'EditPage::showReadOnlyForm:initial', [ $this, &$wgOut ] ); $wgOut->setRobotPolicy( 'noindex,nofollow' ); - $wgOut->setPageTitle( wfMessage( + $wgOut->setPageTitle( $this->context->msg( 'viewsource-title', $this->getContextTitle()->getPrefixedText() ) ); @@ -1178,12 +1178,12 @@ if ( $firstrev && $firstrev->getId() == $undo ) { $userText = $undorev->getUserText(); if ( $userText === '' ) { - $undoSummary = wfMessage( + $undoSummary = $this->context->msg( 'undo-summary-username-hidden', $undo )->inContentLanguage()->text(); } else { - $undoSummary = wfMessage( + $undoSummary = $this->context->msg( 'undo-summary', $undo, $userText @@ -1192,7 +1192,7 @@ if ( $this->summary === '' ) { $this->summary = $undoSummary; } else { - $this->summary = $undoSummary . wfMessage( 'colon-separator' ) + $this->summary = $undoSummary . $this->context->msg( 'colon-separator' ) ->inContentLanguage()->text() . $this->summary; } $this->undidRev = $undo; @@ -1210,7 +1210,7 @@ // Messages: undo-success, undo-failure, undo-norev, undo-nochange $class = ( $undoMsg == 'success' ? '' : 'error ' ) . "mw-undo-{$undoMsg}"; $this->editFormPageTop .= $wgOut->parse( "<div class=\"{$class}\">" . - wfMessage( 'undo-' . $undoMsg )->plain() . '</div>', true, /* interface */true ); + $this->context->msg( 'undo-' . $undoMsg )->plain() . '</div>', true, /* interface */true ); } if ( $content === false ) { @@ -1674,7 +1674,7 @@ // passed. if ( $this->summary === '' ) { $cleanSectionTitle = $wgParser->stripSectionName( $this->sectiontitle ); - return wfMessage( 'newsectionsummary' ) + return $this->context->msg( 'newsectionsummary' ) ->rawParams( $cleanSectionTitle )->inContentLanguage()->text(); } } elseif ( $this->summary !== '' ) { @@ -1682,7 +1682,7 @@ # This is a new section, so create a link to the new section # in the revision summary. $cleanSummary = $wgParser->stripSectionName( $this->summary ); - return wfMessage( 'newsectionsummary' ) + return $this->context->msg( 'newsectionsummary' ) ->rawParams( $cleanSummary )->inContentLanguage()->text(); } return $this->summary; @@ -2357,7 +2357,7 @@ if ( $displayTitle === false ) { $displayTitle = $contextTitle->getPrefixedText(); } - $wgOut->setPageTitle( wfMessage( $msg, $displayTitle ) ); + $wgOut->setPageTitle( $this->context->msg( $msg, $displayTitle ) ); # Transmit the name of the message to JavaScript for live preview # Keep Resources.php/mediawiki.action.edit.preview in sync with the possible keys $wgOut->addJsConfigVars( [ @@ -2442,7 +2442,7 @@ # Try to add a custom edit intro, or use the standard one if this is not possible. if ( !$this->showCustomIntro() && !$this->mTitle->exists() ) { $helpLink = wfExpandUrl( Skin::makeInternalOrExternalUrl( - wfMessage( 'helppage' )->inContentLanguage()->text() + $this->context->msg( 'helppage' )->inContentLanguage()->text() ) ); if ( $wgUser->isLoggedIn() ) { $wgOut->wrapWikiMsg( @@ -2632,7 +2632,7 @@ . Html::rawElement( 'label', [ 'for' => 'wpAntispam' ], - wfMessage( 'simpleantispam-label' )->parse() + $this->context->msg( 'simpleantispam-label' )->parse() ) . Xml::element( 'input', @@ -2662,8 +2662,8 @@ : 'confirmrecreate'; $wgOut->addHTML( '<div class="mw-confirm-recreate">' . - wfMessage( $key, $username, "<nowiki>$comment</nowiki>" )->parse() . - Xml::checkLabel( wfMessage( 'recreate' )->text(), 'wpRecreate', 'wpRecreate', false, + $this->context->msg( $key, $username, "<nowiki>$comment</nowiki>" )->parse() . + Xml::checkLabel( $this->context->msg( 'recreate' )->text(), 'wpRecreate', 'wpRecreate', false, [ 'title' => Linker::titleAttrib( 'recreate' ), 'tabindex' => 1, 'id' => 'wpRecreate' ] ) . '</div>' @@ -2768,7 +2768,7 @@ $this->showConflict(); } catch ( MWContentSerializationException $ex ) { // this can't really happen, but be nice if it does. - $msg = wfMessage( + $msg = $this->context->msg( 'content-failed-to-parse', $this->contentModel, $this->contentFormat, @@ -2859,7 +2859,7 @@ if ( count( $editNotices ) ) { $wgOut->addHTML( implode( "\n", $editNotices ) ); } else { - $msg = wfMessage( 'editnotice-notext' ); + $msg = $this->context->msg( 'editnotice-notext' ); if ( !$msg->isDisabled() ) { $wgOut->addHTML( '<div class="mw-editnotice-notext">' @@ -3054,7 +3054,7 @@ ] ); } else { - if ( !wfMessage( 'longpage-hint' )->isDisabled() ) { + if ( !$this->context->msg( 'longpage-hint' )->isDisabled() ) { $wgOut->wrapWikiMsg( "<div id='mw-edit-longpage-hint'>\n$1\n</div>", [ 'longpage-hint', @@ -3135,7 +3135,7 @@ return; } } - $labelText = wfMessage( $isSubjectPreview ? 'subject' : 'summary' )->parse(); + $labelText = $this->context->msg( $isSubjectPreview ? 'subject' : 'summary' )->parse(); list( $label, $input ) = $this->getSummaryInput( $summary, $labelText, @@ -3162,13 +3162,14 @@ global $wgParser; if ( $isSubjectPreview ) { - $summary = wfMessage( 'newsectionsummary' )->rawParams( $wgParser->stripSectionName( $summary ) ) + $summary = $this->context->msg( 'newsectionsummary' ) + ->rawParams( $wgParser->stripSectionName( $summary ) ) ->inContentLanguage()->text(); } $message = $isSubjectPreview ? 'subject-preview' : 'summary-preview'; - $summary = wfMessage( $message )->parse() + $summary = $this->context->msg( $message )->parse() . Linker::commentBlock( $summary, $this->mTitle, $isSubjectPreview ); return Xml::tags( 'div', [ 'class' => 'mw-summary-preview' ], $summary ); } @@ -3333,7 +3334,7 @@ try { $this->showDiff(); } catch ( MWContentSerializationException $ex ) { - $msg = wfMessage( + $msg = $this->context->msg( 'content-failed-to-parse', $this->contentModel, $this->contentFormat, @@ -3408,8 +3409,8 @@ } if ( ( $oldContent && !$oldContent->isEmpty() ) || ( $newContent && !$newContent->isEmpty() ) ) { - $oldtitle = wfMessage( $oldtitlemsg )->parse(); - $newtitle = wfMessage( 'yourtext' )->parse(); + $oldtitle = $this->context->msg( $oldtitlemsg )->parse(); + $newtitle = $this->context->msg( 'yourtext' )->parse(); if ( !$oldContent ) { $oldContent = $newContent->getContentHandler()->makeEmptyContent(); @@ -3436,7 +3437,7 @@ */ protected function showHeaderCopyrightWarning() { $msg = 'editpage-head-copy-warn'; - if ( !wfMessage( $msg )->isDisabled() ) { + if ( !$this->context->msg( $msg )->isDisabled() ) { global $wgOut; $wgOut->wrapWikiMsg( "<div class='editpage-head-copywarn'>\n$1\n</div>", 'editpage-head-copy-warn' ); @@ -3454,7 +3455,7 @@ protected function showTosSummary() { $msg = 'editpage-tos-summary'; Hooks::run( 'EditPageTosSummary', [ $this->mTitle, &$msg ] ); - if ( !wfMessage( $msg )->isDisabled() ) { + if ( !$this->context->msg( $msg )->isDisabled() ) { global $wgOut; $wgOut->addHTML( '<div class="mw-tos-summary">' ); $wgOut->addWikiMsg( $msg ); @@ -3465,7 +3466,7 @@ protected function showEditTools() { global $wgOut; $wgOut->addHTML( '<div class="mw-editTools">' . - wfMessage( 'edittools' )->inContentLanguage()->parse() . + $this->context->msg( 'edittools' )->inContentLanguage()->parse() . '</div>' ); } @@ -3500,7 +3501,7 @@ Hooks::run( 'EditPageCopyrightWarning', [ $title, &$copywarnMsg ] ); return "<div id=\"editpage-copywarn\">\n" . - call_user_func_array( 'wfMessage', $copywarnMsg )->$format() . "\n</div>"; + call_user_func_array( 'wfMessage', $copywarnMsg )->title( $title )->$format() . "\n</div>"; } /** @@ -3547,19 +3548,19 @@ if ( $cancel !== '' ) { $cancel .= Html::element( 'span', [ 'class' => 'mw-editButtons-pipe-separator' ], - wfMessage( 'pipe-separator' )->text() ); + $this->context->msg( 'pipe-separator' )->text() ); } - $message = wfMessage( 'edithelppage' )->inContentLanguage()->text(); + $message = $this->context->msg( 'edithelppage' )->inContentLanguage()->text(); $edithelpurl = Skin::makeInternalOrExternalUrl( $message ); $attrs = [ 'target' => 'helpwindow', 'href' => $edithelpurl, ]; - $edithelp = Html::linkButton( wfMessage( 'edithelp' )->text(), + $edithelp = Html::linkButton( $this->context->msg( 'edithelp' )->text(), $attrs, [ 'mw-ui-quiet' ] ) . - wfMessage( 'word-separator' )->escaped() . - wfMessage( 'newwindow' )->parse(); + $this->context->msg( 'word-separator' )->escaped() . + $this->context->msg( 'newwindow' )->parse(); $wgOut->addHTML( " <span class='cancelLink'>{$cancel}</span>\n" ); $wgOut->addHTML( " <span class='editHelp'>{$edithelp}</span>\n" ); @@ -3597,8 +3598,8 @@ $de = $handler->createDifferenceEngine( $this->mArticle->getContext() ); $de->setContent( $content2, $content1 ); $de->showDiff( - wfMessage( 'yourtext' )->parse(), - wfMessage( 'storedversion' )->text() + $this->context->msg( 'yourtext' )->parse(), + $this->context->msg( 'storedversion' )->text() ); $wgOut->wrapWikiMsg( '<h2>$1</h2>', "yourtext" ); @@ -3620,7 +3621,7 @@ return Linker::linkKnown( $this->getContextTitle(), - wfMessage( 'cancel' )->parse(), + $this->context->msg( 'cancel' )->parse(), Html::buttonAttributes( $attrs, [ 'mw-ui-quiet' ] ), $cancelParams ); @@ -3697,11 +3698,11 @@ // Quick paranoid permission checks... if ( is_object( $data ) ) { if ( $data->log_deleted & LogPage::DELETED_USER ) { - $data->user_name = wfMessage( 'rev-deleted-user' )->escaped(); + $data->user_name = $this->context->msg( 'rev-deleted-user' )->escaped(); } if ( $data->log_deleted & LogPage::DELETED_COMMENT ) { - $data->log_comment = wfMessage( 'rev-deleted-comment' )->escaped(); + $data->log_comment = $this->context->msg( 'rev-deleted-comment' )->escaped(); } } @@ -3728,7 +3729,8 @@ // string, which happens when you initially edit // a category page, due to automatic preview-on-open. $parsedNote = $wgOut->parse( "<div class='previewnote'>" . - wfMessage( 'session_fail_preview_html' )->text() . "</div>", true, /* interface */true ); + $this->context->msg( 'session_fail_preview_html' )->text() . "</div>", + true, /* interface */true ); } $stats->increment( 'edit.failures.session_loss' ); return $parsedNote; @@ -3750,22 +3752,22 @@ # provide a anchor link to the editform $continueEditing = '<span class="mw-continue-editing">' . '[[#' . self::EDITFORM_ID . '|' . $wgLang->getArrow() . ' ' . - wfMessage( 'continue-editing' )->text() . ']]</span>'; + $this->context->msg( 'continue-editing' )->text() . ']]</span>'; if ( $this->mTriedSave && !$this->mTokenOk ) { if ( $this->mTokenOkExceptSuffix ) { - $note = wfMessage( 'token_suffix_mismatch' )->plain(); + $note = $this->context->msg( 'token_suffix_mismatch' )->plain(); $stats->increment( 'edit.failures.bad_token' ); } else { - $note = wfMessage( 'session_fail_preview' )->plain(); + $note = $this->context->msg( 'session_fail_preview' )->plain(); $stats->increment( 'edit.failures.session_loss' ); } } elseif ( $this->incompleteForm ) { - $note = wfMessage( 'edit_form_incomplete' )->plain(); + $note = $this->context->msg( 'edit_form_incomplete' )->plain(); if ( $this->mTriedSave ) { $stats->increment( 'edit.failures.incomplete_form' ); } } else { - $note = wfMessage( 'previewnote' )->plain() . ' ' . $continueEditing; + $note = $this->context->msg( 'previewnote' )->plain() . ' ' . $continueEditing; } # don't parse non-wikitext pages, show message about preview @@ -3796,7 +3798,7 @@ # Messages: usercsspreview, userjspreview, sitecsspreview, sitejspreview if ( $level && $format ) { $note = "<div id='mw-{$level}{$format}preview'>" . - wfMessage( "{$level}{$format}preview" )->text() . + $this->context->msg( "{$level}{$format}preview" )->text() . ' ' . $continueEditing . "</div>"; } } @@ -3822,7 +3824,7 @@ } } catch ( MWContentSerializationException $ex ) { - $m = wfMessage( + $m = $this->context->msg( 'content-failed-to-parse', $this->contentModel, $this->contentFormat, @@ -3834,13 +3836,13 @@ if ( $this->isConflict ) { $conflict = '<h2 id="mw-previewconflict">' - . wfMessage( 'previewconflict' )->escaped() . "</h2>\n"; + . $this->context->msg( 'previewconflict' )->escaped() . "</h2>\n"; } else { $conflict = '<hr />'; } $previewhead = "<div class='previewnote'>\n" . - '<h2 id="mw-previewheader">' . wfMessage( 'preview' )->escaped() . "</h2>" . + '<h2 id="mw-previewheader">' . $this->context->msg( 'preview' )->escaped() . "</h2>" . $wgOut->parse( $note, true, /* interface */true ) . $conflict . "</div>\n"; $pageViewLang = $this->mTitle->getPageViewLanguage(); @@ -4060,11 +4062,11 @@ // don't show the minor edit checkbox if it's a new page or section if ( !$this->isNew ) { $checkboxes['minor'] = ''; - $minorLabel = wfMessage( 'minoredit' )->parse(); + $minorLabel = $this->context->msg( 'minoredit' )->parse(); if ( $wgUser->isAllowed( 'minoredit' ) ) { $attribs = [ 'tabindex' => ++$tabindex, - 'accesskey' => wfMessage( 'accesskey-minoredit' )->text(), + 'accesskey' => $this->context->msg( 'accesskey-minoredit' )->text(), 'id' => 'wpMinoredit', ]; $minorEditHtml = @@ -4083,12 +4085,12 @@ } } - $watchLabel = wfMessage( 'watchthis' )->parse(); + $watchLabel = $this->context->msg( 'watchthis' )->parse(); $checkboxes['watch'] = ''; if ( $wgUser->isLoggedIn() ) { $attribs = [ 'tabindex' => ++$tabindex, - 'accesskey' => wfMessage( 'accesskey-watch' )->text(), + 'accesskey' => $this->context->msg( 'accesskey-watch' )->text(), 'id' => 'wpWatchthis', ]; $watchThisHtml = @@ -4128,7 +4130,7 @@ } else { $buttonLabelKey = !$this->mTitle->exists() ? 'savearticle' : 'savechanges'; } - $buttonLabel = wfMessage( $buttonLabelKey )->text(); + $buttonLabel = $this->context->msg( $buttonLabelKey )->text(); $attribs = [ 'id' => 'wpSave', 'name' => 'wpSave', @@ -4142,7 +4144,7 @@ 'name' => 'wpPreview', 'tabindex' => $tabindex, ] + Linker::tooltipAndAccesskeyAttribs( 'preview' ); - $buttons['preview'] = Html::submitButton( wfMessage( 'showpreview' )->text(), + $buttons['preview'] = Html::submitButton( $this->context->msg( 'showpreview' )->text(), $attribs ); $buttons['live'] = ''; @@ -4151,7 +4153,7 @@ 'name' => 'wpDiff', 'tabindex' => ++$tabindex, ] + Linker::tooltipAndAccesskeyAttribs( 'diff' ); - $buttons['diff'] = Html::submitButton( wfMessage( 'showdiff' )->text(), + $buttons['diff'] = Html::submitButton( $this->context->msg( 'showdiff' )->text(), $attribs ); Hooks::run( 'EditPageBeforeEditButtons', [ &$this, &$buttons, &$tabindex ] ); @@ -4165,9 +4167,9 @@ function noSuchSectionPage() { global $wgOut; - $wgOut->prepareErrorPage( wfMessage( 'nosuchsectiontitle' ) ); + $wgOut->prepareErrorPage( $this->context->msg( 'nosuchsectiontitle' ) ); - $res = wfMessage( 'nosuchsectiontext', $this->section )->parseAsBlock(); + $res = $this->context->msg( 'nosuchsectiontext', $this->section )->parseAsBlock(); Hooks::run( 'EditPageNoSuchSection', [ &$this, &$res ] ); $wgOut->addHTML( $res ); @@ -4186,7 +4188,7 @@ if ( is_array( $match ) ) { $match = $wgLang->listToText( $match ); } - $wgOut->prepareErrorPage( wfMessage( 'spamprotectiontitle' ) ); + $wgOut->prepareErrorPage( $this->context->msg( 'spamprotectiontitle' ) ); $wgOut->addHTML( '<div id="spamprotected">' ); $wgOut->addWikiMsg( 'spamprotectiontext' ); -- To view, visit https://gerrit.wikimedia.org/r/309044 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5ba13f1677e1a1b4160e14357a483b5e1f11ea1c Gerrit-PatchSet: 6 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Chad <ch...@wikimedia.org> Gerrit-Reviewer: Chad <ch...@wikimedia.org> Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com> Gerrit-Reviewer: Jackmcbarn <jackmcb...@gmail.com> Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: Tpt <thoma...@hotmail.fr> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits