diff options
Diffstat (limited to 'MLEB/Translate/utils/StatsTable.php')
-rw-r--r-- | MLEB/Translate/utils/StatsTable.php | 67 |
1 files changed, 15 insertions, 52 deletions
diff --git a/MLEB/Translate/utils/StatsTable.php b/MLEB/Translate/utils/StatsTable.php index 03b9d73f..46493683 100644 --- a/MLEB/Translate/utils/StatsTable.php +++ b/MLEB/Translate/utils/StatsTable.php @@ -15,24 +15,13 @@ * @ingroup Stats */ class StatsTable { - /** - * @var Language - */ + /** @var Language */ protected $lang; - - /** - * @var Title - */ + /** @var Title */ protected $translate; - - /** - * @var string - */ + /** @var string */ protected $mainColumnHeader; - - /** - * @var Message[] - */ + /** @var Message[] */ protected $extraColumns = []; public function __construct() { @@ -88,16 +77,12 @@ class StatsTable { return $colors[ $index ]; } - /** - * @return string - */ + /** @return string */ public function getMainColumnHeader() { return $this->mainColumnHeader; } - /** - * @param Message $msg - */ + /** @param Message $msg */ public function setMainColumnHeader( Message $msg ) { $this->mainColumnHeader = $this->createColumnHeader( $msg ); } @@ -114,9 +99,7 @@ class StatsTable { $this->extraColumns[] = $column; } - /** - * @return Message[] - */ + /** @return Message[] */ public function getOtherColumnHeaders() { return array_merge( [ wfMessage( 'translate-total' ), @@ -127,9 +110,7 @@ class StatsTable { ], $this->extraColumns ); } - /** - * @return string HTML - */ + /** @return string HTML */ public function createHeader() { // Create table header $out = Html::openElement( @@ -276,10 +257,10 @@ class StatsTable { * @param string $code Language code * @return bool */ - public function isBlacklisted( $groupId, $code ) { + public function isExcluded( $groupId, $code ) { global $wgTranslateBlacklist; - $blacklisted = null; + $excluded = null; $checks = [ $groupId, @@ -289,10 +270,10 @@ class StatsTable { foreach ( $checks as $check ) { if ( isset( $wgTranslateBlacklist[$check] ) && isset( $wgTranslateBlacklist[$check][$code] ) ) { - $blacklisted = $wgTranslateBlacklist[$check][$code]; + $excluded = $wgTranslateBlacklist[$check][$code]; } - if ( $blacklisted !== null ) { + if ( $excluded !== null ) { break; } } @@ -300,32 +281,14 @@ class StatsTable { $group = MessageGroups::getGroup( $groupId ); $languages = $group->getTranslatableLanguages(); if ( $languages !== null && !isset( $languages[$code] ) ) { - $blacklisted = true; + $excluded = true; } $include = Hooks::run( 'Translate:MessageGroupStats:isIncluded', [ $groupId, $code ] ); if ( !$include ) { - $blacklisted = true; + $excluded = true; } - return $blacklisted; - } - - /** - * Used to circumvent ugly tooltips when newlines are used in the - * message content ("x\ny" becomes "x y"). - * @param string $text - * @return string - */ - public static function formatTooltip( $text ) { - $wordSeparator = wfMessage( 'word-separator' )->text(); - - $text = strtr( $text, [ - "\n" => $wordSeparator, - "\r" => $wordSeparator, - "\t" => $wordSeparator, - ] ); - - return $text; + return $excluded; } } |