Showing statistics about problematic messages, instead of duplicate messages - it...
authorRotem Liss <rotem@users.mediawiki.org>
Sun, 20 Aug 2006 11:57:30 +0000 (11:57 +0000)
committerRotem Liss <rotem@users.mediawiki.org>
Sun, 20 Aug 2006 11:57:30 +0000 (11:57 +0000)
maintenance/transstat.php

index abf8644..7f0a6fd 100644 (file)
@@ -61,6 +61,7 @@ class statsOutput {
 class wikiStatsOutput extends statsOutput {
        function heading() {
                echo "'''Note:''' These statistics can be generated by running <code>php maintenance/transstat.php</code>.\n\n";
+               echo "For additional information on specific languages (the message names, the actual problems, etc.), run <code>php maintenance/checkLanguage.php --lang=foo</code>.\n\n";
                echo "{| border=2 cellpadding=4 cellspacing=0 style=\"background: #f9f9f9; border: 1px #aaa solid; border-collapse: collapse;\" width=100%\n";
        }
        function footer() {
@@ -141,10 +142,10 @@ $wgOut->blockstart();
 $wgOut->element( 'Language', true );
 $wgOut->element( 'Translated', true );
 $wgOut->element( '%', true );
-$wgOut->element( 'Same to English', true );
-$wgOut->element( '%', true );
 $wgOut->element( 'Obsolete', true );
 $wgOut->element( '%', true );
+$wgOut->element( 'Problematic', true );
+$wgOut->element( '%', true );
 $wgOut->blockend();
 
 foreach ( $wgLanguages->getList() as $code ) {
@@ -159,20 +160,25 @@ foreach ( $wgLanguages->getList() as $code ) {
        $localMessagesNumber = count( $wgLanguages->getMessagesFor( $code ) );
        $translatedMessagesNumber = count( $wgLanguages->getTranslatedMessages( $code ) );
        $translatedMessagesPercent = $wgOut->formatPercent( $translatedMessagesNumber, $translatableMessagesNumber );
-       $duplicateMessagesNumber = count( $wgLanguages->getDuplicateMessages( $code ) );
-       $duplicateMessagesPercent = $wgOut->formatPercent( $duplicateMessagesNumber, $translatedMessagesNumber, true );
        $obsoleteMessagesNumber = count( $wgLanguages->getObsoleteMessages( $code ) );
        $obsoleteMessagesPercent = $wgOut->formatPercent( $obsoleteMessagesNumber, $translatedMessagesNumber, true );
+       $messagesWithoutVariables = $wgLanguages->getMessagesWithoutVariables( $code );
+       $emptyMessages = $wgLanguages->getEmptyMessages( $code );
+       $messagesWithWhitespace = $wgLanguages->getMessagesWithWhitespace( $code );
+       $nonXHTMLMessages = $wgLanguages->getNonXHTMLMessages( $code );
+       $messagesWithWrongChars = $wgLanguages->getMessagesWithWrongChars( $code );
+       $problematicMessagesNumber = count( array_unique( array_merge( $messagesWithoutVariables, $emptyMessages, $messagesWithWhitespace, $nonXHTMLMessages, $messagesWithWrongChars ) ) );
+       $problematicMessagesPercent = $wgOut->formatPercent( $problematicMessagesNumber, $translatedMessagesNumber, true );
 
        # Output them
        $wgOut->blockstart();
        $wgOut->element( "$name ($code)" );
        $wgOut->element( "$translatedMessagesNumber/$translatableMessagesNumber" );
        $wgOut->element( $translatedMessagesPercent );
-       $wgOut->element( "$duplicateMessagesNumber/$translatedMessagesNumber" );
-       $wgOut->element( $duplicateMessagesPercent );
        $wgOut->element( "$obsoleteMessagesNumber/$translatedMessagesNumber" );
        $wgOut->element( $obsoleteMessagesPercent );
+       $wgOut->element( "$problematicMessagesNumber/$translatedMessagesNumber" );
+       $wgOut->element( $problematicMessagesPercent );
        $wgOut->blockend();
 }