]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - maintenance/language/diffLanguage.php
MediaWiki 1.11.0
[autoinstallsdev/mediawiki.git] / maintenance / language / diffLanguage.php
similarity index 87%
rename from maintenance/diffLanguage.php
rename to maintenance/language/diffLanguage.php
index e709c415b471b87033966bb68afe1fe361d53aee..05a6e4b142ad2d22cfe8a5fe999a51d953de6798 100644 (file)
@@ -15,7 +15,7 @@
 #
 # You should have received a copy of the GNU General Public License along
 # with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 # http://www.gnu.org/copyleft/gpl.html
 
 /**
  *
  * 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
+ *
+ * @addtogroup Maintenance
  */
 
 /** This script run from the commandline */
-require_once( 'parserTests.inc' );
-require_once( 'commandLine.inc' );
+require_once( dirname(__FILE__).'/../parserTests.inc' );
+require_once( dirname(__FILE__).'/../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 */
@@ -76,16 +75,17 @@ function getMediawikiMessages($languageCode = 'En') {
 
        $foo = "wgAllMessages$languageCode";
        global $$foo;
+       global $wgSkinNamesEn; // potentially unused global declaration?
 
        // it might already be loaded in LocalSettings.php
        if(!isset($$foo)) {
                global $IP;
-               $langFile = $IP.'/languages/Language'.$languageCode.'.php';
+               $langFile = $IP.'/languages/classes/Language'.$languageCode.'.php';
                if (file_exists( $langFile ) ) {
                        print "Including $langFile\n";
-                       global $wgNamespaceNamesEn;
+                       global $wgNamespaceNamesEn;  // potentially unused global declaration?
                        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,14 +121,14 @@ 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 */
-$myParserTest =& new ParserTest();
+$myParserTest = new ParserTest();
 
 # Get all references messages and check if they exist in the tested language
 $i = 0;
@@ -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');
        }
 }
@@ -156,4 +156,4 @@ foreach($referenceMessages as $index => $ref)
 echo "\n----\n".$msg;
 echo "$referenceLanguage language is complete at ".number_format((100 - $i/count($wgAllMessagesEn) * 100),2)."%\n";
 echo "$i unlocalised messages of the ".count($wgAllMessagesEn)." messages available.\n";
-?>
+