本文整理匯總了PHP中Internationalization::getDefaultLanguage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Internationalization::getDefaultLanguage方法的具體用法?PHP Internationalization::getDefaultLanguage怎麽用?PHP Internationalization::getDefaultLanguage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Internationalization
的用法示例。
在下文中一共展示了Internationalization::getDefaultLanguage方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getTipsJson
function getTipsJson($namespace, $lang = false)
{
global $ost, $thisstaff;
if (!$lang) {
$lang = $thisstaff ? $thisstaff->getLanguage() : Internationalization::getDefaultLanguage();
}
$i18n = new Internationalization($lang);
$tips = $i18n->getTemplate("help/tips/{$namespace}.yaml");
if (!$tips || !($data = $tips->getData())) {
Http::response(404, 'Help content not available');
}
// Translate links to the root path of this installation
foreach ($data as $tip => &$info) {
if ($ost) {
$info = $ost->replaceTemplateVariables($info, array('config' => $ost->getConfig()));
}
if (isset($info['links'])) {
foreach ($info['links'] as &$l) {
if ($l['href'][0] == '/') {
$l['href'] = ROOT_PATH . substr($l['href'], 1);
}
}
}
}
return $this->json_encode($data);
}
示例2: getLanguage
function getLanguage()
{
static $cached = false;
if (!$cached) {
$cached =& $_SESSION['client:lang'];
}
if (!$cached) {
if ($acct = $this->getAccount()) {
$cached = $acct->getLanguage();
}
if (!$cached) {
$cached = Internationalization::getDefaultLanguage();
}
}
return $cached;
}
示例3: getLanguage
function getLanguage()
{
static $cached = false;
if (!$cached) {
$cached =& $_SESSION['staff:lang'];
}
if (!$cached) {
$cached = $this->config->get('lang');
if (!$cached) {
$cached = Internationalization::getDefaultLanguage();
}
}
return $cached;
}