Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
MediaWikiExtensionMessageGroup.php
1<?php
2declare( strict_types = 1 );
3
4use MediaWiki\Context\IContextSource;
5
20 public function getDescription( ?IContextSource $context = null ) {
21 $language = $this->getSourceLanguage();
22 if ( $context ) {
23 $language = $context->getLanguage()->getCode();
24 }
25
26 $msgkey = $this->getFromConf( 'BASIC', 'descriptionmsg' );
27 $desc = '';
28 if ( $msgkey ) {
29 $desc = $this->getMessage( $msgkey, $language );
30 if ( (string)$desc === '' ) {
31 $desc = $this->getMessage( $msgkey, $this->getSourceLanguage() );
32 }
33 }
34
35 if ( (string)$desc === '' ) {
36 // That failed, default to 'description'
37 $desc = parent::getDescription( $context );
38 }
39
40 return $desc;
41 }
42}
This class implements default behavior for file based message groups.
getMessage( $key, $code)
@inheritDoc
Message group for MediaWiki extensions.
getDescription(?IContextSource $context=null)
MediaWiki extensions all should have key in their i18n files describing them.
getSourceLanguage()
Returns language code depicting the language of source text.