public static function setdbLanguageTag() { if (self::$lang) { return self::$lang; } $langs = (array) self::get('active_languages', array()); self::$langCount = count($langs); $siteLang = JRequest::getString('vmlang', FALSE); //vmdebug('My $siteLang by JRequest::getString("vmlang",JRequest::getString("lang")) '.$siteLang); $params = JComponentHelper::getParams('com_languages'); $defaultLang = $params->get('site', 'en-GB'); //use default joomla if (JFactory::getApplication()->isSite()) { if (!$siteLang) { if (JVM_VERSION === 1) { // try to find in session lang // this work with joomfish j1.5 (application.data.lang) $session = JFactory::getSession(); $registry = $session->get('registry'); $siteLang = $registry->getValue('application.data.lang'); } else { jimport('joomla.language.helper'); $siteLang = JFactory::getLanguage()->getTag(); //vmdebug('My selected language by JFactory::getLanguage()->getTag() '.$siteLang); } } } else { if (!$siteLang) { $siteLang = $defaultLang; } } if (!in_array($siteLang, $langs)) { if (count($langs) === 0) { $siteLang = $defaultLang; } else { $siteLang = $langs[0]; } } self::$vmlangTag = self::$langTag = $siteLang; self::$vmlang = self::$lang = strtolower(strtr($siteLang, '-', '_')); vmdebug('Joomla Language tag: ' . $siteLang . ' Virtuemart is using for db ' . self::$lang); defined('VMLANG') or define('VMLANG', self::$lang); return self::$lang; }