addModules( 'ext.simplelanguageselector' ); $out->addModuleStyles( array( 'ext.simplelanguageselectorcss' ) ); $out->addHTML(self::getLanguageSelectorBoxHtml()); } public static function getLanguageSelectorBoxHtml() { global $wgSimpleLangageSelectionLangList, $wgScriptPath, $wgSimpleLangageSelectionShowTranslateLink; $ret = "\n"; $ret .= ''; return $ret; } /** * Add some tabs for navigation for users who do not use Ajax interface. * Hook: PersonalUrls */ public static function addPersonalBarTrigger( array &$personal_urls, &$title ) { global $wgScriptPath; $context = RequestContext::getMain(); // The element id will be 'pt-uls' $langCode = $context->getLanguage()->getCode(); $html = '
  • .$langCode.
  • '; $personal_urls = [ 'language' => [ 'html' => $html,//Language::fetchLanguageName( $langCode ), 'text' => Language::fetchLanguageName( $langCode ), 'href' => '#', 'class' => 'sls-trigger lang-' . $langCode, 'data-code' => $langCode, 'active' => true ] ] + $personal_urls; return true; } public static function onUserGetLanguageObject($user, &$code){ global $wgSimpleLangageSelectionLangList; if(!in_array($code, $wgSimpleLangageSelectionLangList)){ $code = 'en'; } } }