3 # Checks translation of all language files
5 function wfLocalUrl() { return "";}
6 function wfLocalUrle() { return "";}
8 function check($arrayname, $lang, $text)
10 $arraynameprinted = 0;
12 global $count, $total;
14 $msgarray = $arrayname . ucfirst( $lang );
15 $msgarrayen = $arrayname . "En";
18 if ( !is_array( $
$msgarrayen ) ) {
19 print "\nArray '$msgarrayen' not present\n";
21 } elseif ( !is_array( $
$msgarray ) ) {
22 print "\nArray '$msgarray' not present\n";
26 foreach ( $
$msgarrayen as $code => $msg ) {
29 if ( ! array_key_exists( $code, $
$msgarray ) ) {
30 if (!$arraynameprinted) {
31 print("\nIn array '$msgarray':\n");
32 $arraynameprinted = 1;
35 if ( is_numeric( $code ) ) {
36 print "$code ($msg)\n";
45 function getLanguage( $lang )
47 $fileName = "../languages/Language" . ucfirst( $lang ) . ".php";
48 $file = fopen( $fileName, "r" );
49 $text = fread( $file, filesize( $fileName ) );
50 $clipPos = strpos( $text, "class Language" );
51 $text = substr( $text, 0, $clipPos );
52 $text = preg_replace( "/^<\?(php|)/", "", $text );
53 $text = preg_replace( "/^include.*$/m", "", $text );
58 function checkLanguage( $lang, $enText )
60 $text = $enText . getLanguage( $lang );
61 check("wgLanguageNames", $lang, $text);
62 check("wgNamespaceNames", $lang, $text);
63 check("wgDefaultUserOptions", $lang, $text);
64 check("wgQuickbarSettings", $lang, $text);
65 check("wgSkinNames", $lang, $text);
66 check("wgMathNames", $lang, $text);
67 check("wgUserToggles", $lang, $text);
68 check("wgWeekdayNames", $lang, $text);
69 check("wgMonthNames", $lang, $text);
70 check("wgMonthAbbreviations", $lang, $text);
71 check("wgValidSpecialPages", $lang, $text);
72 check("wgSysopSpecialPages", $lang, $text);
73 check("wgDeveloperSpecialPages", $lang, $text);
74 check("wgAllMessages", $lang, $text);
75 check("wgMagicWords", $lang, $text);
80 $glob = implode( " ", $argv );
82 $glob = "../languages/Language?*.php";
88 $enText = getLanguage( "" );
89 $filenames = glob( $glob );
91 foreach ( $filenames as $filename ) {
92 if ( preg_match( "/languages\/Language(.*)\.php/", $filename, $m ) ) {
93 $lang = strtolower( $m[1] );
94 if ( $lang != "utf8" ) {
95 print "\n" . str_repeat( "-", $width );
97 print str_repeat( "-", $width ) . "\n";
98 checkLanguage( $lang, $enText );
103 print "\n" . str_repeat( "-", $width ) . "\n";
104 print "{$count} messages of {$total} not translated.\n";