r43433 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43432‎ | r43433 | r43434 >
Date:01:02, 13 November 2008
Author:brion
Status:old
Tags:
Comment:
Run parsemag stuff through the proper language when wfMsgExt() asks for a specific one.
Previously we only passed on if we were interface or content, but if we're rendering for some third alternative it didn't get used.
Note that parse and parseinline are probably still wrong.... some better model may be required here.
Also it may be wrong in the case of fallbacks ... if you get an English message, is it right to use the Czech magic word parsing?
Hmm.
Might back it out if there's a better way. :)
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/MessageCache.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -731,7 +731,9 @@
732732 } elseif ( in_array('parsemag', $options) ) {
733733 global $wgMessageCache;
734734 if ( isset( $wgMessageCache ) ) {
735 - $string = $wgMessageCache->transform( $string, !$forContent );
 735+ $string = $wgMessageCache->transform( $string,
 736+ !$forContent,
 737+ is_object( $langCode ) ? $langCode : null );
736738 }
737739 }
738740
Index: trunk/phase3/includes/MessageCache.php
@@ -647,7 +647,7 @@
648648 return $message;
649649 }
650650
651 - function transform( $message, $interface = false ) {
 651+ function transform( $message, $interface = false, $language = null ) {
652652 // Avoid creating parser if nothing to transfrom
653653 if( strpos( $message, '{{' ) === false ) {
654654 return $message;
@@ -670,6 +670,7 @@
671671 if ( $this->mParser ) {
672672 $popts = $this->getParserOptions();
673673 $popts->setInterfaceMessage( $interface );
 674+ $popts->setTargetLanguage( $language );
674675 $message = $this->mParser->transformMsg( $message, $popts );
675676 }
676677 return $message;

Status & tagging log