Index: trunk/extensions/Translate/Translate.i18n.php |
— | — | @@ -242,6 +242,7 @@ |
243 | 243 | 'translate-languagestats-groups' => ' # Add message group IDs, one per line to restrict the message groups that |
244 | 244 | # are shown on Special:LanguageStats. Non-existing message group IDs will |
245 | 245 | # be ignored.', # do not duplicate this message to other languages |
| 246 | + 'translate-languagestats-overall' => 'All message groups together', |
246 | 247 | |
247 | 248 | # Special:SupportedLanguages |
248 | 249 | 'supportedlanguages' => 'Supported languages', |
Index: trunk/extensions/Translate/specials/SpecialLanguageStats.php |
— | — | @@ -206,6 +206,7 @@ |
207 | 207 | function getGroupStats( $code, $suppressComplete = false ) { |
208 | 208 | $this->code = $code; |
209 | 209 | $this->suppressComplete = $suppressComplete; |
| 210 | + $this->totals = array( 0, 0, 0 ); |
210 | 211 | |
211 | 212 | $out = ''; |
212 | 213 | |
— | — | @@ -220,6 +221,7 @@ |
221 | 222 | |
222 | 223 | if ( $out ) { |
223 | 224 | $out = $this->createHeader( $code ) . "\n" . $out; |
| 225 | + $out .= $this->makeTotalRow( $this->totals ); |
224 | 226 | $out .= Xml::closeElement( 'tbody' ); |
225 | 227 | $out .= Xml::closeElement( 'table' ); |
226 | 228 | } else { |
— | — | @@ -229,6 +231,36 @@ |
230 | 232 | return $out; |
231 | 233 | } |
232 | 234 | |
| 235 | + protected function makeTotalRow( $numbers ) { |
| 236 | + list( $fuzzy, $translated, $total ) = $numbers; |
| 237 | + $out = "\t" . Html::openElement( 'tr' ); |
| 238 | + $out .= "\n\t\t" . Html::rawElement( 'td', array(), wfMsg( 'translate-languagestats-overall' ) ); |
| 239 | + $out .= $this->makeNumberColumns( $fuzzy, $translated, $total ); |
| 240 | + return $out; |
| 241 | + } |
| 242 | + |
| 243 | + protected function makeNumberColumns( $fuzzy, $translated, $total ) { |
| 244 | + global $wgLang; |
| 245 | + $out = "\n\t\t" . Html::element( 'td', |
| 246 | + array( 'data-sort-value' => $total ), |
| 247 | + $wgLang->formatNum( $total ) ); |
| 248 | + |
| 249 | + $out .= "\n\t\t" . Html::element( 'td', |
| 250 | + array( 'data-sort-value' => $total - $translated ), |
| 251 | + $wgLang->formatNum( $total - $translated ) ); |
| 252 | + |
| 253 | + $out .= "\n\t\t" . $this->element( $this->formatPercentage( $translated / $total ), |
| 254 | + $this->getBackgroundColour( $translated, $total ), |
| 255 | + sprintf( '%1.3f', $translated / $total ) ); |
| 256 | + |
| 257 | + $out .= "\n\t\t" . $this->element( $this->formatPercentage( $fuzzy / $total ), |
| 258 | + $this->getBackgroundColour( $fuzzy, $total, true ), |
| 259 | + sprintf( '%1.3f', $fuzzy / $total ) ); |
| 260 | + |
| 261 | + $out .= "\n\t" . Xml::closeElement( 'tr' ) . "\n"; |
| 262 | + return $out; |
| 263 | + } |
| 264 | + |
233 | 265 | protected function makeGroupGroup( $item, $cache, $parent = '' ) { |
234 | 266 | if ( !is_array( $item ) ) { |
235 | 267 | return $this->makeGroupRow( $item, $cache, $parent === '' ? false : $parent ); |
— | — | @@ -273,6 +305,10 @@ |
274 | 306 | list( $fuzzy, $translated, $total ) = $this->loadPercentages( $cache, $g, $code ); |
275 | 307 | } |
276 | 308 | |
| 309 | + $this->totals[2] += $total; |
| 310 | + $this->totals[1] += $translated; |
| 311 | + $this->totals[0] += $fuzzy; |
| 312 | + |
277 | 313 | if ( $total == 0 ) { |
278 | 314 | $zero = serialize( $total ); |
279 | 315 | error_log( __METHOD__ . ": Group $groupName has zero message ($code): $zero" ); |
— | — | @@ -300,24 +336,7 @@ |
301 | 337 | |
302 | 338 | $out .= "\t" . Html::openElement( 'tr', $rowParams ); |
303 | 339 | $out .= "\n\t\t" . Html::rawElement( 'td', array(), $this->makeGroupLink( $g, $code, $extra ) ); |
304 | | - |
305 | | - $out .= "\n\t\t" . Html::element( 'td', |
306 | | - array( 'data-sort-value' => $total ), |
307 | | - $wgLang->formatNum( $total ) ); |
308 | | - |
309 | | - $out .= "\n\t\t" . Html::element( 'td', |
310 | | - array( 'data-sort-value' => $total - $translated ), |
311 | | - $wgLang->formatNum( $total - $translated ) ); |
312 | | - |
313 | | - $out .= "\n\t\t" . $this->element( $this->formatPercentage( $translated / $total ), |
314 | | - $this->getBackgroundColour( $translated, $total ), |
315 | | - sprintf( '%1.3f', $translated / $total ) ); |
316 | | - |
317 | | - $out .= "\n\t\t" . $this->element( $this->formatPercentage( $fuzzy / $total ), |
318 | | - $this->getBackgroundColour( $fuzzy, $total, true ), |
319 | | - sprintf( '%1.3f', $fuzzy / $total ) ); |
320 | | - |
321 | | - $out .= "\n\t" . Xml::closeElement( 'tr' ) . "\n"; |
| 340 | + $out .= $this->makeNumberColumns( $fuzzy, $translated, $total ); |
322 | 341 | return $out; |
323 | 342 | } |
324 | 343 | |
— | — | @@ -334,6 +353,20 @@ |
335 | 354 | |
336 | 355 | // Initialise messages. |
337 | 356 | $collection = $group->initCollection( $code ); |
| 357 | + |
| 358 | + $ffs = $group->getFFS(); |
| 359 | + if ( $ffs instanceof GettextFFS && $code === 'qqq' ) { |
| 360 | + $template = $ffs->read( 'en' ); |
| 361 | + $infile = array(); |
| 362 | + foreach( $template['TEMPLATE'] as $key => $data ) { |
| 363 | + if ( isset( $data['comments']['.'] ) ) { |
| 364 | + $infile[$key] = '1'; |
| 365 | + } |
| 366 | + } |
| 367 | + $collection->setInFile( $infile ); |
| 368 | + } |
| 369 | + |
| 370 | + |
338 | 371 | // Takes too much memory and only hides inconsistent import state |
339 | 372 | # $collection->setInFile( $group->load( $code ) ); |
340 | 373 | $collection->filter( 'ignored' ); |