X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2Flanguage%2FStatOutputs.php;h=e9d8c86dd0c5c06cd67defea964ee97fe18fa38f;hb=265cb52243ded721d55d9077648381ec7e533870;hp=7d69bf73185123a286f4944358af867b1acb8e4a;hpb=d8f23e62b03e63f9b24eed924a92e711b0cf41ef;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/language/StatOutputs.php b/maintenance/language/StatOutputs.php index 7d69bf7318..e9d8c86dd0 100644 --- a/maintenance/language/StatOutputs.php +++ b/maintenance/language/StatOutputs.php @@ -1,12 +1,29 @@ - * @author Ashar Voultoiz + * @author Antoine Musso */ /** A general output object. Need to be overriden */ @@ -31,12 +48,21 @@ class statsOutput { /** Outputs WikiText */ class wikiStatsOutput extends statsOutput { function heading() { - global $IP; + global $wgDummyLanguageCodes; $version = SpecialVersion::getVersion( 'nodb' ); echo "'''Statistics are based on:''' " . $version . "\n\n"; echo "'''Note:''' These statistics can be generated by running php maintenance/language/transstat.php.\n\n"; echo "For additional information on specific languages (the message names, the actual problems, etc.), run php maintenance/language/checkLanguage.php --lang=foo.\n\n"; - echo '{| class="sortable wikitable" border="2" cellpadding="4" cellspacing="0" style="background-color: #F9F9F9; border: 1px #AAAAAA solid; border-collapse: collapse; clear:both;" width="100%"' . "\n"; + echo 'English (en) is excluded because it is the default localization'; + if ( is_array( $wgDummyLanguageCodes ) ) { + $dummyCodes = array(); + foreach ( $wgDummyLanguageCodes as $dummyCode => $correctCode ) { + $dummyCodes[] = Language::fetchLanguageName( $dummyCode ) . ' (' . $dummyCode . ')'; + } + echo ', as well as the following languages that are not intended for system message translations, usually because they redirect to other language codes: ' . implode( ', ', $dummyCodes ); + } + echo ".\n\n"; # dot to end sentence + echo '{| class="sortable wikitable" border="2" style="background-color: #F9F9F9; border: 1px #AAAAAA solid; border-collapse: collapse; clear:both; width:100%;"' . "\n"; } function footer() { echo "|}\n"; @@ -53,6 +79,12 @@ class wikiStatsOutput extends statsOutput { function formatPercent( $subset, $total, $revert = false, $accuracy = 2 ) { $v = @round( 255 * $subset / $total ); if ( $revert ) { + # Weigh reverse with factor 20 so coloring takes effect more quickly as + # this option is used solely for reporting 'bad' percentages. + $v = $v * 20; + if ( $v > 255 ) { + $v = 255; + } $v = 255 - $v; } if ( $v < 128 ) { @@ -67,8 +99,8 @@ class wikiStatsOutput extends statsOutput { $blue = '00'; $color = $red . $green . $blue; - $percent = statsOutput::formatPercent( $subset, $total, $revert, $accuracy ); - return 'bgcolor="#' . $color . '"|' . $percent; + $percent = parent::formatPercent( $subset, $total, $revert, $accuracy ); + return 'style="background-color:#' . $color . ';"|' . $percent; } }