r26931 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r26930‎ | r26931 | r26932 >
Date:17:43, 24 October 2007
Author:nikerabbit
Status:old
Tags:
Comment:
* Be more robust and do the right thing automatically (with small speed penalty) when quoting messages
Modified paths:
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)
  • /trunk/phase3/maintenance/language/writeMessagesArray.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -2410,11 +2410,3 @@
24112411 'exif-orientation-8' => '0th row: left; 0th column: bottom',
24122412 'movepage-moved' => 'The two titles are passed in plain text as $3 and $4 to allow additional goodies in the message.'
24132413 );
2414 -
2415 -/** Messages which contain dollar signs (which are not followed by numbers), and therefore should use a single apostrophe */
2416 -$wgMessagseWithDollarSigns = array(
2417 - 'linkprefix',
2418 - 'enotif_subject',
2419 - 'enotif_body',
2420 - 'allmessagesnotsupportedDB',
2421 -);
Index: trunk/phase3/maintenance/language/writeMessagesArray.inc
@@ -103,8 +103,7 @@
104104 * @return The block, formatted in PHP.
105105 */
106106 function writeMessagesBlock( $name, $comment, $messages, $ignoredComments ) {
107 - global $wgMessageComments, $wgMessagseWithDollarSigns;
108 - global $wgIgnoredMessages, $wgOptionalMessages;
 107+ global $wgMessageComments, $wgIgnoredMessages, $wgOptionalMessages;
109108 $blockText = '';
110109
111110 # Skip the block if it includes no messages
@@ -142,7 +141,7 @@
143142 # Check for the appropriate apostrophe and add the value
144143 if ( strpos( $value, "'" ) === false ) {
145144 $blockText .= "'$value'";
146 - } elseif ( strpos( $value, '"' ) === false && !in_array( $key, $wgMessagseWithDollarSigns ) ) {
 145+ } elseif ( strpos( $value, '"' ) === false && !preg_match('/\$[a-zA-Z]/', $value) ) {
147146 $blockText .= "\"$value\"";
148147 } else {
149148 # Pick the less numerous one to escape

Status & tagging log