Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
StatsTable.php
1<?php
2declare( strict_types=1 );
3
4namespace MediaWiki\Extension\Translate\Statistics;
5
6use HtmlArmor;
9use MediaWiki\Html\Html;
10use MediaWiki\Language\Language;
11use MediaWiki\Linker\LinkRenderer;
12use MediaWiki\Message\Message;
13use MediaWiki\SpecialPage\SpecialPage;
14use MediaWiki\Title\TitleValue;
15use MediaWiki\Xml\Xml;
16use MessageGroup;
17use MessageLocalizer;
18
26 protected TitleValue $translate;
27 private LinkRenderer $linkRenderer;
28 private ConfigHelper $configHelper;
29 private MessageLocalizer $messageLocalizer;
30 protected Language $language;
31 protected string $mainColumnHeader;
33 protected array $extraColumns = [];
34 private MessageGroupMetadata $messageGroupMetadata;
35
36 public function __construct(
37 LinkRenderer $linkRenderer,
38 ConfigHelper $configHelper,
39 MessageLocalizer $messageLocalizer,
40 Language $language,
41 MessageGroupMetadata $messageGroupMetadata
42 ) {
43 $this->translate = SpecialPage::getTitleValueFor( 'Translate' );
44 $this->linkRenderer = $linkRenderer;
45 $this->configHelper = $configHelper;
46 $this->messageLocalizer = $messageLocalizer;
47 $this->language = $language;
48 $this->messageGroupMetadata = $messageGroupMetadata;
49 }
50
58 public function element( string $in, string $bgcolor = '', string $sort = '' ): string {
59 $attributes = [];
60
61 if ( $sort ) {
62 $attributes['data-sort-value'] = $sort;
63 }
64
65 if ( $bgcolor ) {
66 $attributes['class'] = 'notheme skin-invert';
67 $attributes['style'] = 'background-color: #' . $bgcolor;
68 }
69
70 $element = Html::element( 'td', $attributes, $in );
71
72 return $element;
73 }
74
75 // FIXME: should be moved to .less file to prevent potential Linter errors
76 public function getBackgroundColor( float $percentage, bool $fuzzy = false ): string {
77 if ( $fuzzy ) {
78 // Steeper scale for fuzzy
79 // (0), [0-2), [2-4), ... [12-100)
80 $index = min( 7, ceil( 50 * $percentage ) );
81 $colors = [
82 '', 'fedbd7', 'fecec8', 'fec1b9',
83 'fcb5ab', 'fba89d', 'f89b8f', 'f68d81'
84 ];
85 return $colors[ $index ];
86 }
87
88 // https://gka.github.io/palettes/#colors=#36c,#eaf3ff|steps=20|bez=1|coL=1
89 // Color groups for (0-10], (10-20], ... (90-100], (100)
90 $index = (int)floor( $percentage * 10 );
91 $colors = [
92 'eaf3ff', 'e2ebfc', 'dae3fa', 'd2dbf7', 'c9d4f5',
93 'c1ccf2', 'b8c4ef', 'b1bced', 'a8b4ea', '9fade8',
94 '96a6e5'
95 ];
96
97 return $colors[ $index ];
98 }
99
100 private function getMainColumnHeader(): string {
101 return $this->mainColumnHeader;
102 }
103
104 public function setMainColumnHeader( Message $msg ): void {
105 $this->mainColumnHeader = $this->createColumnHeader( $msg );
106 }
107
109 private function createColumnHeader( Message $msg ): string {
110 return Html::element( 'th', [], $msg->text() );
111 }
112
113 public function addExtraColumn( Message $column ): void {
114 $this->extraColumns[] = $column;
115 }
116
118 private function getOtherColumnHeaders(): array {
119 return array_merge( [
120 $this->messageLocalizer->msg( 'translate-total' ),
121 $this->messageLocalizer->msg( 'translate-untranslated' ),
122 $this->messageLocalizer->msg( 'translate-percentage-complete' ),
123 $this->messageLocalizer->msg( 'translate-percentage-proofread' ),
124 $this->messageLocalizer->msg( 'translate-percentage-fuzzy' ),
125 ], $this->extraColumns );
126 }
127
129 public function createHeader(): string {
130 // Create table header
131 $out = Html::openElement(
132 'table',
133 [ 'class' => 'statstable' ]
134 );
135
136 $out .= "\n\t" . Html::openElement( 'thead' );
137 $out .= "\n\t" . Html::openElement( 'tr' );
138
139 $out .= "\n\t\t" . $this->getMainColumnHeader();
140 foreach ( $this->getOtherColumnHeaders() as $label ) {
141 $out .= "\n\t\t" . $this->createColumnHeader( $label );
142 }
143 $out .= "\n\t" . Html::closeElement( 'tr' );
144 $out .= "\n\t" . Html::closeElement( 'thead' );
145 $out .= "\n\t" . Html::openElement( 'tbody' );
146
147 return $out;
148 }
149
156 public function makeTotalRow( Message $message, array $stats ): string {
157 $out = "\t" . Html::openElement( 'tr' );
158 $out .= "\n\t\t" . Html::element( 'td', [], $message->text() );
159 $out .= $this->makeNumberColumns( $stats );
160 $out .= "\n\t" . Xml::closeElement( 'tr' ) . "\n";
161
162 return $out;
163 }
164
169 public function makeNumberColumns( array $stats ): string {
170 $total = $stats[MessageGroupStats::TOTAL];
171 $translated = $stats[MessageGroupStats::TRANSLATED];
172 $fuzzy = $stats[MessageGroupStats::FUZZY];
173 $proofread = $stats[MessageGroupStats::PROOFREAD];
174
175 if ( $total === null ) {
176 $na = "\n\t\t" . Html::element( 'td', [ 'data-sort-value' => -1 ], '...' );
177 $nap = "\n\t\t" . $this->element( '...', 'AFAFAF', '-1' );
178 $out = $na . $na . $nap . $nap;
179
180 return $out;
181 }
182
183 $out = "\n\t\t" . Html::element( 'td',
184 [ 'data-sort-value' => $total ],
185 $this->language->formatNum( $total ) );
186
187 $out .= "\n\t\t" . Html::element( 'td',
188 [ 'data-sort-value' => $total - $translated ],
189 $this->language->formatNum( $total - $translated ) );
190
191 if ( $total === 0 ) {
192 $transRatio = 0;
193 $fuzzyRatio = 0;
194 $proofRatio = 0;
195 } else {
196 $transRatio = $translated / $total;
197 $fuzzyRatio = $fuzzy / $total;
198 $proofRatio = $translated ? $proofread / $translated : 0;
199 }
200
201 $out .= "\n\t\t" . $this->element( $this->formatPercentage( $transRatio, 'floor' ),
202 $this->getBackgroundColor( $transRatio ),
203 sprintf( '%1.5f', $transRatio ) );
204
205 $out .= "\n\t\t" . $this->element( $this->formatPercentage( $proofRatio, 'floor' ),
206 $this->getBackgroundColor( $proofRatio ),
207 sprintf( '%1.5f', $proofRatio ) );
208
209 $out .= "\n\t\t" . $this->element( $this->formatPercentage( $fuzzyRatio, 'ceil' ),
210 $this->getBackgroundColor( $fuzzyRatio, true ),
211 sprintf( '%1.5f', $fuzzyRatio ) );
212
213 return $out;
214 }
215
216 public function makeWorkflowStateCell( ?string $state, MessageGroup $group, string $language ): string {
217 if ( $state === null || $group->getSourceLanguage() === $language ) {
218 return "\n\t\t" . $this->element( '', '', '-1' );
219 }
220
221 $stateConfig = $group->getMessageGroupStates()->getStates();
222 $sortValue = '-1';
223 $stateColor = '';
224 if ( isset( $stateConfig[$state] ) ) {
225 $sortIndex = array_flip( array_keys( $stateConfig ) );
226 $sortValue = $sortIndex[$state] + 1;
227
228 if ( is_string( $stateConfig[$state] ) ) {
229 // BC for old configuration format
230 $stateColor = $stateConfig[$state];
231 } elseif ( isset( $stateConfig[$state]['color'] ) ) {
232 $stateColor = $stateConfig[$state]['color'];
233 }
234 }
235
236 $stateMessage = $this->messageLocalizer->msg( "translate-workflow-state-$state" );
237 $stateText = $stateMessage->isBlank() ? $state : $stateMessage->text();
238
239 return "\n\t\t" . $this->element(
240 $stateText,
241 $stateColor,
242 (string)$sortValue
243 );
244 }
245
252 public function formatPercentage( $num, string $to = 'floor' ): string {
253 $num = $to === 'floor' ? floor( 100 * $num ) : ceil( 100 * $num );
254 $fmt = $this->language->formatNum( $num );
255
256 return $this->messageLocalizer->msg( 'percent', $fmt )->text();
257 }
258
263 private function getGroupLabel( MessageGroup $group ): string {
264 $groupLabel = htmlspecialchars( $group->getLabel() );
265
266 // Bold for meta groups.
267 if ( $group->isMeta() ) {
268 $groupLabel = Html::rawElement( 'b', [], $groupLabel );
269 }
270
271 return $groupLabel;
272 }
273
281 public function makeGroupLink( MessageGroup $group, string $code, array $params ): string {
282 $queryParameters = $params + [
283 'group' => $group->getId(),
284 'language' => $code
285 ];
286
287 return $this->linkRenderer->makeLink(
288 $this->translate,
289 new HtmlArmor( $this->getGroupLabel( $group ) ),
290 [],
291 $queryParameters
292 );
293 }
294
301 public function isExcluded( MessageGroup $group, string $code ): bool {
302 $excluded = null;
303 $groupId = $group->getId();
304
305 $checks = [
306 $groupId,
307 strtok( $groupId, '-' ),
308 '*'
309 ];
310
311 $disabledLanguages = $this->configHelper->getDisabledTargetLanguages();
312
313 foreach ( $checks as $check ) {
314 if ( isset( $disabledLanguages[$check] ) && isset( $disabledLanguages[$check][$code] ) ) {
315 $excluded = $disabledLanguages[$check][$code];
316 }
317
318 if ( $excluded !== null ) {
319 break;
320 }
321 }
322
323 $languages = $group->getTranslatableLanguages();
324 if ( $languages !== null && !isset( $languages[$code] ) ) {
325 $excluded = true;
326 }
327
328 if ( $this->messageGroupMetadata->isExcluded( $groupId, $code ) ) {
329 $excluded = true;
330 }
331
332 return (bool)$excluded;
333 }
334}
return[ 'Translate:AggregateGroupManager'=> static function(MediaWikiServices $services):AggregateGroupManager { return new AggregateGroupManager($services->getTitleFactory(), $services->get( 'Translate:MessageGroupMetadata'));}, 'Translate:AggregateGroupMessageGroupFactory'=> static function(MediaWikiServices $services):AggregateGroupMessageGroupFactory { return new AggregateGroupMessageGroupFactory($services->get( 'Translate:MessageGroupMetadata'));}, 'Translate:ConfigHelper'=> static function():ConfigHelper { return new ConfigHelper();}, 'Translate:CsvTranslationImporter'=> static function(MediaWikiServices $services):CsvTranslationImporter { return new CsvTranslationImporter( $services->getWikiPageFactory());}, 'Translate:EntitySearch'=> static function(MediaWikiServices $services):EntitySearch { return new EntitySearch($services->getMainWANObjectCache(), $services->getCollationFactory() ->makeCollation( 'uca-default-u-kn'), MessageGroups::singleton(), $services->getNamespaceInfo(), $services->get( 'Translate:MessageIndex'), $services->getTitleParser(), $services->getTitleFormatter());}, 'Translate:ExternalMessageSourceStateComparator'=> static function(MediaWikiServices $services):ExternalMessageSourceStateComparator { return new ExternalMessageSourceStateComparator(new SimpleStringComparator(), $services->getRevisionLookup(), $services->getPageStore());}, 'Translate:ExternalMessageSourceStateImporter'=> static function(MediaWikiServices $services):ExternalMessageSourceStateImporter { return new ExternalMessageSourceStateImporter($services->get( 'Translate:GroupSynchronizationCache'), $services->getJobQueueGroup(), LoggerFactory::getInstance(LogNames::GROUP_SYNCHRONIZATION), $services->get( 'Translate:MessageIndex'), $services->getTitleFactory(), $services->get( 'Translate:MessageGroupSubscription'), new ServiceOptions(ExternalMessageSourceStateImporter::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));}, 'Translate:FileBasedMessageGroupFactory'=> static function(MediaWikiServices $services):FileBasedMessageGroupFactory { return new FileBasedMessageGroupFactory(new MessageGroupConfigurationParser(), new ServiceOptions(FileBasedMessageGroupFactory::SERVICE_OPTIONS, $services->getMainConfig()),);}, 'Translate:FileFormatFactory'=> static function(MediaWikiServices $services):FileFormatFactory { return new FileFormatFactory( $services->getObjectFactory());}, 'Translate:GroupSynchronizationCache'=> static function(MediaWikiServices $services):GroupSynchronizationCache { return new GroupSynchronizationCache( $services->get( 'Translate:PersistentCache'));}, 'Translate:HookDefinedMessageGroupFactory'=> static function(MediaWikiServices $services):HookDefinedMessageGroupFactory { return new HookDefinedMessageGroupFactory( $services->get( 'Translate:HookRunner'));}, 'Translate:HookRunner'=> static function(MediaWikiServices $services):HookRunner { return new HookRunner( $services->getHookContainer());}, 'Translate:MessageBundleDependencyPurger'=> static function(MediaWikiServices $services):MessageBundleDependencyPurger { return new MessageBundleDependencyPurger( $services->get( 'Translate:TranslatableBundleFactory'));}, 'Translate:MessageBundleMessageGroupFactory'=> static function(MediaWikiServices $services):MessageBundleMessageGroupFactory { return new MessageBundleMessageGroupFactory($services->get( 'Translate:MessageGroupMetadata'), new ServiceOptions(MessageBundleMessageGroupFactory::SERVICE_OPTIONS, $services->getMainConfig()),);}, 'Translate:MessageBundleStore'=> static function(MediaWikiServices $services):MessageBundleStore { return new MessageBundleStore($services->get( 'Translate:RevTagStore'), $services->getJobQueueGroup(), $services->getLanguageNameUtils(), $services->get( 'Translate:MessageIndex'), $services->get( 'Translate:MessageGroupMetadata'));}, 'Translate:MessageBundleTranslationLoader'=> static function(MediaWikiServices $services):MessageBundleTranslationLoader { return new MessageBundleTranslationLoader( $services->getLanguageFallback());}, 'Translate:MessageGroupMetadata'=> static function(MediaWikiServices $services):MessageGroupMetadata { return new MessageGroupMetadata( $services->getConnectionProvider());}, 'Translate:MessageGroupReviewStore'=> static function(MediaWikiServices $services):MessageGroupReviewStore { return new MessageGroupReviewStore($services->getConnectionProvider(), $services->get( 'Translate:HookRunner'));}, 'Translate:MessageGroupStatsTableFactory'=> static function(MediaWikiServices $services):MessageGroupStatsTableFactory { return new MessageGroupStatsTableFactory($services->get( 'Translate:ProgressStatsTableFactory'), $services->getLinkRenderer(), $services->get( 'Translate:MessageGroupReviewStore'), $services->get( 'Translate:MessageGroupMetadata'), $services->getMainConfig() ->get( 'TranslateWorkflowStates') !==false);}, 'Translate:MessageGroupSubscription'=> static function(MediaWikiServices $services):MessageGroupSubscription { return new MessageGroupSubscription($services->get( 'Translate:MessageGroupSubscriptionStore'), $services->getJobQueueGroup(), $services->getUserIdentityLookup(), LoggerFactory::getInstance(LogNames::GROUP_SUBSCRIPTION), new ServiceOptions(MessageGroupSubscription::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));}, 'Translate:MessageGroupSubscriptionHookHandler'=> static function(MediaWikiServices $services):MessageGroupSubscriptionHookHandler { return new MessageGroupSubscriptionHookHandler($services->get( 'Translate:MessageGroupSubscription'), $services->getUserFactory());}, 'Translate:MessageGroupSubscriptionStore'=> static function(MediaWikiServices $services):MessageGroupSubscriptionStore { return new MessageGroupSubscriptionStore( $services->getConnectionProvider());}, 'Translate:MessageIndex'=> static function(MediaWikiServices $services):MessageIndex { $params=(array) $services->getMainConfig() ->get( 'TranslateMessageIndex');$class=array_shift( $params);$implementationMap=['HashMessageIndex'=> HashMessageIndex::class, 'CDBMessageIndex'=> CDBMessageIndex::class, 'DatabaseMessageIndex'=> DatabaseMessageIndex::class, 'hash'=> HashMessageIndex::class, 'cdb'=> CDBMessageIndex::class, 'database'=> DatabaseMessageIndex::class,];$messageIndexStoreClass=$implementationMap[$class] ?? $implementationMap['database'];return new MessageIndex(new $messageIndexStoreClass, $services->getMainWANObjectCache(), $services->getJobQueueGroup(), $services->get( 'Translate:HookRunner'), LoggerFactory::getInstance(LogNames::MAIN), $services->getMainObjectStash(), $services->getConnectionProvider(), new ServiceOptions(MessageIndex::SERVICE_OPTIONS, $services->getMainConfig()),);}, 'Translate:MessagePrefixStats'=> static function(MediaWikiServices $services):MessagePrefixStats { return new MessagePrefixStats( $services->getTitleParser());}, 'Translate:ParsingPlaceholderFactory'=> static function():ParsingPlaceholderFactory { return new ParsingPlaceholderFactory();}, 'Translate:PersistentCache'=> static function(MediaWikiServices $services):PersistentCache { return new PersistentDatabaseCache($services->getConnectionProvider(), $services->getJsonCodec());}, 'Translate:ProgressStatsTableFactory'=> static function(MediaWikiServices $services):ProgressStatsTableFactory { return new ProgressStatsTableFactory($services->getLinkRenderer(), $services->get( 'Translate:ConfigHelper'), $services->get( 'Translate:MessageGroupMetadata'));}, 'Translate:RevTagStore'=> static function(MediaWikiServices $services):RevTagStore { return new RevTagStore( $services->getConnectionProvider());}, 'Translate:SubpageListBuilder'=> static function(MediaWikiServices $services):SubpageListBuilder { return new SubpageListBuilder($services->get( 'Translate:TranslatableBundleFactory'), $services->getLinkBatchFactory());}, 'Translate:TranslatableBundleDeleter'=> static function(MediaWikiServices $services):TranslatableBundleDeleter { return new TranslatableBundleDeleter($services->getMainObjectStash(), $services->getJobQueueGroup(), $services->get( 'Translate:SubpageListBuilder'), $services->get( 'Translate:TranslatableBundleFactory'));}, 'Translate:TranslatableBundleExporter'=> static function(MediaWikiServices $services):TranslatableBundleExporter { return new TranslatableBundleExporter($services->get( 'Translate:SubpageListBuilder'), $services->getWikiExporterFactory(), $services->getConnectionProvider());}, 'Translate:TranslatableBundleFactory'=> static function(MediaWikiServices $services):TranslatableBundleFactory { return new TranslatableBundleFactory($services->get( 'Translate:TranslatablePageStore'), $services->get( 'Translate:MessageBundleStore'));}, 'Translate:TranslatableBundleImporter'=> static function(MediaWikiServices $services):TranslatableBundleImporter { return new TranslatableBundleImporter($services->getWikiImporterFactory(), $services->get( 'Translate:TranslatablePageParser'), $services->getRevisionLookup(), $services->getNamespaceInfo(), $services->getTitleFactory(), $services->getFormatterFactory());}, 'Translate:TranslatableBundleMover'=> static function(MediaWikiServices $services):TranslatableBundleMover { return new TranslatableBundleMover($services->getMovePageFactory(), $services->getJobQueueGroup(), $services->getLinkBatchFactory(), $services->get( 'Translate:TranslatableBundleFactory'), $services->get( 'Translate:SubpageListBuilder'), $services->getConnectionProvider(), $services->getObjectCacheFactory(), $services->getMainConfig() ->get( 'TranslatePageMoveLimit'));}, 'Translate:TranslatableBundleStatusStore'=> static function(MediaWikiServices $services):TranslatableBundleStatusStore { return new TranslatableBundleStatusStore($services->getConnectionProvider() ->getPrimaryDatabase(), $services->getCollationFactory() ->makeCollation( 'uca-default-u-kn'), $services->getDBLoadBalancer() ->getMaintenanceConnectionRef(DB_PRIMARY));}, 'Translate:TranslatablePageMarker'=> static function(MediaWikiServices $services):TranslatablePageMarker { return new TranslatablePageMarker($services->getConnectionProvider(), $services->getJobQueueGroup(), $services->getLinkRenderer(), MessageGroups::singleton(), $services->get( 'Translate:MessageIndex'), $services->getTitleFormatter(), $services->getTitleParser(), $services->get( 'Translate:TranslatablePageParser'), $services->get( 'Translate:TranslatablePageStore'), $services->get( 'Translate:TranslatablePageStateStore'), $services->get( 'Translate:TranslationUnitStoreFactory'), $services->get( 'Translate:MessageGroupMetadata'), $services->getWikiPageFactory(), $services->get( 'Translate:TranslatablePageView'), $services->get( 'Translate:MessageGroupSubscription'), $services->getFormatterFactory());}, 'Translate:TranslatablePageMessageGroupFactory'=> static function(MediaWikiServices $services):TranslatablePageMessageGroupFactory { return new TranslatablePageMessageGroupFactory(new ServiceOptions(TranslatablePageMessageGroupFactory::SERVICE_OPTIONS, $services->getMainConfig()),);}, 'Translate:TranslatablePageParser'=> static function(MediaWikiServices $services):TranslatablePageParser { return new TranslatablePageParser($services->get( 'Translate:ParsingPlaceholderFactory'));}, 'Translate:TranslatablePageStateStore'=> static function(MediaWikiServices $services):TranslatablePageStateStore { return new TranslatablePageStateStore($services->get( 'Translate:PersistentCache'), $services->getPageStore());}, 'Translate:TranslatablePageStore'=> static function(MediaWikiServices $services):TranslatablePageStore { return new TranslatablePageStore($services->get( 'Translate:MessageIndex'), $services->getJobQueueGroup(), $services->get( 'Translate:RevTagStore'), $services->getConnectionProvider(), $services->get( 'Translate:TranslatableBundleStatusStore'), $services->get( 'Translate:TranslatablePageParser'), $services->get( 'Translate:MessageGroupMetadata'));}, 'Translate:TranslatablePageView'=> static function(MediaWikiServices $services):TranslatablePageView { return new TranslatablePageView($services->getConnectionProvider(), $services->get( 'Translate:TranslatablePageStateStore'), new ServiceOptions(TranslatablePageView::SERVICE_OPTIONS, $services->getMainConfig()));}, 'Translate:TranslateSandbox'=> static function(MediaWikiServices $services):TranslateSandbox { return new TranslateSandbox($services->getUserFactory(), $services->getConnectionProvider(), $services->getPermissionManager(), $services->getAuthManager(), $services->getUserGroupManager(), $services->getActorStore(), $services->getUserOptionsManager(), $services->getJobQueueGroup(), $services->get( 'Translate:HookRunner'), new ServiceOptions(TranslateSandbox::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));}, 'Translate:TranslationStashReader'=> static function(MediaWikiServices $services):TranslationStashReader { return new TranslationStashStorage( $services->getConnectionProvider() ->getPrimaryDatabase());}, 'Translate:TranslationStatsDataProvider'=> static function(MediaWikiServices $services):TranslationStatsDataProvider { return new TranslationStatsDataProvider(new ServiceOptions(TranslationStatsDataProvider::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getObjectFactory(), $services->getConnectionProvider());}, 'Translate:TranslationUnitStoreFactory'=> static function(MediaWikiServices $services):TranslationUnitStoreFactory { return new TranslationUnitStoreFactory( $services->getDBLoadBalancer());}, 'Translate:TranslatorActivity'=> static function(MediaWikiServices $services):TranslatorActivity { $query=new TranslatorActivityQuery($services->getMainConfig(), $services->getDBLoadBalancer());return new TranslatorActivity($services->getMainObjectStash(), $query, $services->getJobQueueGroup());}, 'Translate:TtmServerFactory'=> static function(MediaWikiServices $services):TtmServerFactory { $config=$services->getMainConfig();$default=$config->get( 'TranslateTranslationDefaultService');if( $default===false) { $default=null;} return new TtmServerFactory( $config->get( 'TranslateTranslationServices'), $default);}]
@phpcs-require-sorted-array
Offers functionality for reading and updating Translate group related metadata.
This class aims to provide efficient mechanism for fetching translation completion stats.
Implements generation of HTML stats table.
makeTotalRow(Message $message, array $stats)
Makes a row with aggregate numbers.
isExcluded(MessageGroup $group, string $code)
Check whether translations in given group in given language has been disabled.
element(string $in, string $bgcolor='', string $sort='')
Statistics table element (heading or regular cell)
formatPercentage( $num, string $to='floor')
Makes a nice print from plain float.
makeGroupLink(MessageGroup $group, string $code, array $params)
Gets the name of group linked to translation tool.
makeNumberColumns(array $stats)
Makes partial row from completion numbers.
A helper class added to work with configuration values of the Translate Extension.
Interface for message groups.
getTranslatableLanguages()
Get all the translatable languages for a group, considering the inclusion and exclusion list.
getId()
Returns the unique identifier for this group.