Ejemplo n.º 1
1
 /**
  * Function for getting the list of languages
  *
  * @return	array  Language list
  */
 public static function getList()
 {
     $app = JFactory::getApplication();
     $languages = JLanguageHelper::getLanguages();
     $db = JFactory::getDbo();
     $Itemid = $app->input->getInt('Itemid', 0);
     $uri = new JURI(Juri::current());
     $uri->delVar('lang');
     $uri->delVar('Itemid');
     $location = htmlspecialchars($uri->getQuery());
     if (!empty($location)) {
         $location .= '&';
     }
     if (!$Itemid) {
         $active = $app->getMenu()->getActive();
         if ($active) {
             $Itemid = $active->id;
         }
     }
     // For every language we load menu items language specific alias and params
     foreach ($languages as $i => $language) {
         $db->forceLanguageTranslation = $language->lang_code;
         RMenu::resetJoomlaMenuItems();
         $db->forceLanguageTranslation = false;
         $languages[$i]->active = $language->lang_code == JFactory::getLanguage()->getTag();
         $languages[$i]->link = RRoute::_('index.php?' . $location . 'lang=' . $language->sef . ($Itemid > 0 ? '&Itemid=' . $Itemid : ''));
     }
     // After we are done we reset it the way it was
     RMenu::resetJoomlaMenuItems();
     return $languages;
 }
Ejemplo n.º 2
0
 /**
  * After route.
  *
  * @return  void
  *
  * @since   3.4
  */
 public function onAfterRoute()
 {
     if (defined('REDCORE_LIBRARY_LOADED')) {
         if (RTranslationHelper::getSiteLanguage() != JFactory::getLanguage()->getTag()) {
             // Reset menus because they are loaded before any other module
             RMenu::resetJoomlaMenuItems();
         }
     }
 }