Restructured the languages directory, to avoid problems when people untar MW 1.8...
[lhc/web/wiklou.git] / maintenance / duplicatetrans.php
1 <?php
2 /**
3 * Prints out messages that are the same as the message with the corrisponding
4 * key in the English file
5 *
6 * @package MediaWiki
7 * @subpackage Maintenance
8 */
9
10 require_once('commandLine.inc');
11
12 if ( isset( $args[0] ) ) {
13 $code = $args[0];
14 } else {
15 $code = $wgLang->getCode();
16 }
17
18 if ( $code == 'en' ) {
19 print "Current selected language is English. Cannot check translations.\n";
20 exit();
21 }
22
23 $filename = Language::getMessagesFileName( $code );
24 if ( file_exists( $filename ) ) {
25 require( $filename );
26 } else {
27 $messages = array();
28 }
29
30 $count = $total = 0;
31 $wgEnglishMessages = Language::getMessagesFor( 'en' );
32 $wgLocalMessages = $messages;
33
34 foreach ( $wgLocalMessages as $key => $msg ) {
35 ++$total;
36 if ( @$wgEnglishMessages[$key] == $msg ) {
37 echo "* $key\n";
38 ++$count;
39 }
40 }
41
42 echo "{$count} messages of {$total} are duplicates in the language {$code}\n";
43 ?>