function testAddLanguageAction()
 {
     global $wgTitle;
     $ca = array();
     $wgTitle = Title::newFromId($this->pageswithoutlanguage[0]);
     MultiLanguageManager::addLanguageAction($ca);
     $this->assertTrue(array_key_exists('language', $ca));
 }
/**
 * Add the language action to the content actions
 */
function mlAddLanguageAction(&$content_actions)
{
    MultiLanguageManager::addLanguageAction($content_actions);
    return true;
}
 /**
  * Create the language chooser for the given article
  * This is the user interface used to redirect the user to the avalable translation 
  * @param myPageTitle The Title object of the article
  * @param searchedLanguage The searched language
  * @return The HTML code to insert in the MediaWiki template
  */
 public function displaySelectLanguage($myPageTitle)
 {
     global $mgAvailableLanguage;
     global $wgUser;
     global $wgContLang;
     $saveContLang = $wgContLang;
     MultiLanguageManager::loadMessages();
     if (get_class($myPageTitle) != "Title") {
         return "";
     }
     //so first we have to check that this page exists in an other language
     //witch is the language of this page
     $myLanguage = $this->getPageLanguage($myPageTitle->getArticleID());
     $output = "";
     foreach ($mgAvailableLanguage as $key => $value) {
         if ($key != $myLanguage) {
             $translationList = $this->availableTranslation($myPageTitle, $key);
             //We have the list of the available translation in the key language
             //next step depends of the number of translation
             $nbTranslation = count($translationList);
             $displayLanguage = $this->display->displayLanguageElement($key);
             switch ($nbTranslation) {
                 case 0:
                     //$output.=$this->display->displayLanguageLinkPopup($displayLanguage,wfMsgHtml('multilanguagemanager_notranslation',wfMsgHtml($value)));
                     // why to show that we do not have a translation ?
                     break;
                 case 1:
                     //Only one translation avalaible, good job
                     //So in this case we go to the page without displayed anything
                     $output .= "<li>" . $this->display->displayDirectPageLink($displayLanguage, $translationList[0]) . "</li>";
                     break;
                 default:
                     //Argh a lot of tranlation
                     //We display them in a normal list (like left menu)
                     $objectContent = $this->display->displayListTranslation($key, $translationList);
                     $output .= $this->display->displayLanguageLinkPopup($displayLanguage, $objectContent);
                     break;
             }
         }
     }
     $wgContLang = $saveContLang;
     return $output;
 }