Index: trunk/phase3/maintenance/language/checkLanguage.inc |
— | — | @@ -110,7 +110,7 @@ |
111 | 111 | 'untranslated' => 'getUntranslatedMessages', |
112 | 112 | 'duplicate' => 'getDuplicateMessages', |
113 | 113 | 'obsolete' => 'getObsoleteMessages', |
114 | | - 'variables' => 'getMessagesWithoutVariables', |
| 114 | + 'variables' => 'getMessagesWithMismatchVariables', |
115 | 115 | 'plural' => 'getMessagesWithoutPlural', |
116 | 116 | 'empty' => 'getEmptyMessages', |
117 | 117 | 'whitespace' => 'getMessagesWithWhitespace', |
— | — | @@ -157,7 +157,7 @@ |
158 | 158 | 'untranslated' => '$1 message(s) of $2 are not translated to $3, but exist in en:', |
159 | 159 | 'duplicate' => '$1 message(s) of $2 are translated the same in en and $3:', |
160 | 160 | 'obsolete' => '$1 message(s) of $2 do not exist in en or are in the ignore list, but exist in $3:', |
161 | | - 'variables' => '$1 message(s) of $2 in $3 don\'t use some variables that en uses:', |
| 161 | + 'variables' => '$1 message(s) of $2 in $3 don\'t match the variables used in en:', |
162 | 162 | 'plural' => '$1 message(s) of $2 in $3 don\'t use {{plural}} while en uses:', |
163 | 163 | 'empty' => '$1 message(s) of $2 in $3 are empty or -:', |
164 | 164 | 'whitespace' => '$1 message(s) of $2 in $3 have trailing whitespace:', |
— | — | @@ -199,7 +199,7 @@ |
200 | 200 | * untranslated: Messages which are required to translate, but are not translated. |
201 | 201 | * duplicate: Messages which translation equal to fallback |
202 | 202 | * obsolete: Messages which are untranslatable or do not exist, but are translated. |
203 | | - * variables: Messages without variables which should be used. |
| 203 | + * variables: Messages without variables which should be used, or with variables which shouldn't be used. |
204 | 204 | * empty: Empty messages and messages that contain only -. |
205 | 205 | * whitespace: Messages which have trailing whitespace. |
206 | 206 | * xhtml: Messages which are not well-formed XHTML (checks only few common errors). |
— | — | @@ -587,7 +587,7 @@ |
588 | 588 | * untranslated: Messages which are required to translate, but are not translated. |
589 | 589 | * duplicate: Messages which translation equal to fallback |
590 | 590 | * obsolete: Messages which are untranslatable, but translated. |
591 | | - * variables: Messages without variables which should be used. |
| 591 | + * variables: Messages without variables which should be used, or with variables which shouldn't be used. |
592 | 592 | * empty: Empty messages. |
593 | 593 | * whitespace: Messages which have trailing whitespace. |
594 | 594 | * xhtml: Messages which are not well-formed XHTML (checks only few common errors). |
Index: trunk/phase3/maintenance/language/transstat.php |
— | — | @@ -96,12 +96,12 @@ |
97 | 97 | $requiredMessagesPercent = $wgOut->formatPercent( $requiredMessagesNumber, $wgRequiredMessagesNumber ); |
98 | 98 | $obsoleteMessagesNumber = count( $messages['obsolete'] ); |
99 | 99 | $obsoleteMessagesPercent = $wgOut->formatPercent( $obsoleteMessagesNumber, $messagesNumber, true ); |
100 | | - $messagesWithoutVariables = $wgLanguages->getMessagesWithoutVariables( $code ); |
| 100 | + $messagesWithMismatchVariables = $wgLanguages->getMessagesWithMismatchVariables( $code ); |
101 | 101 | $emptyMessages = $wgLanguages->getEmptyMessages( $code ); |
102 | 102 | $messagesWithWhitespace = $wgLanguages->getMessagesWithWhitespace( $code ); |
103 | 103 | $nonXHTMLMessages = $wgLanguages->getNonXHTMLMessages( $code ); |
104 | 104 | $messagesWithWrongChars = $wgLanguages->getMessagesWithWrongChars( $code ); |
105 | | - $problematicMessagesNumber = count( array_unique( array_merge( $messagesWithoutVariables, $emptyMessages, $messagesWithWhitespace, $nonXHTMLMessages, $messagesWithWrongChars ) ) ); |
| 105 | + $problematicMessagesNumber = count( array_unique( array_merge( $messagesWithMismatchVariables, $emptyMessages, $messagesWithWhitespace, $nonXHTMLMessages, $messagesWithWrongChars ) ) ); |
106 | 106 | $problematicMessagesPercent = $wgOut->formatPercent( $problematicMessagesNumber, $messagesNumber, true ); |
107 | 107 | |
108 | 108 | # Output them |
Index: trunk/phase3/maintenance/language/languages.inc |
— | — | @@ -300,17 +300,17 @@ |
301 | 301 | } |
302 | 302 | |
303 | 303 | /** |
304 | | - * Get the messages which do not use some variables. |
| 304 | + * Get the messages whose variables do not match the original ones. |
305 | 305 | * |
306 | 306 | * @param $code The language code. |
307 | 307 | * |
308 | | - * @return The messages which do not use some variables in this language. |
| 308 | + * @return The messages whose variables do not match the original ones. |
309 | 309 | */ |
310 | | - public function getMessagesWithoutVariables( $code ) { |
| 310 | + public function getMessagesWithMismatchVariables( $code ) { |
311 | 311 | $this->loadGeneralMessages(); |
312 | 312 | $this->loadMessages( $code ); |
313 | 313 | $variables = array( '\$1', '\$2', '\$3', '\$4', '\$5', '\$6', '\$7', '\$8', '\$9' ); |
314 | | - $messagesWithoutVariables = array(); |
| 314 | + $mismatchMessages = array(); |
315 | 315 | foreach ( $this->mMessages[$code]['translated'] as $key => $value ) { |
316 | 316 | $missing = false; |
317 | 317 | foreach ( $variables as $var ) { |
— | — | @@ -318,12 +318,16 @@ |
319 | 319 | !preg_match( "/$var/sU", $value ) ) { |
320 | 320 | $missing = true; |
321 | 321 | } |
| 322 | + if ( !preg_match( "/$var/sU", $this->mGeneralMessages['translatable'][$key] ) && |
| 323 | + preg_match( "/$var/sU", $value ) ) { |
| 324 | + $missing = true; |
| 325 | + } |
322 | 326 | } |
323 | 327 | if ( $missing ) { |
324 | | - $messagesWithoutVariables[$key] = $value; |
| 328 | + $mismatchMessages[$key] = $value; |
325 | 329 | } |
326 | 330 | } |
327 | | - return $messagesWithoutVariables; |
| 331 | + return $mismatchMessages; |
328 | 332 | } |
329 | 333 | |
330 | 334 | /** |