Phpdoc comments and place holder. Part of the subpackage "maintenance", archives...
[lhc/web/wiklou.git] / maintenance / checktrans2.php
1 <?php
2 /**
3 * @deprecated
4 * @package MediaWiki
5 * @subpackage Maintenance
6 */
7
8 /** */
9 die("This script is not being maintained.");
10
11 # Checks translation of all language files
12
13 function wfLocalUrl() { return "";}
14 function wfLocalUrle() { return "";}
15
16 function check($arrayname, $lang, $text)
17 {
18 $arraynameprinted = 0;
19
20 global $count, $total;
21
22 $msgarray = $arrayname . ucfirst( $lang );
23 $msgarrayen = $arrayname . "En";
24
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;
32 }
33
34 foreach ( $$msgarrayen as $code => $msg ) {
35 ++$total;
36
37 if ( ! array_key_exists( $code, $$msgarray ) ) {
38 if (!$arraynameprinted) {
39 print("\nIn array '$msgarray':\n");
40 $arraynameprinted = 1;
41 }
42
43 if ( is_numeric( $code ) ) {
44 print "$code ($msg)\n";
45 } else {
46 print "{$code}\n";
47 }
48 ++$count;
49 }
50 }
51 }
52
53 function getLanguage( $lang )
54 {
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 );
62
63 return $text;
64 }
65
66 function checkLanguage( $lang, $enText )
67 {
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);
84 }
85
86 if ( $argc > 1 ) {
87 array_shift( $argv );
88 $glob = implode( " ", $argv );
89 } else {
90 $glob = "../languages/Language?*.php";
91 }
92
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 );
107 }
108 }
109 }
110
111 print "\n" . str_repeat( "-", $width ) . "\n";
112 print "{$count} messages of {$total} not translated.\n";