Updated the checktrans.php script to be a little more modern and to
authorEvan Prodromou <evanprodromou@users.mediawiki.org>
Sun, 10 Oct 2004 23:28:45 +0000 (23:28 +0000)
committerEvan Prodromou <evanprodromou@users.mediawiki.org>
Sun, 10 Oct 2004 23:28:45 +0000 (23:28 +0000)
WFM. Removed the two variations on the theme, since they don't work.
Might as well have just one broken script instead of three.

maintenance/checktrans-enhanced.php [deleted file]
maintenance/checktrans.php
maintenance/checktrans2.php [deleted file]

diff --git a/maintenance/checktrans-enhanced.php b/maintenance/checktrans-enhanced.php
deleted file mode 100644 (file)
index 2fd4819..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-/**
- * Check to see if all messages have been translated into
- * the selected language. To run this script, you must have
- * a working installation, and it checks the selected language
- * of that installation.
- *
- * The enhanced version will check more arrays than just
- * wgAllMessages
- *
- * @todo document
- * @package MediaWiki
- * @subpackage Maintenance
- */
-
-/** */
-function check($arrayname) {
-       $arraynameprinted = 0;
-       
-       global $count, $total, $wgLanguageCode;
-
-       $msgarray = $arrayname . ucfirst( $wgLanguageCode );
-       $msgarrayen = $arrayname . "En";
-
-       global $$msgarray;
-       global $$msgarrayen;
-
-       foreach ( $$msgarrayen as $code => $msg ) {
-               ++$total;
-
-               if ( ! array_key_exists( $code, $$msgarray ) ) {
-                       if (!$arraynameprinted) {
-                               print("\nIn array '$msgarray':\n");
-                               $arraynameprinted = 1;
-                       }
-
-                       print "{$code}\n";
-                       ++$count;
-               }
-       }
-}
-
-if ( ! is_readable( "../LocalSettings.php" ) ) {
-       print "A copy of your installation's LocalSettings.php\n" .
-         "must exist in the source directory.\n";
-       exit();
-}
-
-$DP = "../includes";
-require_once( "../LocalSettings.php" );
-
-if ( "en" == $wgLanguageCode ) {
-       print "Current selected language is English. Cannot check translations.\n";
-       exit();
-}
-$include = "Language" . ucfirst( $wgLanguageCode ) . ".php";
-if ( ! is_readable( "{$IP}/{$include}" ) ) {
-       print "Translation file \"{$include}\" not found in installation directory.\n" .
-         "You must have the software installed to run this script.\n";
-       exit();
-}
-
-umask( 000 );
-set_time_limit( 0 );
-
-require_once( "{$IP}/Setup.php" );
-$wgTitle = Title::newFromText( "Translation checking script" );
-$wgCommandLineMode = true;
-
-$count = $total = 0;
-
-
-check("wgLanguageNames");
-check("wgNamespaceNames");
-check("wgDefaultUserOptions");
-check("wgQuickbarSettings");
-check("wgSkinNames");
-check("wgMathNames");
-check("wgUserToggles");
-check("wgWeekdayNames");
-check("wgMonthNames");
-check("wgMonthAbbreviations");
-check("wgValidSpecialPages");
-check("wgSysopSpecialPages");
-check("wgDeveloperSpecialPages");
-check("wgAllMessages");
-
-print "{$count} messages of {$total} not translated.\n";
index af8217b..172e1e4 100644 (file)
@@ -1,51 +1,29 @@
 <?php
-/**
- * Check to see if all messages have been translated into
- * the selected language. To run this script, you must have
- * a working installation, and it checks the selected language
- * of that installation.
- *
- * @package MediaWiki
- * @subpackage Maintenance
-*/
 
-/** */
-if ( ! is_readable( "../LocalSettings.php" ) ) {
-       print "A copy of your installation's LocalSettings.php\n" .
-         "must exist in the source directory.\n";
-       exit();
-}
+# Check to see if all messages have been translated into
+# the selected language. To run this script, you must have
+# a working installation, and it checks the selected language
+# of that installation.
+#
 
-$wgCommandLineMode = true;
-$DP = "../includes";
-require_once( "../LocalSettings.php" );
+require_once("commandLine.inc");
 
 if ( "en" == $wgLanguageCode ) {
        print "Current selected language is English. Cannot check translations.\n";
        exit();
 }
