Pass context to ChangeTags::tagDescription
authorcenarium <cenarium.sysop@gmail.com>
Wed, 28 Sep 2016 19:39:28 +0000 (21:39 +0200)
committercenarium <cenarium.sysop@gmail.com>
Thu, 27 Oct 2016 21:18:40 +0000 (23:18 +0200)
To avoid wfMessage calls.

Change-Id: Icaa984fa8c69ccb38fbfd3e30877a4c572501c28

includes/api/ApiQueryTags.php
includes/changetags/ChangeTags.php
includes/specials/SpecialTags.php

index 7a14aac..43eb7e8 100644 (file)
@@ -93,7 +93,7 @@ class ApiQueryTags extends ApiQueryBase {
                        $tag['name'] = $tagName;
 
                        if ( $fld_displayname ) {
-                               $tag['displayname'] = ChangeTags::tagDescription( $tagName );
+                               $tag['displayname'] = ChangeTags::tagDescription( $tagName, $this );
                        }
 
                        if ( $fld_description ) {
index 76dd754..993f0b7 100644 (file)
@@ -63,7 +63,7 @@ class ChangeTags {
                        if ( !$tag ) {
                                continue;
                        }
-                       $description = self::tagDescription( $tag );
+                       $description = self::tagDescription( $tag, $context );
                        if ( $description === false ) {
                                continue;
                        }
@@ -98,11 +98,12 @@ class ChangeTags {
         * we consider the tag hidden, and return false.
         *
         * @param string $tag Tag
+        * @param IContextSource $context
         * @return string|bool Tag description or false if tag is to be hidden.
         * @since 1.25 Returns false if tag is to be hidden.
         */
-       public static function tagDescription( $tag ) {
-               $msg = wfMessage( "tag-$tag" );
+       public static function tagDescription( $tag, IContextSource $context ) {
+               $msg = $context->msg( "tag-$tag" );
                if ( !$msg->exists() ) {
                        // No such message, so return the HTML-escaped tag name.
                        return htmlspecialchars( $tag );
index 898d170..ea40cb8 100644 (file)
@@ -176,7 +176,7 @@ class SpecialTags extends SpecialPage {
                $newRow .= Xml::tags( 'td', null, Xml::element( 'code', null, $tag ) );
 
                $linkRenderer = $this->getLinkRenderer();
-               $disp = ChangeTags::tagDescription( $tag );
+               $disp = ChangeTags::tagDescription( $tag, $this->getContext() );
                if ( $showEditLinks ) {
                        $disp .= ' ';
                        $editLink = $linkRenderer->makeLink(