global $wgParser, $wgUser, $wgTitle, $wgEnableParserCache, $wgLang;
//Current unncessary, code to act as a safeguard against any change in current behaviour of uselang breaks
+ $oldLang = null;
if ( isset( $params['uselang'] ) && $params['uselang'] != $wgLang->getCode() ) {
$oldLang = $wgLang; //Backup wgLang
$wgLang = Language::factory( $params['uselang'] );
$this->setIndexedTagNames( $result_array, $result_mapping );
$result->addValue( null, $this->getModuleName(), $result_array );
- if ( isset( $params['uselang'] ) ) {
+ if ( !is_null( $oldLang ) ) {
$wgLang = $oldLang; //Reset $wgLang to $oldLang
}
}
global $wgLang;
- if ( !is_null( $params['lang'] ) ) {
+ $oldLang = null;
+ if ( !is_null( $params['lang'] ) && $params['lang'] != $wgLang->getCode() ) {
$oldLang = $wgLang; //Keep $wgLang for restore later
$wgLang = Language::factory( $params['lang'] );
}
}
$result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'message' );
- if ( !is_null( $params['lang'] ) ) {
+ if ( !is_null( $oldLang ) ) {
$wgLang = $oldLang; //Restore $oldLang
}
}