本文整理汇总了PHP中jLocale::getPreferedLocaleFromRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP jLocale::getPreferedLocaleFromRequest方法的具体用法?PHP jLocale::getPreferedLocaleFromRequest怎么用?PHP jLocale::getPreferedLocaleFromRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jLocale
的用法示例。
在下文中一共展示了jLocale::getPreferedLocaleFromRequest方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeAction
/**
* @param array $params plugin parameters for the current action
* @return null or jSelectorAct if action should change
*/
public function beforeAction($params)
{
$langDetected = false;
$lang = '';
if ($this->config['enableUrlDetection']) {
$l = jApp::coord()->request->getParam($this->config['urlParamNameLanguage']);
if ($l !== null) {
$lang = jLocale::getCorrespondingLocale($l);
if ($lang != '') {
$langDetected = true;
}
}
}
if (!$langDetected) {
if (isset($_SESSION['JX_LANG'])) {
$lang = $_SESSION['JX_LANG'];
} else {
if ($this->config['useDefaultLanguageBrowser']) {
$lang = jLocale::getPreferedLocaleFromRequest();
}
}
}
if ($lang != '') {
$_SESSION['JX_LANG'] = $lang;
jApp::config()->locale = $lang;
}
return null;
}
示例2: _prepareTpl
protected function _prepareTpl()
{
$lang = jApp::config()->locale;
if (!$this->getParam('no_lang_check')) {
$locale = jLocale::getPreferedLocaleFromRequest();
if (!$locale) {
$locale = 'en_US';
}
jApp::config()->locale = $locale;
}
$reporter = new checkZoneInstallReporter();
$check = new jInstallCheck($reporter, $lang);
$reporter->messageProvider = $check->messages;
$check->run();
$this->_tpl->assign('wwwpath', jApp::wwwPath());
$this->_tpl->assign('configpath', jApp::configPath());
$this->_tpl->assign('check', $reporter->trace);
}
示例3: _prepareTpl
protected function _prepareTpl()
{
$lang = jApp::config()->locale;
if (!$this->param('no_lang_check')) {
$locale = jLocale::getPreferedLocaleFromRequest();
if (!$locale) {
$locale = 'en_US';
}
jApp::config()->locale = $locale;
}
$messages = new \Jelix\Installer\Checker\Messages($lang);
$reporter = new \Jelix\Installer\Reporter\HtmlBuffer($messages);
$check = new \Jelix\Installer\Checker\Checker($reporter, $messages);
$check->run();
$this->_tpl->assign('wwwpath', jApp::wwwPath());
$this->_tpl->assign('configpath', jApp::configPath());
$this->_tpl->assign('check', $reporter->trace);
}