Index: trunk/extensions/Translate/scripts/groupStatistics.php |
— | — | @@ -92,7 +92,11 @@ |
93 | 93 | } |
94 | 94 | |
95 | 95 | if ( isset( $options['help'] ) ) showUsage(); |
96 | | -if ( !isset( $options['groups'] ) ) showUsage(); |
| 96 | + |
| 97 | +// Show help and exit if '--most' does not have a valid value and no groups set |
| 98 | +if ( !isset( $localisedWeights[$options['most']] ) && !isset( $options['groups'] ) ) { |
| 99 | + showUsage(); |
| 100 | +} |
97 | 101 | if ( !isset( $options['output'] ) ) $options['output'] = 'default'; |
98 | 102 | |
99 | 103 | /** Print a usage message*/ |
— | — | @@ -109,9 +113,9 @@ |
110 | 114 | * 'metawiki' : MediaWiki syntax used for Meta-Wiki. |
111 | 115 | * 'text' : Text with tabs. |
112 | 116 | --most : [SCOPE]: report on the 50 most spoken languages. Skipzero is |
113 | | - ignored. If a valid scope is defined, the group list is |
114 | | - ignored and the localisation levels are weighted and |
115 | | - reported. |
| 117 | + ignored. If a valid scope is defined, the group list |
| 118 | + and fuzzy are ignored and the localisation levels are |
| 119 | + weighted and reported. |
116 | 120 | * mediawiki: |
117 | 121 | core-mostused (30%) |
118 | 122 | core (30%) |
— | — | @@ -158,9 +162,18 @@ |
159 | 163 | $skipLanguages = array_map( 'trim', explode( ',', $options['skiplanguages'] ) ); |
160 | 164 | } |
161 | 165 | |
| 166 | +$reportScore = false; |
| 167 | +if ( isset( $options['most'] ) && isset( $localisedWeights[$options['most']] ) ) { |
| 168 | + $reportScore = true; |
| 169 | +} |
| 170 | + |
162 | 171 | // Get groups from input |
163 | 172 | $groups = array(); |
164 | | -$reqGroups = array_map( 'trim', explode( ',', $options['groups'] ) ); |
| 173 | +if( $reportScore ) { |
| 174 | + $reqGroups = array_keys( $localisedWeights[$options['most']] ); |
| 175 | +} else { |
| 176 | + $reqGroups = array_map( 'trim', explode( ',', $options['groups'] ) ); |
| 177 | +} |
165 | 178 | |
166 | 179 | // List of all groups |
167 | 180 | $allGroups = MessageGroups::singleton()->getGroups(); |
— | — | @@ -199,6 +212,9 @@ |
200 | 213 | if( isset( $options['most'] ) && isset( $options['speakers'] ) ) { |
201 | 214 | $out->element( 'Speakers', true ); |
202 | 215 | } |
| 216 | +/*if( $reportScore ) { |
| 217 | + $out->element( 'Score', true ); |
| 218 | +}*/ |
203 | 219 | foreach ( $groups as $g ) { |
204 | 220 | // Add unprocessed description of group as heading |
205 | 221 | $out->element( $g->getLabel(), true ); |
— | — | @@ -327,8 +343,15 @@ |
328 | 344 | $out->element( number_format( $mostSpokenLanguages[$code][3] ) ); |
329 | 345 | } |
330 | 346 | |
| 347 | + // Fill the score field |
| 348 | + /*if( $reportScore ) { |
| 349 | + $weights = $localisedWeights[$options['most']]; |
| 350 | + }*/ |
| 351 | + |
331 | 352 | // Fill fields for groups |
332 | 353 | foreach ( $columns as $fields ) { |
| 354 | + //var_dump( $fields, true ); |
| 355 | + //exit(1); |
333 | 356 | list( $invert, $upper, $total ) = $fields; |
334 | 357 | $c = $out->formatPercent( $upper, $total, $invert, /* Decimals */ 2 ); |
335 | 358 | $out->element( $c ); |