Adding checktrans script.
authorLee Daniel Crocker <lcrocker@users.mediawiki.org>
Wed, 23 Apr 2003 20:17:47 +0000 (20:17 +0000)
committerLee Daniel Crocker <lcrocker@users.mediawiki.org>
Wed, 23 Apr 2003 20:17:47 +0000 (20:17 +0000)
maintenance/checktrans.php [new file with mode: 0644]

diff --git a/maintenance/checktrans.php b/maintenance/checktrans.php
new file mode 100644 (file)
index 0000000..f390a4f
--- /dev/null
@@ -0,0 +1,48 @@
+<?
+
+# 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.
+#
+
+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";
+include_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 );
+
+include_once( "{$IP}/Setup.php" );
+$wgTitle = Title::newFromText( "Translation checking script" );
+$wgCommandLineMode = true;
+
+$count = $total = 0;
+$msgarray = "wgAllMessages" . ucfirst( $wgLanguageCode );
+
+foreach ( $wgAllMessagesEn as $code => $msg ) {
+       ++$total;
+
+       if ( ! array_key_exists( $code, $$msgarray ) ) {
+               print "{$code}\n";
+               ++$count;
+       }
+}
+print "{$count} messages of {$total} not translated.\n";
+