From 4f602d4d0145c5d2c95a3142709a6f68cd480094 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Sat, 8 May 2021 02:29:09 +0200 Subject: [PATCH] Use HTMLForm::setWrapperLegend and ::setSubmitTextMsg to set messages setWrapperLegendMsg and setSubmitTextMsg are calling Message::text Replacing setSubmitText + Message::text with setSubmitTextMsg makes the code easier to read Change-Id: I73389991fea82e1927027dc95c3debc3d8c15939 --- includes/ProtectionForm.php | 4 ++-- includes/actions/HistoryAction.php | 4 ++-- includes/logging/LogEventsList.php | 2 +- includes/preferences/DefaultPreferencesFactory.php | 2 +- includes/specials/SpecialContributions.php | 4 ++-- includes/specials/SpecialImport.php | 4 ++-- includes/specials/SpecialNewpages.php | 4 ++-- includes/specials/SpecialProtectedpages.php | 2 +- includes/specials/SpecialProtectedtitles.php | 2 +- includes/specials/SpecialUpload.php | 2 +- includes/specials/forms/UploadForm.php | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index d09a916bfb3..f1abbfca3ef 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -602,9 +602,9 @@ class ProtectionForm { ->setTableId( 'mw-protect-table2' ) ->setAction( $this->mTitle->getLocalURL( 'action=protect' ) ) ->setSubmitID( 'mw-Protect-submit' ) - ->setSubmitText( $this->mContext->msg( 'confirm' )->text() ) + ->setSubmitTextMsg( 'confirm' ) ->suppressDefaultSubmit( $this->disabled ) - ->setWrapperLegend( $this->mContext->msg( 'protect-legend' )->text() ) + ->setWrapperLegendMsg( 'protect-legend' ) ->loadData(); return $htmlForm->getHTML( false ) . $out; diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index 2b4a775f563..a7782afc398 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -281,9 +281,9 @@ class HistoryAction extends FormlessAction { ->setAction( wfScript() ) ->setCollapsibleOptions( true ) ->setId( 'mw-history-searchform' ) - ->setSubmitText( $this->msg( 'historyaction-submit' )->text() ) + ->setSubmitTextMsg( 'historyaction-submit' ) ->setWrapperAttributes( [ 'id' => 'mw-history-search' ] ) - ->setWrapperLegend( $this->msg( 'history-fieldset-title' )->text() ); + ->setWrapperLegendMsg( 'history-fieldset-title' ); $htmlForm->loadData(); $out->addHTML( $htmlForm->getHTML( false ) ); diff --git a/includes/logging/LogEventsList.php b/includes/logging/LogEventsList.php index df921ba2e7a..2678db3698e 100644 --- a/includes/logging/LogEventsList.php +++ b/includes/logging/LogEventsList.php @@ -182,7 +182,7 @@ class LogEventsList extends ContextSource { $context->setTitle( SpecialPage::getTitleFor( 'Log' ) ); // Remove subpage $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $context ); $htmlForm - ->setSubmitText( $this->msg( 'logeventslist-submit' )->text() ) + ->setSubmitTextMsg( 'logeventslist-submit' ) ->setMethod( 'get' ) ->setWrapperLegendMsg( 'log' ); diff --git a/includes/preferences/DefaultPreferencesFactory.php b/includes/preferences/DefaultPreferencesFactory.php index 6a6803d4a67..a823c0bd55d 100644 --- a/includes/preferences/DefaultPreferencesFactory.php +++ b/includes/preferences/DefaultPreferencesFactory.php @@ -1698,7 +1698,7 @@ class DefaultPreferencesFactory implements PreferencesFactory { $htmlForm->setPrivateInfoEditable( $user->isAllowed( 'editmyprivateinfo' ) ); $htmlForm->setId( 'mw-prefs-form' ); $htmlForm->setAutocomplete( 'off' ); - $htmlForm->setSubmitText( $context->msg( 'saveprefs' )->text() ); + $htmlForm->setSubmitTextMsg( 'saveprefs' ); // Used message keys: 'accesskey-preferences-save', 'tooltip-preferences-save' $htmlForm->setSubmitTooltip( 'preferences-save' ); $htmlForm->setSubmitID( 'prefcontrol' ); diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 636a5bf4e61..e0cae607f73 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -790,8 +790,8 @@ class SpecialContributions extends IncludableSpecialPage { ( $pagerOptions['end'] ?? null ) ) ->setAction( wfScript() ) - ->setSubmitText( $this->msg( 'sp-contributions-submit' )->text() ) - ->setWrapperLegend( $this->msg( 'sp-contributions-search' )->text() ); + ->setSubmitTextMsg( 'sp-contributions-submit' ) + ->setWrapperLegendMsg( 'sp-contributions-search' ); $explain = $this->msg( 'sp-contributions-explain' ); if ( !$explain->isBlank() ) { diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index e1ad7efa51c..7d7fafdc216 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -345,7 +345,7 @@ class SpecialImport extends SpecialPage { $htmlForm = HTMLForm::factory( 'ooui', $uploadFormDescriptor, $this->getContext() ); $htmlForm->setAction( $action ); $htmlForm->setId( 'mw-import-upload-form' ); - $htmlForm->setWrapperLegend( $this->msg( 'import-upload' )->text() ); + $htmlForm->setWrapperLegendMsg( 'import-upload' ); $htmlForm->setSubmitTextMsg( 'uploadbtn' ); $htmlForm->prepareForm()->displayForm( false ); @@ -454,7 +454,7 @@ class SpecialImport extends SpecialPage { $htmlForm = HTMLForm::factory( 'ooui', $interwikiFormDescriptor, $this->getContext() ); $htmlForm->setAction( $action ); $htmlForm->setId( 'mw-import-interwiki-form' ); - $htmlForm->setWrapperLegend( $this->msg( 'importinterwiki' )->text() ); + $htmlForm->setWrapperLegendMsg( 'importinterwiki' ); $htmlForm->setSubmitTextMsg( 'import-interwiki-submit' ); $htmlForm->prepareForm()->displayForm( false ); } diff --git a/includes/specials/SpecialNewpages.php b/includes/specials/SpecialNewpages.php index e55ce551367..0b2ccaf28bf 100644 --- a/includes/specials/SpecialNewpages.php +++ b/includes/specials/SpecialNewpages.php @@ -376,8 +376,8 @@ class SpecialNewpages extends IncludableSpecialPage { return false; } ) - ->setSubmitText( $this->msg( 'newpages-submit' )->text() ) - ->setWrapperLegend( $this->msg( 'newpages' )->text() ) + ->setSubmitTextMsg( 'newpages-submit' ) + ->setWrapperLegendMsg( 'newpages' ) ->addFooterText( Html::rawElement( 'div', null, diff --git a/includes/specials/SpecialProtectedpages.php b/includes/specials/SpecialProtectedpages.php index cd80d6d59c7..181491f455e 100644 --- a/includes/specials/SpecialProtectedpages.php +++ b/includes/specials/SpecialProtectedpages.php @@ -159,7 +159,7 @@ class SpecialProtectedpages extends SpecialPage { $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() ) ->setMethod( 'get' ) ->setWrapperLegendMsg( 'protectedpages' ) - ->setSubmitText( $this->msg( 'protectedpages-submit' )->text() ); + ->setSubmitTextMsg( 'protectedpages-submit' ); return $htmlForm->prepareForm()->getHTML( false ); } diff --git a/includes/specials/SpecialProtectedtitles.php b/includes/specials/SpecialProtectedtitles.php index 0425f9f4a6e..1f4839b4326 100644 --- a/includes/specials/SpecialProtectedtitles.php +++ b/includes/specials/SpecialProtectedtitles.php @@ -157,7 +157,7 @@ class SpecialProtectedtitles extends SpecialPage { $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() ) ->setMethod( 'get' ) ->setWrapperLegendMsg( 'protectedtitles' ) - ->setSubmitText( $this->msg( 'protectedtitles-submit' )->text() ); + ->setSubmitTextMsg( 'protectedtitles-submit' ); return $htmlForm->prepareForm()->getHTML( false ); } diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 9b9d1b61568..e1abe163a64 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -495,7 +495,7 @@ class SpecialUpload extends SpecialPage { $warningHtml .= $this->msg( $uploadWarning )->parseAsBlock(); $form = $this->getUploadForm( $warningHtml, $sessionKey, /* $hideIgnoreWarning */ true ); - $form->setSubmitText( $this->msg( 'upload-tryagain' )->text() ); + $form->setSubmitTextMsg( 'upload-tryagain' ); $form->addButton( [ 'name' => 'wpUploadIgnoreWarning', 'value' => $this->msg( 'ignorewarning' )->text() diff --git a/includes/specials/forms/UploadForm.php b/includes/specials/forms/UploadForm.php index a30c71e9b70..39f43441e36 100644 --- a/includes/specials/forms/UploadForm.php +++ b/includes/specials/forms/UploadForm.php @@ -126,7 +126,7 @@ class UploadForm extends HTMLForm { } # Set some form properties - $this->setSubmitText( $this->msg( 'uploadbtn' )->text() ); + $this->setSubmitTextMsg( 'uploadbtn' ); $this->setSubmitName( 'wpUpload' ); # Used message keys: 'accesskey-upload', 'tooltip-upload' $this->setSubmitTooltip( 'upload' );