r52176 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52175‎ | r52176 | r52177 >
Date:19:37, 19 June 2009
Author:nikerabbit
Status:ok
Tags:
Comment:
Balance check was not working due to: wrong group id, spaces versus underscore
Modified paths:
  • /trunk/extensions/Translate/MessageChecks.php (modified) (history)
  • /trunk/extensions/Translate/check-blacklist.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/MessageChecks.php
@@ -20,9 +20,10 @@
2121 if ( !isset($pattern[$checkKey]) ) {
2222 $list[$key][$checkKey] = '#';
2323 } elseif ( is_array($pattern[$checkKey]) ) {
24 - $list[$key][$checkKey] = array_map( 'strtolower', $pattern[$checkKey] );
 24+ $list[$key][$checkKey] =
 25+ array_map( array( $this, 'foldValue' ), $pattern[$checkKey] );
2526 } else {
26 - $list[$key][$checkKey] = strtolower( $pattern[$checkKey] );
 27+ $list[$key][$checkKey] = $this->foldValue( $pattern[$checkKey] );
2728 }
2829 }
2930 }
@@ -33,6 +34,10 @@
3435 $this->group = $group;
3536 }
3637
 38+ protected function foldValue( $value ) {
 39+ return str_replace( ' ', '_', strtolower( $value ) );
 40+ }
 41+
3742 /**
3843 * Set the tests for this checker. Array of callables with descriptive keys.
3944 * The callbacks will be called with parameters:
Index: trunk/extensions/Translate/check-blacklist.php
@@ -41,7 +41,7 @@
4242 )
4343 ),
4444 array(
45 - 'group' => 'ext-blahtext',
 45+ 'group' => 'ext-blahtex',
4646 'check' => 'balance',
4747 'message' => array(
4848 'math_MissingOpenBraceAfter', // Contains unbalanced {

Status & tagging log