allow NULL html/mathml entries in math table
[mediawiki.git] / maintenance / checktrans2.php
blobc9fb3587d70d3cb67988e1281480eec21e3e4e14
1 <?php
2 /**
3 * @deprecated
4 * @package MediaWiki
5 * @subpackage Maintenance
6 */
8 /** */
9 die("This script is not being maintained.");
11 # Checks translation of all language files
13 function wfLocalUrl() { return "";}
14 function wfLocalUrle() { return "";}
16 function check($arrayname, $lang, $text)
18 $arraynameprinted = 0;
20 global $count, $total;
22 $msgarray = $arrayname . ucfirst( $lang );
23 $msgarrayen = $arrayname . "En";
25 eval( $text );
26 if ( !is_array( $$msgarrayen ) ) {
27 print "\nArray '$msgarrayen' not present\n";
28 return;
29 } elseif ( !is_array( $$msgarray ) ) {
30 print "\nArray '$msgarray' not present\n";
31 return;
34 foreach ( $$msgarrayen as $code => $msg ) {
35 ++$total;
37 if ( ! array_key_exists( $code, $$msgarray ) ) {
38 if (!$arraynameprinted) {
39 print("\nIn array '$msgarray':\n");
40 $arraynameprinted = 1;
43 if ( is_numeric( $code ) ) {
44 print "$code ($msg)\n";
45 } else {
46 print "{$code}\n";
48 ++$count;
53 function getLanguage( $lang )
55 $fileName = "../languages/Language" . ucfirst( $lang ) . ".php";
56 $file = fopen( $fileName, "r" );
57 $text = fread( $file, filesize( $fileName ) );
58 $clipPos = strpos( $text, "class Language" );
59 $text = substr( $text, 0, $clipPos );
60 $text = preg_replace( "/^<\?(php|)/", "", $text );
61 $text = preg_replace( "/^include.*$/m", "", $text );
63 return $text;
66 function checkLanguage( $lang, $enText )
68 $text = $enText . getLanguage( $lang );
69 check("wgLanguageNames", $lang, $text);
70 check("wgNamespaceNames", $lang, $text);
71 check("wgDefaultUserOptions", $lang, $text);
72 check("wgQuickbarSettings", $lang, $text);
73 check("wgSkinNames", $lang, $text);
74 check("wgMathNames", $lang, $text);
75 check("wgUserToggles", $lang, $text);
76 check("wgWeekdayNames", $lang, $text);
77 check("wgMonthNames", $lang, $text);
78 check("wgMonthAbbreviations", $lang, $text);
79 check("wgValidSpecialPages", $lang, $text);
80 check("wgSysopSpecialPages", $lang, $text);
81 check("wgDeveloperSpecialPages", $lang, $text);
82 check("wgAllMessages", $lang, $text);
83 check("wgMagicWords", $lang, $text);
86 if ( $argc > 1 ) {
87 array_shift( $argv );
88 $glob = implode( " ", $argv );
89 } else {
90 $glob = "../languages/Language?*.php";
93 umask( 000 );
94 set_time_limit( 0 );
95 $count = $total = 0;
96 $enText = getLanguage( "" );
97 $filenames = glob( $glob );
98 $width = 80;
99 foreach ( $filenames as $filename ) {
100 if ( preg_match( "/languages\/Language(.*)\.php/", $filename, $m ) ) {
101 $lang = strtolower( $m[1] );
102 if ( $lang != "utf8" ) {
103 print "\n" . str_repeat( "-", $width );
104 print "\n$lang\n";
105 print str_repeat( "-", $width ) . "\n";
106 checkLanguage( $lang, $enText );
111 print "\n" . str_repeat( "-", $width ) . "\n";
112 print "{$count} messages of {$total} not translated.\n";