r50935 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50934‎ | r50935 | r50936 >
Date:10:58, 23 May 2009
Author:shinjiman
Status:deferred
Tags:
Comment:
tweak the message for check whether the message array is set
Modified paths:
  • /trunk/phase3/maintenance/language/checkDupeMessages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/checkDupeMessages.php
@@ -65,42 +65,54 @@
6666 $runMode = 'raw';
6767 }
6868 include( $messagesFile );
69 - $wgMessages[$langCode] = $messages;
 69+ $messageExist = isset($messages);
 70+ if ($messageExist)
 71+ $wgMessages[$langCode] = $messages;
7072 include( $messagesFileC );
71 - $wgMessages[$langCodeC] = $messages;
 73+ $messageCExist = isset($messages);
 74+ if ($messageCExist)
 75+ $wgMessages[$langCodeC] = $messages;
7276 $count = 0;
7377
74 - if (!strcmp($runMode,'php')) {
75 - print("<?php\n");
76 - print('$dupeMessages = array('."\n");
77 - }
78 - foreach ($wgMessages[$langCodeC] as $key => $value) {
79 - foreach ($wgMessages[$langCode] as $ckey => $cvalue) {
80 - if (!strcmp($key,$ckey)) {
81 - if ((!strcmp($key,$ckey)) && (!strcmp($value,$cvalue))) {
82 - if (!strcmp($runMode,'raw')) {
83 - print("$key\n");
84 - } else if (!strcmp($runMode,'php')) {
85 - print("'$key' => '',\n");
86 - } else if (!strcmp($runMode,'wiki')) {
87 - $uKey = ucfirst($key);
88 - print("* MediaWiki:$uKey/$langCode\n");
89 - } else {
90 - print("* $key\n");
 78+ if (($messageExist) && ($messageCExist)) {
 79+
 80+ if (!strcmp($runMode,'php')) {
 81+ print("<?php\n");
 82+ print('$dupeMessages = array('."\n");
 83+ }
 84+ foreach ($wgMessages[$langCodeC] as $key => $value) {
 85+ foreach ($wgMessages[$langCode] as $ckey => $cvalue) {
 86+ if (!strcmp($key,$ckey)) {
 87+ if ((!strcmp($key,$ckey)) && (!strcmp($value,$cvalue))) {
 88+ if (!strcmp($runMode,'raw')) {
 89+ print("$key\n");
 90+ } else if (!strcmp($runMode,'php')) {
 91+ print("'$key' => '',\n");
 92+ } else if (!strcmp($runMode,'wiki')) {
 93+ $uKey = ucfirst($key);
 94+ print("* MediaWiki:$uKey/$langCode\n");
 95+ } else {
 96+ print("* $key\n");
 97+ }
 98+ $count++;
9199 }
92 - $count++;
93100 }
94101 }
95102 }
96 - }
97 - if (!strcmp($runMode,'php')) {
98 - print(");\n");
99 - }
100 - if (!strcmp($runMode,'text')) {
101 - if ($count == 1) {
102 - echo "\nThere are $count duplicated message in $langCode, against to $langCodeC.\n";
103 - } else {
104 - echo "\nThere are $count duplicated messages in $langCode, against to $langCodeC.\n";
 103+ if (!strcmp($runMode,'php')) {
 104+ print(");\n");
105105 }
 106+ if (!strcmp($runMode,'text')) {
 107+ if ($count == 1) {
 108+ echo "\nThere are $count duplicated message in $langCode, against to $langCodeC.\n";
 109+ } else {
 110+ echo "\nThere are $count duplicated messages in $langCode, against to $langCodeC.\n";
 111+ }
 112+ }
 113+ } else {
 114+ if (!$messageExist)
 115+ echo "There are no messages defined in $langCode.\n";
 116+ if (!$messageCExist)
 117+ echo "There are no messages defined in $langCodeC.\n";
106118 }
107119 }

Status & tagging log