--conf option for specifying a different LocalSettings.php. This allows multiple...
[lhc/web/wiklou.git] / maintenance / diffLanguage.php
index e709c41..7d5c64f 100644 (file)
  *
  * The goal is to get a list of messages not yet localised in a languageXX.php
  * file using the language.php file as reference.
- * 
+ *
  * The script then print a list of wgAllMessagesXX keys that aren't localised, a
  * percentage of messages correctly localised and the number of messages to be
  * translated.
- * 
+ *
  * @package MediaWiki
  * @subpackage Maintenance
  */
 require_once( 'parserTests.inc' );
 require_once( 'commandLine.inc' );
 
-if( isset($options['help']) ) { usage(); die(); }
+if( isset($options['help']) ) { usage(); wfDie(); }
 
 $wgLanguageCode = ucfirstlcrest($wgLanguageCode);
 /** Language messages we will use as reference. By default 'en' */
 $referenceMessages = $wgAllMessagesEn;
 $referenceLanguage = 'En';
 $referenceFilename = 'Language'.$referenceLanguage.'.php';
-/** Language messages we will test. */ 
+/** Language messages we will test. */
 $testMessages = array();
 $testLanguage = '';
 /** whereas we use an external language file */
@@ -75,7 +75,7 @@ function ucfirstlcrest($string) {
 function getMediawikiMessages($languageCode = 'En') {
 
        $foo = "wgAllMessages$languageCode";
-       global $$foo;
+       global $$foo, $wgSkinNamesEn;
 
        // it might already be loaded in LocalSettings.php
        if(!isset($$foo)) {
@@ -85,7 +85,7 @@ function getMediawikiMessages($languageCode = 'En') {
                        print "Including $langFile\n";
                        global $wgNamespaceNamesEn;
                        include($langFile);
-               } else die("ERROR: The file $langFile does not exist !\n");
+               } else wfDie("ERROR: The file $langFile does not exist !\n");
        }
        return $$foo;
 }
@@ -121,10 +121,10 @@ if ( isset($args[0]) ) {
 
        // Load datas from MediaWiki
        $testMessages = getMediawikiMessages($lang);
-       $testLanguage = $lang;          
+       $testLanguage = $lang;
 } else {
        usage();
-       die();
+       wfDie();
 }
 
 /** parsertest is used to do differences */
@@ -148,7 +148,7 @@ foreach($referenceMessages as $index => $ref)
                print "'$index' => \"$ref\",\n";
        // Messages in the same language differs
        } elseif( ($lang == $referenceLanguage) AND ($testMessages[$index] != $ref)) {
-               print "$index differs:\n";
+               print "\n$index differs:\n";
                print $myParserTest->quickDiff($testMessages[$index],$ref,'tested','reference');
        }
 }