From: cenarium Date: Wed, 28 Sep 2016 19:39:28 +0000 (+0200) Subject: Pass context to ChangeTags::tagDescription X-Git-Tag: 1.31.0-rc.0~5011^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=ffeb0a4a28ec302a16a6b27e75148d18ba893794;p=lhc%2Fweb%2Fwiklou.git Pass context to ChangeTags::tagDescription To avoid wfMessage calls. Change-Id: Icaa984fa8c69ccb38fbfd3e30877a4c572501c28 --- diff --git a/includes/api/ApiQueryTags.php b/includes/api/ApiQueryTags.php index 7a14aac3f7..43eb7e8066 100644 --- a/includes/api/ApiQueryTags.php +++ b/includes/api/ApiQueryTags.php @@ -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 ) { diff --git a/includes/changetags/ChangeTags.php b/includes/changetags/ChangeTags.php index 76dd754deb..993f0b7591 100644 --- a/includes/changetags/ChangeTags.php +++ b/includes/changetags/ChangeTags.php @@ -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 ); diff --git a/includes/specials/SpecialTags.php b/includes/specials/SpecialTags.php index 898d170642..ea40cb807d 100644 --- a/includes/specials/SpecialTags.php +++ b/includes/specials/SpecialTags.php @@ -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(