b5ea54f36558db2913c4bd695da3b6be76488976
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'],'php')) {
23 } else if (!strcmp($options['mode'],'raw')) {
31 Run this script to print out the duplicates against a message array.
33 * lang: Language code to be checked.
34 * clang: Language code to be compared.
36 * mode: Output format, can be either:
37 * text: Text output on the console (default)
38 * wiki: Wiki format, with * at beginning of each line
39 * php: Output text as PHP syntax in a array $dupeMessages
40 * raw: Raw output for duplicates
46 $langCode = $options['lang'];
47 $langCodeC = $options['clang'];
48 $langCodeF = ucfirst(strtolower(preg_replace('/-/','_',$langCode)));
49 $langCodeFC = ucfirst(strtolower(preg_replace('/-/','_',$langCodeC)));
50 $messagesFile = $messagesDir.'Messages'.$langCodeF.'.php';
51 $messagesFileC = $messagesDir.'Messages'.$langCodeFC.'.php';
52 if (file_exists($messagesFile) && file_exists($messagesFileC)) {
56 echo "Messages file(s) could not be found.\nMake sure both files are exists.\n";
60 // Run to check the dupes
62 if (!strcmp($runMode,'wiki')) {
64 } else if (!strcmp($runMode,'raw')) {
67 include( $messagesFile );
68 $wgMessages[$langCode] = $messages;
69 include( $messagesFileC );
70 $wgMessages[$langCodeC] = $messages;
73 if (!strcmp($runMode,'php')) {
75 print('$dupeMessages = array('."\n");
77 foreach ($wgMessages[$langCodeC] as $key => $value) {
78 foreach ($wgMessages[$langCode] as $ckey => $cvalue) {
79 if (!strcmp($key,$ckey)) {
80 if ((!strcmp($key,$ckey)) && (!strcmp($value,$cvalue))) {
81 if (!strcmp($runMode,'raw')) {
83 } else if (!strcmp($runMode,'php')) {
84 print("'$key' => '',\n");
85 } else if (!strcmp($runMode,'wiki')) {
86 $uKey = ucfirst($key);
87 print("* MediaWiki:$uKey/$langCode\n");
96 if (!strcmp($runMode,'php')) {
99 if (!strcmp($runMode,'text')) {
101 echo "\nThere are $count duplicated message in $langCode, against to $langCodeC.\n";
103 echo "\nThere are $count duplicated messages in $langCode, against to $langCodeC.\n";