32 require_once __DIR__ .
'/../commandLine.inc';
33 require_once
'languages.inc';
34 require_once __DIR__ .
'/StatOutputs.php';
36 if ( isset( $options[
'help'] ) ) {
40 # Default output is WikiText
41 if ( !isset( $options[
'output'] ) ) {
42 $options[
'output'] =
'wiki';
48 Usage: php transstat.php [--help] [--output=csv|text|wiki]
49 --help :
this helpful message
50 --output : select an output engine one of:
51 *
'csv' : Comma Separated Values.
53 *
'text' : Text with tabs.
54 Example: php maintenance/transstat.php --output=text
60 # Select an output engine
61 switch ( $options[
'output'] ) {
81 $output->element(
'Language',
true );
82 $output->element(
'Code',
true );
83 $output->element(
'Fallback',
true );
84 $output->element(
'Translated',
true );
86 $output->element(
'Obsolete',
true );
88 $output->element(
'Problematic',
true );
95 foreach (
$languages->getLanguages() as $code ) {
96 # Don't check English, RTL English or dummy language codes
103 # Calculate the numbers
107 $messagesNumber = count( $messages[
'translated'] );
108 $requiredMessagesNumber = count( $messages[
'required'] );
109 $requiredMessagesPercent =
$output->formatPercent(
110 $requiredMessagesNumber,
113 $obsoleteMessagesNumber = count( $messages[
'obsolete'] );
114 $obsoleteMessagesPercent =
$output->formatPercent(
115 $obsoleteMessagesNumber,
119 $messagesWithMismatchVariables =
$languages->getMessagesWithMismatchVariables( $code );
120 $emptyMessages =
$languages->getEmptyMessages( $code );
121 $messagesWithWhitespace =
$languages->getMessagesWithWhitespace( $code );
122 $nonXHTMLMessages =
$languages->getNonXHTMLMessages( $code );
123 $messagesWithWrongChars =
$languages->getMessagesWithWrongChars( $code );
124 $problematicMessagesNumber = count( array_unique( array_merge(
125 $messagesWithMismatchVariables,
127 $messagesWithWhitespace,
129 $messagesWithWrongChars
131 $problematicMessagesPercent =
$output->formatPercent(
132 $problematicMessagesNumber,
139 $output->element(
"$language" );
141 $output->element(
"$fallback" );
142 $output->element(
"$requiredMessagesNumber/$wgRequiredMessagesNumber" );
143 $output->element( $requiredMessagesPercent );
144 $output->element(
"$obsoleteMessagesNumber/$messagesNumber" );
145 $output->element( $obsoleteMessagesPercent );
146 $output->element(
"$problematicMessagesNumber/$messagesNumber" );
147 $output->element( $problematicMessagesPercent );