r110781 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110780‎ | r110781 | r110782 >
Date:20:59, 6 February 2012
Author:nikerabbit
Status:ok
Tags:i18nreview 
Comment:
Ensure consistent order for stats, helps to implement the API module
Modified paths:
  • /trunk/extensions/Translate/utils/MessageGroupStats.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/utils/MessageGroupStats.php
@@ -204,11 +204,18 @@
205205
206206 # Go over each language filling missing entries
207207 $languages = array_keys( Language::getLanguageNames( false ) );
 208+ // This is for calculating things in correct order
 209+ sort( $languages );
208210 foreach ( $languages as $code ) {
209211 if ( isset( $stats[$id][$code] ) ) continue;
210212 $stats[$id][$code] = self::forItemInternal( $stats, $group, $code );
211213 }
212214
 215+ // This is for sorting the values added later in correct order
 216+ foreach ( array_keys( $stats ) as $key ) {
 217+ ksort( $stats[$key] );
 218+ }
 219+
213220 return $stats;
214221 }
215222

Status & tagging log