Merge "VectorTemplate: use skin->Msg() instead of msg()"

This commit is contained in:
jenkins-bot 2020-07-09 21:27:52 +00:00 committed by Gerrit Code Review
commit 6a078bc246
1 changed files with 14 additions and 22 deletions

View File

@ -81,16 +81,6 @@ class VectorTemplate extends BaseTemplate {
$this->templateRoot = $isLegacy ? 'skin-legacy' : 'skin';
}
/**
* Amends the default behavior of BaseTemplate to return rather
* than echo.
* @param string $key
* @return Message
*/
public function msg( $key ) {
return $this->getMsg( $key );
}
/**
* @return Config
*/
@ -150,29 +140,29 @@ class VectorTemplate extends BaseTemplate {
// Remember that the string '0' is a valid title.
// From OutputPage::getPageTitle, via ::setPageTitle().
'html-title' => $out->getPageTitle(),
'msg-tagline' => $this->msg( 'tagline' )->text(),
'msg-tagline' => $skin->msg( 'tagline' )->text(),
// From Skin::getNewtalks(). Always returns string, cast to null if empty.
'html-newtalk' => $skin->getNewtalks() ?: null,
'msg-vector-jumptonavigation' => $this->msg( 'vector-jumptonavigation' )->text(),
'msg-vector-jumptosearch' => $this->msg( 'vector-jumptosearch' )->text(),
'msg-vector-jumptonavigation' => $skin->msg( 'vector-jumptonavigation' )->text(),
'msg-vector-jumptosearch' => $skin->msg( 'vector-jumptosearch' )->text(),
'html-printfooter' => $skin->printSource(),
'html-catlinks' => $skin->getCategories(),
'data-footer' => $this->getFooterData(),
'html-navigation-heading' => $this->msg( 'navigation-heading' ),
'html-navigation-heading' => $skin->msg( 'navigation-heading' ),
'data-search-box' => $this->buildSearchProps(),
// Header
'data-logos' => ResourceLoaderSkinModule::getAvailableLogos( $this->getConfig() ),
'msg-sitetitle' => $this->msg( 'sitetitle' )->text(),
'msg-sitesubtitle' => $this->msg( 'sitesubtitle' )->text(),
'msg-sitetitle' => $skin->msg( 'sitetitle' )->text(),
'msg-sitesubtitle' => $skin->msg( 'sitesubtitle' )->text(),
'main-page-href' => $mainPageHref,
'data-sidebar' => $this->buildSidebar(),
'sidebar-visible' => $this->isSidebarVisible(),
'msg-vector-action-toggle-sidebar' => $this->msg( 'vector-action-toggle-sidebar' )->text(),
'msg-vector-action-toggle-sidebar' => $skin->msg( 'vector-action-toggle-sidebar' )->text(),
] + $this->getMenuProps();
// The following logic is unqiue to Vector (not used by legacy Vector) and
@ -184,8 +174,8 @@ class VectorTemplate extends BaseTemplate {
false,
'mw-prefsection-rendering-skin-skin-prefs'
)->getLinkURL( 'wprov=' . self::OPT_OUT_LINK_TRACKING_CODE ),
'text' => $this->msg( 'vector-opt-out' )->text(),
'title' => $this->msg( 'vector-opt-out-tooltip' )->text(),
'text' => $skin->msg( 'vector-opt-out' )->text(),
'title' => $skin->msg( 'vector-opt-out-tooltip' )->text(),
];
}
@ -398,6 +388,7 @@ class VectorTemplate extends BaseTemplate {
array $options = [],
bool $setLabelToSelected = false
) : array {
$skin = $this->getSkin();
$extraClasses = [
self::MENU_TYPE_DROPDOWN => 'vector-menu vector-menu-dropdown vectorMenu',
self::MENU_TYPE_TABS => 'vector-menu vector-menu-tabs vectorTabs',
@ -414,7 +405,7 @@ class VectorTemplate extends BaseTemplate {
// For some menu items, there is no language key corresponding with its menu key.
// These inconsitencies are captured in MENU_LABEL_KEYS
$msgObj = $this->msg( self::MENU_LABEL_KEYS[ $label ] ?? $label );
$msgObj = $skin->msg( self::MENU_LABEL_KEYS[ $label ] ?? $label );
$props = [
'id' => "p-$label",
'label-id' => "p-{$label}-label",
@ -474,7 +465,7 @@ class VectorTemplate extends BaseTemplate {
$loggedIn =
Html::element( 'li',
[ 'id' => 'pt-anonuserpage' ],
$this->msg( 'notloggedin' )->text()
$skin->msg( 'notloggedin' )->text()
);
} else {
$loggedIn = '';
@ -526,6 +517,7 @@ class VectorTemplate extends BaseTemplate {
*/
private function buildSearchProps() : array {
$config = $this->getConfig();
$skin = $this->getSkin();
$props = [
'form-action' => $config->get( 'Script' ),
'html-button-search-fallback' => $this->makeSearchButton(
@ -537,7 +529,7 @@ class VectorTemplate extends BaseTemplate {
[ 'id' => 'searchButton', 'class' => 'searchButton' ]
),
'html-input' => $this->makeSearchInput( [ 'id' => 'searchInput' ] ),
'msg-search' => $this->msg( 'search' ),
'msg-search' => $skin->msg( 'search' ),
'page-title' => SpecialPage::getTitleFor( 'Search' )->getPrefixedDBkey(),
];
return $props;