r107052 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107051‎ | r107052 | r107053 >
Date:10:23, 22 December 2011
Author:nikerabbit
Status:ok (Comments)
Tags:
Comment:
I18n #319: don't show discouraged groups in Special:LanguageStats
Modified paths:
  • /trunk/extensions/Translate/specials/SpecialLanguageStats.php (modified) (history)
  • /trunk/extensions/Translate/utils/MessageGroupStats.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/utils/MessageGroupStats.php
@@ -231,10 +231,18 @@
232232
233233 $aggregates = array( 0, 0, 0 );
234234 foreach ( $group->getGroups() as $sid => $sgroup ) {
 235+ # Discouraged groups may belong to a another group, usually if there
 236+ # is a aggregate group for all translatable pages. In that case
 237+ # calculate and store the statistics, but don't count them as part of
 238+ # the aggregate group, so that the numbers in Special:LanguageStats
 239+ # add up. The statistics for discouraged groups can still be viewed
 240+ # through Special:MessageGroupStats.
235241 if ( !isset( $stats[$sid][$code] ) ) {
236242 $stats[$sid][$code] = self::forItemInternal( $stats, $sgroup, $code );
237243 }
238 - $aggregates = self::multiAdd( $aggregates, $stats[$sid][$code] );
 244+ if ( MessageGroups::getPriority( $sgroup ) !== 'discouraged' ) {
 245+ $aggregates = self::multiAdd( $aggregates, $stats[$sid][$code] );
 246+ }
239247 }
240248 $stats[$id][$code] = $aggregates;
241249 } else {
Index: trunk/extensions/Translate/specials/SpecialLanguageStats.php
@@ -299,6 +299,12 @@
300300 return '';
301301 }
302302
 303+ # These are hidden, and the code in MessageGroupStats makes sure that
 304+ # these are not counted in the aggregate groups they may belong.
 305+ if ( MessageGroups::getPriority( $group ) === 'discouraged' ) {
 306+ return '';
 307+ }
 308+
303309 $stats = $cache[$group->getId()];
304310
305311 list( $total, $translated, $fuzzy ) = $stats;

Follow-up revisions

RevisionCommit summaryAuthorDate
r107268Followup r107052 - purge the cache too...nikerabbit12:19, 25 December 2011

Comments

#Comment by Siebrand (talk | contribs)   00:16, 25 December 2011

The message groups are hidden, but the counts are still there. Those should be removed, too. See translatewiki:Special:LanguageStats/nl which shows 2 untranslated messages in "Translatable pages" for a message group that's not there.

#Comment by Nikerabbit (talk | contribs)   10:26, 25 December 2011

Did you clear the stats with ?action=purge? I'm pretty sure I tested this scenario too, although I didn't add automatic cache purging.

#Comment by Siebrand (talk | contribs)   11:12, 25 December 2011

Gotcha. That must have been it.

Status & tagging log