r47606 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47605‎ | r47606 | r47607 >
Date:10:19, 21 February 2009
Author:rotem
Status:ok
Tags:
Comment:
Recommiting r47579, fixed.
Modified paths:
  • /branches/REL1_14/phase3/maintenance/language/checkLanguage.inc (modified) (history)
  • /branches/REL1_14/phase3/maintenance/language/languages.inc (modified) (history)
  • /branches/REL1_14/phase3/maintenance/language/transstat.php (modified) (history)

Diff [purge]

Index: branches/REL1_14/phase3/maintenance/language/checkLanguage.inc
@@ -110,7 +110,7 @@
111111 'untranslated' => 'getUntranslatedMessages',
112112 'duplicate' => 'getDuplicateMessages',
113113 'obsolete' => 'getObsoleteMessages',
114 - 'variables' => 'getMessagesWithoutVariables',
 114+ 'variables' => 'getMessagesWithMismatchVariables',
115115 'plural' => 'getMessagesWithoutPlural',
116116 'empty' => 'getEmptyMessages',
117117 'whitespace' => 'getMessagesWithWhitespace',
@@ -157,7 +157,7 @@
158158 'untranslated' => '$1 message(s) of $2 are not translated to $3, but exist in en:',
159159 'duplicate' => '$1 message(s) of $2 are translated the same in en and $3:',
160160 '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:',
162162 'plural' => '$1 message(s) of $2 in $3 don\'t use {{plural}} while en uses:',
163163 'empty' => '$1 message(s) of $2 in $3 are empty or -:',
164164 'whitespace' => '$1 message(s) of $2 in $3 have trailing whitespace:',
@@ -199,7 +199,7 @@
200200 * untranslated: Messages which are required to translate, but are not translated.
201201 * duplicate: Messages which translation equal to fallback
202202 * 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.
204204 * empty: Empty messages and messages that contain only -.
205205 * whitespace: Messages which have trailing whitespace.
206206 * xhtml: Messages which are not well-formed XHTML (checks only few common errors).
@@ -587,7 +587,7 @@
588588 * untranslated: Messages which are required to translate, but are not translated.
589589 * duplicate: Messages which translation equal to fallback
590590 * 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.
592592 * empty: Empty messages.
593593 * whitespace: Messages which have trailing whitespace.
594594 * xhtml: Messages which are not well-formed XHTML (checks only few common errors).
Index: branches/REL1_14/phase3/maintenance/language/transstat.php
@@ -96,12 +96,12 @@
9797 $requiredMessagesPercent = $wgOut->formatPercent( $requiredMessagesNumber, $wgRequiredMessagesNumber );
9898 $obsoleteMessagesNumber = count( $messages['obsolete'] );
9999 $obsoleteMessagesPercent = $wgOut->formatPercent( $obsoleteMessagesNumber, $messagesNumber, true );
100 - $messagesWithoutVariables = $wgLanguages->getMessagesWithoutVariables( $code );
 100+ $messagesWithMismatchVariables = $wgLanguages->getMessagesWithMismatchVariables( $code );
101101 $emptyMessages = $wgLanguages->getEmptyMessages( $code );
102102 $messagesWithWhitespace = $wgLanguages->getMessagesWithWhitespace( $code );
103103 $nonXHTMLMessages = $wgLanguages->getNonXHTMLMessages( $code );
104104 $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 ) ) );
106106 $problematicMessagesPercent = $wgOut->formatPercent( $problematicMessagesNumber, $messagesNumber, true );
107107
108108 # Output them
Index: branches/REL1_14/phase3/maintenance/language/languages.inc
@@ -300,17 +300,17 @@
301301 }
302302
303303 /**
304 - * Get the messages which do not use some variables.
 304+ * Get the messages whose variables do not match the original ones.
305305 *
306306 * @param $code The language code.
307307 *
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.
309309 */
310 - public function getMessagesWithoutVariables( $code ) {
 310+ public function getMessagesWithMismatchVariables( $code ) {
311311 $this->loadGeneralMessages();
312312 $this->loadMessages( $code );
313313 $variables = array( '\$1', '\$2', '\$3', '\$4', '\$5', '\$6', '\$7', '\$8', '\$9' );
314 - $messagesWithoutVariables = array();
 314+ $mismatchMessages = array();
315315 foreach ( $this->mMessages[$code]['translated'] as $key => $value ) {
316316 $missing = false;
317317 foreach ( $variables as $var ) {
@@ -318,12 +318,16 @@
319319 !preg_match( "/$var/sU", $value ) ) {
320320 $missing = true;
321321 }
 322+ if ( !preg_match( "/$var/sU", $this->mGeneralMessages['translatable'][$key] ) &&
 323+ preg_match( "/$var/sU", $value ) ) {
 324+ $missing = true;
 325+ }
322326 }
323327 if ( $missing ) {
324 - $messagesWithoutVariables[$key] = $value;
 328+ $mismatchMessages[$key] = $value;
325329 }
326330 }
327 - return $messagesWithoutVariables;
 331+ return $mismatchMessages;
328332 }
329333
330334 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r47579Backport (for checking the last localization updates for 1.14): Language scri...rotem20:23, 20 February 2009

Status & tagging log