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
This commit is contained in:
Umherirrender 2021-05-08 02:29:09 +02:00
parent 86eca4c9b2
commit 4f602d4d01
11 changed files with 16 additions and 16 deletions

View file

@ -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;

View file

@ -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 ) );

View file

@ -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' );

View file

@ -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' );

View file

@ -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() ) {

View file

@ -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 );
}

View file

@ -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,

View file

@ -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 );
}

View file

@ -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 );
}

View file

@ -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()

View file

@ -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' );