r47579 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47578‎ | r47579 | r47580 >
Date:20:23, 20 February 2009
Author:rotem
Status:reverted (Comments)
Tags:
Comment:
Backport (for checking the last localization updates for 1.14): Language script: Extend variables check to cover also variables which should not be used.
Modified paths:
  • /branches/REL1_14/phase3/maintenance/language/checkLanguage.inc (modified) (history)
  • /branches/REL1_14/phase3/maintenance/language/languages.inc (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/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 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r47594Revert r47579. Causing Fatal error: Call to undefined method languages::getMe...siebrand23:39, 20 February 2009
r47606Recommiting r47579, fixed.rotem10:19, 21 February 2009

Comments

#Comment by Siebrand (talk | contribs)   23:40, 20 February 2009

Reverted in r47593. Causing Fatal error: Call to undefined method languages::getMessagesWithoutVariables() in phase3/maintenance/language/transstat.php on line 99

#Comment by Siebrand (talk | contribs)   23:40, 20 February 2009

Oops, that should be reverted in r47594.

Status & tagging log