https://bugzilla.wikimedia.org/show_bug.cgi?id=2085
--- Comment #26 from [email protected] --- For those who'd like this feature, I've hacked a new magic word as part of my copy of UniversalLanguageSelector: {{USERLANG}} New UniversalLanguageSelector.i18n.magic.php file: $magicWords = array(); $magicWords['en'] = array('userlang' => array(0,'USERLANG')); Added to UniversalLanguageSelector.php, below last hook: $wgHooks['ParserGetVariableValueSwitch'][] = 'UniversalLanguageSelectorHooks::getLanguageMagic'; $wgHooks['MagicWordwgVariableIDs'][] = 'UniversalLanguageSelectorHooks::getLanguageMagicDeclareVarIds'; Added to UniversalLanguageSelector.hooks.php, above getLanguage(...): public static function getLanguageMagicDeclareVarIds( &$customVariableIds ) { $customVariableIds[] = 'userlang'; return true; } public static function getLanguageMagic(&$parser, &$cache, &$magicWordId, &$ret ) { if ( 'userlang' == $magicWordId ) { $context = RequestContext::getMain(); $code = $context->getLanguage()->getCode(); $ret = self::getLanguage($context->getUser(), $code) ? $code : ''; if($ret != $wgLanguageCode) $parser->disableCache(); } return true; } Works like charm, although heeding the warnings of the previous posters the cache gets disabled if the userlang is different than the wgLanguageCode :-) It now behaves very much like the dynamic results obtained from a database (e.g. WikiDB) -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes. _______________________________________________ Wikibugs-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
