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 = $options['lang'];
44 $langCodeC = $options['clang'];
45 $langCodeF = ucfirst(strtolower(preg_replace('/-/','_',$langCode)));
46 $langCodeFC = ucfirst(strtolower(preg_replace('/-/','_',$langCodeC)));
47 $messagesFile = $messagesDir.'Messages'.$langCodeF.'.php';
48 $messagesFileC = $messagesDir.'Messages'.$langCodeFC.'.php';
49 if (file_exists($messagesFile) && file_exists($messagesFileC)) {
53 echo "Messages file(s) could not be found.\nMake sure both files are exists.\n";
57 // Run to check the dupes
59 if (!strcmp($runMode,'wiki')) {
61 } else if (!strcmp($runMode,'raw')) {
64 include( $messagesFile );
65 $wgMessages[$langCode] = $messages;
66 include( $messagesFileC );
67 $wgMessages[$langCodeC] = $messages;
70 foreach ($wgMessages[$langCodeC] as $key => $value) {
71 foreach ($wgMessages[$langCode] as $ckey => $cvalue) {
72 if (!strcmp($key,$ckey)) {
73 if ((!strcmp($key,$ckey)) && (!strcmp($value,$cvalue))) {
74 if (!strcmp($runMode,'raw')) {
76 } else if (!strcmp($runMode,'wiki')) {
77 $uKey = ucfirst($key);
78 print("* MediaWiki:$uKey/$langCode\n");
87 if (!strcmp($runMode,'text')) {
89 echo "\nThere are $count duplicated message in $langCode, against to $langCodeC.\n";
91 echo "\nThere are $count duplicated messages in $langCode, against to $langCodeC.\n";