44 private $linkRenderer;
47 private $languageFactory;
50 private $contentLanguage;
64 $this->grantsInfo = $grantsInfo;
65 $this->linkRenderer = $linkRenderer;
66 $this->languageFactory = $languageFactory;
67 $this->contentLanguage = $contentLanguage;
91 $msg->inLanguage( $lang );
94 if ( !$msg->exists() ) {
96 ?
wfMessage(
'grant-generic', $grant )->inLanguage( $lang )
112 foreach ( $grants as $grant ) {
113 $ret[$grant] = $this->getGrantDescription( $grant, $lang );
126 $riskGroupsByGrant = $this->grantsInfo->getRiskGroupsByGrant(
'unknown' );
127 $grantDescriptions = $this->getGrantDescriptions( $grants, $lang );
129 foreach ( $grantDescriptions as $grant => $description ) {
130 $riskGroup = $riskGroupsByGrant[$grant] ??
'unknown';
133 $riskGroupMsg =
wfMessage(
"grantriskgroup-$riskGroup" );
135 $riskGroupMsg->inLanguage( $lang );
137 if ( $riskGroupMsg->exists() ) {
138 $riskDescription = $riskGroupMsg->text();
140 $riskDescription =
'';
142 $results[] = htmlspecialchars( $description ) .
' ' .
143 Html::element(
'span', [
'class' =>
"mw-grant mw-grantriskgroup-$riskGroup" ], $riskDescription );
159 $riskGroupsByGrant = $this->grantsInfo->getRiskGroupsByGrant(
'unknown' );
160 $riskGroup = $riskGroupsByGrant[$grant] ??
'unknown';
161 return $this->linkRenderer->makeKnownLink(
162 SpecialPage::getTitleFor(
'Listgrants',
false, $grant ),
163 new HtmlArmor( $this->getGrantDescriptionsWithClasses( [ $grant ], $lang )[ 0 ] )
178 if ( is_string( $lang ) ) {
179 $lang = $this->languageFactory->getLanguage( $lang );
180 } elseif ( $lang ===
null ) {
181 $lang = $this->contentLanguage;
185 foreach ( $this->grantsInfo->getGrantGroups( $grantsFilter ) as $group => $grants ) {
186 if ( $group ===
'hidden' ) {
189 $grantDescriptionsWithClasses = $this->getGrantDescriptionsWithClasses( $grants, $lang );
196 $s .=
"*<span class=\"mw-grantgroup\">" .
198 wfMessage(
"grant-group-$group" )->inLanguage( $lang )->text() .
"</span>\n";
199 $s .=
":" . $lang->semicolonList( $grantDescriptionsWithClasses ) .
"\n";
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
if(!defined('MW_SETUP_CALLBACK'))
Marks HTML that shouldn't be escaped.
Base class for language-specific code.
Parent class for all special pages.