summaryrefslogtreecommitdiff
path: root/maintenance/language/duplicatetrans.php
blob: 9273ee6e918968f2ece1b3ab40113865c41ae867 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
 * Prints out messages that are the same as the message with the corrisponding
 * key in the English file
 *
 * @package MediaWiki
 * @subpackage Maintenance
 */

require_once(dirname(__FILE__).'/../commandLine.inc');

if ( isset( $args[0] ) ) {
	$code = $args[0];
} else {
	$code = $wgLang->getCode();
}

if ( $code == 'en' ) {
	print "Current selected language is English. Cannot check translations.\n";
	exit();
}

$filename = Language::getMessagesFileName( $code );
if ( file_exists( $filename ) ) {
	require( $filename );
} else {
	$messages = array();
}

$count = $total = 0;
$wgEnglishMessages = Language::getMessagesFor( 'en' );
$wgLocalMessages = $messages;

foreach ( $wgLocalMessages as $key => $msg ) {
	++$total;
	if ( @$wgEnglishMessages[$key] == $msg ) {
		echo "* $key\n";
		++$count;
	}
}

echo "{$count} messages of {$total} are duplicates in the language {$code}\n";
?>