5 * @ingroup MaintenanceLanguage
8 require_once( dirname(__FILE__
).'/../commandLine.inc' );
9 $messagesDir = dirname(__FILE__
).'/../../languages/messages/';
15 if ( isset( $options['lang'] ) && isset( $options['clang'] )) {
16 if (!isset( $options['mode'] )) {
19 if (!strcmp($options['mode'],'wiki')) {
21 } else if (!strcmp($options['mode'],'raw')) {
29 Run this script to print out the duplicates against a message array.
31 * lang: Language code to be checked.
32 * clang: Language code to be compared.
34 * mode: Output format, can be either:
35 * text: Text output on the console (default)
36 * wiki: Wiki format, with * at beginning of each line
37 * raw: Raw output for duplicates
43 $langCode = ucfirst(strtolower(preg_replace('/-/','_',$options['lang'])));
44 $langCodeC = ucfirst(strtolower(preg_replace('/-/','_',$options['clang'])));
45 $messagesFile = $messagesDir.'Messages'.$langCode.'.php';
46 $messagesFileC = $messagesDir.'Messages'.$langCodeC.'.php';
47 print("$messagesFile\n$messagesFileC\n");
48 if (file_exists($messagesFile) && file_exists($messagesFileC)) {
52 echo "Languages file(s) could not found.\nMake sure both files are exists.\n";
56 // Run to check the dupes
58 if (!strcmp($runMode,'wiki')) {
60 } else if (!strcmp($runMode,'raw')) {
63 include( $messagesFile );
64 $wgMessages[$langCode] = $messages;
65 include( $messagesFileC );
66 $wgMessages[$langCodeC] = $messages;
69 foreach ($wgMessages[$langCodeC] as $key => $value) {
70 foreach ($wgMessages[$langCode] as $ckey => $cvalue) {
71 if (!strcmp($key,$ckey)) {
72 if (!strcmp($value,$cvalue)) {
73 if (!strcmp($runMode,'raw')) {
75 } else if (!strcmp($runMode,'wiki')) {
76 $uKey = ucfirst($key);
77 print("* MediaWiki:$uKey/$langCode\n");
86 if (!strcmp($runMode,'text')) {
87 echo "\nThere are $count duplicates messages in ".$options['lang'].", against to ".$options['clang']."\n";