/**
  * Rewrites the language list so that it cannot be contaminated by other extensions with things
  * other than languages
  * See bug 57094.
  *
  * @todo Remove when Special:Languages link goes stable
  * @param QuickTemplate $tpl
  */
 protected function prepareLanguages($tpl)
 {
     $lang = $this->getTitle()->getPageViewLanguage();
     $tpl->set('pageLang', $lang->getHtmlCode());
     $tpl->set('pageDir', $lang->getDir());
     $language_urls = $this->getLanguages();
     if (count($language_urls)) {
         $tpl->setRef('language_urls', $language_urls);
     } else {
         $tpl->set('language_urls', false);
     }
 }
示例#2
0
/**
 * Replaces the language variant menu by the Polyglot one.
 *
 * @global type $wgOut
 * @global type $wgContLang
 * @param SkinTemplate $skin
 * @param QuickTemplate $tpl
 * @return type 
 */
function wfPolyglotAddVariantsToTemplate($skin, $tpl)
{
    global $wgOut, $wgContLang;
    $variants = wfPolyglotGetVariantTitles($skin->getRelevantTitle());
    $language_urls = array();
    foreach ($variants as $lang => $title) {
        $language_urls[] = array('href' => $title->getFullURL(), 'text' => $wgContLang->getLanguageName($lang), 'class' => 'interwiki-' . $lang);
    }
    if (count($language_urls)) {
        $tpl->setRef('language_urls', $language_urls);
    } else {
        $tpl->set('language_urls', false);
    }
    return true;
}