r72977 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72976‎ | r72977 | r72978 >
Date:14:34, 14 September 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Improve printf formatter check to support positional parameters
Modified paths:
  • /trunk/extensions/Translate/MessageChecks.php (modified) (history)
  • /trunk/extensions/Translate/groups/StatusNet/StatusNet.yaml (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/MessageChecks.php
@@ -265,12 +265,10 @@
266266 $definition = $message->definition();
267267 $translation = $message->translation();
268268
269 - preg_match_all( '/%[sd]/U', $definition, $defVars );
270 - preg_match_all( '/%[sd]/U', $translation, $transVars );
 269+ preg_match_all( '/%(\d+\$)[sduf]/U', $definition, $defVars );
 270+ preg_match_all( '/%(\d+\$)[sduf]/U', $translation, $transVars );
271271
272 - /**
273 - * Check for missing variables in the translation
274 - */
 272+ // Check for missing variables in the translation
275273 $subcheck = 'missing';
276274 $params = self::compareArrays( $defVars[0], $transVars[0] );
277275
@@ -283,9 +281,7 @@
284282 );
285283 }
286284
287 - /**
288 - * Check for unknown variables in the translation
289 - */
 285+ // Check for unknown variables in the translatio
290286 $subcheck = 'unknown';
291287 $params = self::compareArrays( $transVars[0], $defVars[0] );
292288
Index: trunk/extensions/Translate/groups/StatusNet/StatusNet.yaml
@@ -23,4 +23,9 @@
2424 zh-hant: zh_TW
2525 header: |
2626 # This file is distributed under the same license as the StatusNet package.
27 - #
\ No newline at end of file
 27+ #
 28+
 29+CHECKER:
 30+ class: MessageChecker
 31+ checks:
 32+ - printfCheck

Status & tagging log