-$include = "Language" . ucfirst( $wgLanguageCode ) . ".php";
-if ( ! is_readable( "{$IP}/{$include}" ) ) {
-       print "Translation file \"{$include}\" not found in installation directory.\n" .
-         "You must have the software installed to run this script.\n";
-       exit();
-}
-
-umask( 000 );
-set_time_limit( 0 );
-
-require_once( "{$IP}/Setup.php" );
-$wgTitle = Title::newFromText( "Translation checking script" );
 
 $count = $total = 0;
 $msgarray = "wgAllMessages" . ucfirst( $wgLanguageCode );
 
 foreach ( $wgAllMessagesEn as $code => $msg ) {
        ++$total;
-
        if ( ! array_key_exists( $code, $$msgarray ) ) {
-               print "{$code}\n";
+               print "'{$code}' => \"$msg\",\n";
                ++$count;
        }
 }
+
 print "{$count} messages of {$total} not translated.\n";
+
+?>
diff --git a/maintenance/checktrans2.php b/maintenance/checktrans2.php
deleted file mode 100755 (executable)
index c9fb358..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php
-/**
- * @deprecated
- * @package MediaWiki
- * @subpackage Maintenance
- */
-
-/** */
-die("This script is not being maintained.");
-
-# Checks translation of all language files
-function wfLocalUrl() { return "";}
-function wfLocalUrle() { return "";}
-
-function check($arrayname, $lang, $text)
-{
-       $arraynameprinted = 0;
-       
-       global $count, $total;
-
-       $msgarray = $arrayname . ucfirst( $lang );
-       $msgarrayen = $arrayname . "En";
-
-       eval( $text );
-       if ( !is_array( $$msgarrayen ) ) {
-               print "\nArray '$msgarrayen' not present\n";
-               return;
-       } elseif ( !is_array( $$msgarray ) ) {
-               print "\nArray '$msgarray' not present\n";
-               return;
-       }
-
-       foreach ( $$msgarrayen as $code => $msg ) {
-               ++$total;
-
-               if ( ! array_key_exists( $code, $$msgarray ) ) {
-                       if (!$arraynameprinted) {
-                               print("\nIn array '$msgarray':\n");
-                               $arraynameprinted = 1;
-                       }
-                       
-                       if ( is_numeric( $code ) ) {
-                               print "$code ($msg)\n";
-                       } else {
-                               print "{$code}\n";
-                       }
-                       ++$count;
-               }
-       }
-}
-
-function getLanguage( $lang )
-{
-       $fileName = "../languages/Language" . ucfirst( $lang ) . ".php";
-       $file = fopen( $fileName, "r" );
-       $text = fread( $file, filesize( $fileName ) );
-       $clipPos = strpos( $text, "class Language" );
-       $text = substr( $text, 0, $clipPos );
-       $text = preg_replace( "/^<\?(php|)/", "", $text );
-       $text = preg_replace( "/^include.*$/m", "", $text );
-       
-       return $text;
-}
-       
-function checkLanguage( $lang, $enText ) 
-{
-       $text = $enText . getLanguage( $lang );
-       check("wgLanguageNames", $lang, $text);
-       check("wgNamespaceNames", $lang, $text);
-       check("wgDefaultUserOptions", $lang, $text);
-       check("wgQuickbarSettings", $lang, $text);
-       check("wgSkinNames", $lang, $text);
-       check("wgMathNames", $lang, $text);
-       check("wgUserToggles", $lang, $text);
-       check("wgWeekdayNames", $lang, $text);
-       check("wgMonthNames", $lang, $text);
-       check("wgMonthAbbreviations", $lang, $text);
-       check("wgValidSpecialPages", $lang, $text);
-       check("wgSysopSpecialPages", $lang, $text);
-       check("wgDeveloperSpecialPages", $lang, $text);
-       check("wgAllMessages", $lang, $text);
-       check("wgMagicWords", $lang, $text);
-}
-
-if ( $argc > 1 ) {
-       array_shift( $argv );
-       $glob = implode( " ", $argv );
-} else {
-       $glob = "../languages/Language?*.php";
-}
-
-umask( 000 );
-set_time_limit( 0 );
-$count = $total = 0;
-$enText = getLanguage( "" );
-$filenames = glob( $glob );
-$width = 80;
-foreach ( $filenames as $filename ) {
-       if ( preg_match( "/languages\/Language(.*)\.php/", $filename, $m ) ) {
-               $lang = strtolower( $m[1] );
-               if ( $lang != "utf8" ) {
-                       print "\n" . str_repeat( "-", $width );
-                       print "\n$lang\n";
-                       print str_repeat( "-", $width ) . "\n";
-                       checkLanguage( $lang, $enText );
-               }
-       }
-}
-
-print "\n" . str_repeat( "-", $width ) . "\n";
-print "{$count} messages of {$total} not translated.\n";