static $replacementKeys = array( '$1', '$2', '$3', '$4', '$5', '$6', '$7', '$8', '$9' );
global $wgParser, $wgMsgParserOptions;
global $wgContLang, $wgLanguageCode;
+ global $wgMessageCache, $wgLang;
$fname = 'wfMsgReal';
wfProfileIn( $fname );
-
+
if( $forContent ) {
/**
* Message is needed for page content, and needs
* parser cache and be served back to other
* visitors.
*/
- global $wgMessageCache;
$cache = &$wgMessageCache;
$lang = &$wgContLang;
} else {
* language variant or a separate user interface
* language; if so use that.
*/
- if( in_array( $wgLanguageCode, $wgContLang->getVariants() ) ) {
- global $wgLang, $wgMessageCache;
- $cache = &$wgMessageCache;
- $lang = &$wgLang;
+ if ( is_object( $wgContLang ) ) {
+ if( in_array( $wgLanguageCode, $wgContLang->getVariants() ) ) {
+ $cache = &$wgMessageCache;
+ $lang = &$wgLang;
+ } else {
+ $cache = false;
+ $lang = &$wgLang;
+ }
} else {
- global $wgLang;
$cache = false;
- $lang = &$wgLang;
+ $lang = false;
}
}
if( is_object( $cache ) ) {
$message = $cache->get( $key, $useDB, $forContent );
- } elseif( is_object( $lang ) ) {
+ } else {
+ if ( !is_object( $lang ) ) {
+ $lang = new Language;
+ }
+
wfSuppressWarnings();
$message = $lang->getMessage( $key );
wfRestoreWarnings();
if(strstr($message, '{{' ) !== false) {
$message = $wgParser->transformMsg($message, $wgMsgParserOptions);
}
- } else {
- wfDebug( "No language object when getting $key\n" );
- $message = "<$key>";
}
# Replace arguments
$wgLoadBalancer->loadMasterPos();
wfProfileOut( $fname.'-database' );
+wfProfileIn( $fname.'-language1' );
+
+require_once( "$IP/languages/Language.php" );
+
+wfProfileOut( $fname.'-language1' );
wfProfileIn( $fname.'-User' );
# Skin setup functions
}
wfProfileOut( $fname.'-User' );
-wfProfileIn( $fname.'-language' );
+wfProfileIn( $fname.'-language2' );
function setupLangObj(&$langclass, $langcode) {
global $wgUseLatin1, $IP;
return $lang;
}
-require_once( "$IP/languages/Language.php" );
-
# $wgLanguageCode may be changed later to fit with user preference.
# The content language will remain fixed as per the configuration,
# so let's keep it.
}
// wgLanguageCode now specifically means the UI language
-$wgLanguageCode = $wgUser->getOption('language');
+$wgLanguageCode = $wgUser->getOption('language2');
$wgLangClass = 'Language'. str_replace( '-', '_', ucfirst( $wgLanguageCode ) );