diff options
Diffstat (limited to 'maintenance/language/transstat.php')
-rw-r--r-- | maintenance/language/transstat.php | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/maintenance/language/transstat.php b/maintenance/language/transstat.php index 61b84a07..4a853b0f 100644 --- a/maintenance/language/transstat.php +++ b/maintenance/language/transstat.php @@ -24,7 +24,7 @@ * @author Antoine Musso <hashar at free dot fr> * * Output is posted from time to time on: - * http://www.mediawiki.org/wiki/Localisation_statistics + * https://www.mediawiki.org/wiki/Localisation_statistics */ $optionsWithArgs = array( 'output' ); @@ -32,7 +32,6 @@ require_once __DIR__ . '/../commandLine.inc'; require_once 'languages.inc'; require_once __DIR__ . '/StatOutputs.php'; - if ( isset( $options['help'] ) ) { showUsage(); } @@ -57,25 +56,23 @@ TEXT; exit( 1 ); } - - # Select an output engine switch ( $options['output'] ) { case 'wiki': - $output = new wikiStatsOutput(); + $output = new WikiStatsOutput(); break; case 'text': - $output = new textStatsOutput(); + $output = new TextStatsOutput(); break; case 'csv': - $output = new csvStatsOutput(); + $output = new CsvStatsOutput(); break; default: showUsage(); } # Languages -$wgLanguages = new languages(); +$wgLanguages = new Languages(); # Header $output->heading(); @@ -97,7 +94,8 @@ $wgRequiredMessagesNumber = count( $wgGeneralMessages['required'] ); foreach ( $wgLanguages->getLanguages() as $code ) { # Don't check English, RTL English or dummy language codes if ( $code == 'en' || $code == 'enRTL' || ( is_array( $wgDummyLanguageCodes ) && - isset( $wgDummyLanguageCodes[$code] ) ) ) { + isset( $wgDummyLanguageCodes[$code] ) ) + ) { continue; } @@ -107,16 +105,33 @@ foreach ( $wgLanguages->getLanguages() as $code ) { $messages = $wgLanguages->getMessages( $code ); $messagesNumber = count( $messages['translated'] ); $requiredMessagesNumber = count( $messages['required'] ); - $requiredMessagesPercent = $output->formatPercent( $requiredMessagesNumber, $wgRequiredMessagesNumber ); + $requiredMessagesPercent = $output->formatPercent( + $requiredMessagesNumber, + $wgRequiredMessagesNumber + ); $obsoleteMessagesNumber = count( $messages['obsolete'] ); - $obsoleteMessagesPercent = $output->formatPercent( $obsoleteMessagesNumber, $messagesNumber, true ); + $obsoleteMessagesPercent = $output->formatPercent( + $obsoleteMessagesNumber, + $messagesNumber, + true + ); $messagesWithMismatchVariables = $wgLanguages->getMessagesWithMismatchVariables( $code ); $emptyMessages = $wgLanguages->getEmptyMessages( $code ); $messagesWithWhitespace = $wgLanguages->getMessagesWithWhitespace( $code ); $nonXHTMLMessages = $wgLanguages->getNonXHTMLMessages( $code ); $messagesWithWrongChars = $wgLanguages->getMessagesWithWrongChars( $code ); - $problematicMessagesNumber = count( array_unique( array_merge( $messagesWithMismatchVariables, $emptyMessages, $messagesWithWhitespace, $nonXHTMLMessages, $messagesWithWrongChars ) ) ); - $problematicMessagesPercent = $output->formatPercent( $problematicMessagesNumber, $messagesNumber, true ); + $problematicMessagesNumber = count( array_unique( array_merge( + $messagesWithMismatchVariables, + $emptyMessages, + $messagesWithWhitespace, + $nonXHTMLMessages, + $messagesWithWrongChars + ) ) ); + $problematicMessagesPercent = $output->formatPercent( + $problematicMessagesNumber, + $messagesNumber, + true + ); # Output them $output->blockstart(); |