本文整理匯總了PHP中VmConfig::langTag方法的典型用法代碼示例。如果您正苦於以下問題:PHP VmConfig::langTag方法的具體用法?PHP VmConfig::langTag怎麽用?PHP VmConfig::langTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類VmConfig
的用法示例。
在下文中一共展示了VmConfig::langTag方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setdbLanguageTag
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;
}