11use MediaWiki\Languages\LanguageFactory;
28 private LanguageFactory $languageFactory;
34 LanguageFactory $languageFactory,
37 $this->grantsInfo = $grantsInfo;
38 $this->linkRenderer = $linkRenderer;
39 $this->languageFactory = $languageFactory;
40 $this->contentLanguage = $contentLanguage;
64 $msg->inLanguage( $lang );
67 if ( !$msg->exists() ) {
69 ?
wfMessage(
'grant-generic', $grant )->inLanguage( $lang )
85 foreach ( $grants as $grant ) {
86 $ret[$grant] = $this->getGrantDescription( $grant, $lang );
99 $riskGroupsByGrant = $this->grantsInfo->getRiskGroupsByGrant(
'unknown' );
100 $grantDescriptions = $this->getGrantDescriptions( $grants, $lang );
102 foreach ( $grantDescriptions as $grant => $description ) {
103 $riskGroup = $riskGroupsByGrant[$grant] ??
'unknown';
106 $riskGroupMsg =
wfMessage(
"grantriskgroup-$riskGroup" );
108 $riskGroupMsg->inLanguage( $lang );
110 if ( $riskGroupMsg->exists() ) {
111 $riskDescription = $riskGroupMsg->text();
112 $riskDescriptionHTML =
' ' .
113 Html::element(
'span', [
'class' =>
"mw-grant mw-grantriskgroup-$riskGroup" ], $riskDescription );
115 $riskDescription =
'';
116 $riskDescriptionHTML =
'';
118 $results[] = htmlspecialchars( $description ) . $riskDescriptionHTML;
134 $riskGroupsByGrant = $this->grantsInfo->getRiskGroupsByGrant(
'unknown' );
135 $riskGroup = $riskGroupsByGrant[$grant] ??
'unknown';
136 return $this->linkRenderer->makeKnownLink(
137 SpecialPage::getTitleFor(
'Listgrants',
false, $grant ),
138 new HtmlArmor( $this->getGrantDescriptionsWithClasses( [ $grant ], $lang )[ 0 ] )
155 if ( is_string( $lang ) ) {
156 $lang = $this->languageFactory->getLanguage( $lang );
157 } elseif ( $lang ===
null ) {
158 $lang = $this->contentLanguage;
162 foreach ( $this->grantsInfo->getGrantGroups( $grantsFilter ) as $group => $grants ) {
163 if ( $group ===
'hidden' ) {
166 $grantDescriptionsWithClasses = $this->getGrantDescriptionsWithClasses( $grants, $lang );
173 $s .=
"*<span class=\"mw-grantgroup\">" .
175 wfMessage(
"grant-group-$group" )->inLanguage( $lang )->text() .
"</span>\n";
176 $s .=
":" . $lang->semicolonList( $grantDescriptionsWithClasses ) .
"\n";
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
if(!defined('MW_SETUP_CALLBACK'))
Parent class for all special pages.