r70949 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70948‎ | r70949 | r70950 >
Date:13:23, 12 August 2010
Author:platonides
Status:ok (Comments)
Tags:
Comment:
Parser should only use content messages.
Modified paths:
  • /trunk/phase3/includes/parser/CoreParserFunctions.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -1144,7 +1144,7 @@
11451145 throw new MWException( __METHOD__.': unrecognised match type "' .
11461146 substr( $m[0], 0, 20 ) . '"' );
11471147 }
1148 - $url = wfMsg( $urlmsg, $id);
 1148+ $url = wfMsgForContent( $urlmsg, $id);
11491149 $sk = $this->mOptions->getSkin( $this->mTitle );
11501150 $la = $sk->getExternalLinkAttributes( "external $CssClass" );
11511151 return "<a href=\"{$url}\"{$la}>{$keyword} {$id}</a>";
@@ -3407,13 +3407,13 @@
34083408 global $wgEnableScaryTranscluding;
34093409
34103410 if ( !$wgEnableScaryTranscluding ) {
3411 - return wfMsg('scarytranscludedisabled');
 3411+ return wfMsgForContent('scarytranscludedisabled');
34123412 }
34133413
34143414 $url = $title->getFullUrl( "action=$action" );
34153415
34163416 if ( strlen( $url ) > 255 ) {
3417 - return wfMsg( 'scarytranscludetoolong' );
 3417+ return wfMsgForContent( 'scarytranscludetoolong' );
34183418 }
34193419 return $this->fetchScaryTemplateMaybeFromCache( $url );
34203420 }
@@ -3430,7 +3430,7 @@
34313431
34323432 $text = Http::get( $url );
34333433 if ( !$text ) {
3434 - return wfMsg( 'scarytranscludefailed', $url );
 3434+ return wfMsgForContent( 'scarytranscludefailed', $url );
34353435 }
34363436
34373437 $dbw = wfGetDB( DB_MASTER );
Index: trunk/phase3/includes/parser/CoreParserFunctions.php
@@ -605,7 +605,7 @@
606606 return '';
607607 else
608608 return( '<span class="error">' .
609 - wfMsg( 'duplicate-defaultsort',
 609+ wfMsgForContent( 'duplicate-defaultsort',
610610 htmlspecialchars( $old ),
611611 htmlspecialchars( $text ) ) .
612612 '</span>' );
@@ -643,7 +643,7 @@
644644 $stripList = $parser->getStripList();
645645 if ( !in_array( $tagName, $stripList ) ) {
646646 return '<span class="error">' .
647 - wfMsg( 'unknown_extension_tag', $tagName ) .
 647+ wfMsgForContent( 'unknown_extension_tag', $tagName ) .
648648 '</span>';
649649 }
650650

Comments

#Comment by MarkAHershberger (talk | contribs)   14:53, 5 January 2011

Had to ask Roan, for input but since this the parser is putting this into the content, it should be part of the content language. That is, this looks OK to me.

#Comment by MarkAHershberger (talk | contribs)   15:08, 5 January 2011

But, for comparison, see r43077 and follow up r43090

#Comment by Ilmari Karonen (talk | contribs)   15:13, 5 January 2011

In any case, we should be using either the content or the user language consistently. So far, the convention seems to have been to use the user language for these messages, but I have no personal objections to changing it as long as the change is made for all parser error messages. Anyway, either way will work technically, since the user language is part of the parser cache key.

#Comment by Platonides (talk | contribs)   21:55, 5 January 2011

Note that since r70783, the user language is no longer guaranteed to be present in the parser cache key. You need to use wfMsgExt( ..., array( 'language' => $parser->mOptions->getUserLang() ) ); to correctly provide messages in the user language. See r70940 for an example.

Status & tagging log