From 76f9b0b973fcdcf8ac4ddcf6e889fad8e3d1a26a Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 13 Nov 2008 01:02:17 +0000 Subject: [PATCH] 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. :) --- includes/GlobalFunctions.php | 4 +++- includes/MessageCache.php | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index eaa806c935..d8b8fd0ce6 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -731,7 +731,9 @@ function wfMsgExt( $key, $options ) { } elseif ( in_array('parsemag', $options) ) { global $wgMessageCache; if ( isset( $wgMessageCache ) ) { - $string = $wgMessageCache->transform( $string, !$forContent ); + $string = $wgMessageCache->transform( $string, + !$forContent, + is_object( $langCode ) ? $langCode : null ); } } diff --git a/includes/MessageCache.php b/includes/MessageCache.php index 2721708478..a06b0cb9b7 100644 --- a/includes/MessageCache.php +++ b/includes/MessageCache.php @@ -647,7 +647,7 @@ class MessageCache { return $message; } - function transform( $message, $interface = false ) { + function transform( $message, $interface = false, $language = null ) { // Avoid creating parser if nothing to transfrom if( strpos( $message, '{{' ) === false ) { return $message; @@ -670,6 +670,7 @@ class MessageCache { if ( $this->mParser ) { $popts = $this->getParserOptions(); $popts->setInterfaceMessage( $interface ); + $popts->setTargetLanguage( $language ); $message = $this->mParser->transformMsg( $message, $popts ); } return $message; -- 2.20.1