61d8bab212cd844ca9540cfcb1797ab20df8e0c7
[lhc/web/wiklou.git] / maintenance / checktrans.php
1 <?php
2 /**
3 * @package MediaWiki
4 * @subpackage Maintenance
5 * Check to see if all messages have been translated into the selected language.
6 * To run this script, you must have a working installation, and you can specify
7 * a language, or the script will check the installation language.
8 */
9
10 /** */
11 require_once('commandLine.inc');
12
13 if ( isset( $args[0] ) ) {
14 $code = $args[0];
15 } else {
16 $code = $wgLang->getCode();
17 }
18
19 if ( $code == 'en' ) {
20 print "Current selected language is English. Cannot check translations.\n";
21 exit();
22 }
23
24 $filename = Language::getFileName( "$IP/languages/Messages", $code, '.php' );
25 if ( file_exists( $filename ) ) {
26 require( $filename );
27 } else {
28 $messages = array();
29 }
30
31 $count = $total = 0;
32 $wgEnglishMessages = Language::getMessagesFor( 'en' );
33 $wgLocalMessages = $messages;
34
35 foreach ( $wgEnglishMessages as $key => $msg ) {
36 ++$total;
37 if ( !isset( $wgLocalMessages[$key] ) ) {
38 print "'{$key}' => \"$msg\",\n";
39 ++$count;
40 }
41 }
42
43 print "{$count} messages of {$total} are not translated in the language {$code}.\n";
44 ?>