本文整理汇总了PHP中LanguageManager::getLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP LanguageManager::getLanguage方法的具体用法?PHP LanguageManager::getLanguage怎么用?PHP LanguageManager::getLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LanguageManager
的用法示例。
在下文中一共展示了LanguageManager::getLanguage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateHeader
function generateHeader()
{
$this->content .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . LanguageManager::getLanguage() . '" >
<head>
<title>' . _("Perroquet — Listening comprehension tutor — ") . $this->title . '</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" media="screen" type="text/css" title="Design" href="/style/default.css" />
<link rel="icon" type="image/png" href="/ressources/style/favicon.png" />
</head>
<body>';
}
示例2: generateContent
function generateContent()
{
$content = '
<h1>' . _('Select language') . '</h1>';
$langs = Config::getLanguagelist();
$content .= '<form action="' . RessourceManager::getInnerUrl('special/language/select') . '" method="GET">';
$content .= '
<label for="language">' . _('Choose the new language : ') . '</label>
<select name="language" id="language">';
foreach ($langs as $lang) {
if ($lang['choosable']) {
$content .= '
<option value="' . $lang['code'] . '" ' . ($lang['code'] == LanguageManager::getLanguage() ? 'selected="selected"' : '') . '>' . $lang['label'] . '</option>';
}
}
$content .= '</select><br /><input type="submit" value="' . _("Select") . '"></form>';
return $content;
}
示例3: lang
/**
* get the language parameters
*
* @param string $lang
* @return array|bool
*/
public function lang($lang = '')
{
return $this->languageManager->getLanguage($lang);
}
示例4: serializeAttributes
// loading 'sticky' attributes values from session for this fuseaction
getStickyAttributes($oFuseaction->getName(), $oFuseaction->getStickyAttributes());
// these attributes are not needed to identify current page
$exceptAttributes = array_merge($ogFuseaction->getStickyAttributes(), $oFuseaction->getStickyAttributes());
$exceptAttributes[] = "fusebox.password";
$exceptAttributes[] = "fuseaction";
$exceptAttributes[] = "messages";
// variable to identify current page
$here = $self . "?" . serializeAttributes($exceptAttributes);
// LanguageManager initialization
$oLanguageManager = new LanguageManager($oDB, $fusebox['tableLanguages']);
if (!$oLanguageManager->initialize()) {
_throw("FNoLanguagesTable", "There is no languages table called \"{$fusebox['tableLanguages']}\" present in DB");
}
// trying to get default language, adding it if not exists
if (!($oLanguage = $oLanguageManager->getLanguage($fusebox['defaultLanguage'], true))) {
_throw("FCannotSetDefaultLanguage", "Cannot set default language \"{$fusebox['defaultLanguage']}\"");
}
// setting language of the site content
if (isset($attributes['language'])) {
// trying to get given language, but not adding it automatically
if ($otmpLanguage = $oLanguageManager->getLanguage($attributes['language'])) {
$oLanguage = $otmpLanguage;
} else {
_bye("ERROR [FCannotSetGivenLanguage] " . "Cannot set given language \"{$attributes['language']}\"");
}
unset($otmpLanguage);
}
$oContentManager = new ContentManager($oDB, $oFuseaction, $oLanguage, $fusebox['tableContentTokens'], $fusebox['tableContent'], $fusebox['tableContentComments'], false);
$ogContentManager = new ContentManager($oDB, $ogFuseaction, $oLanguage, $fusebox['tableContentTokens'], $fusebox['tableContent'], $fusebox['tableContentComments'], false);
if (!$oContentManager->initialize() || !$ogContentManager->initialize()) {
示例5: getExternUrl
static function getExternUrl($key)
{
return 'http://' . $_SERVER["SERVER_NAME"] . '/' . LanguageManager::getLanguage() . '/' . $key;
}
示例6: displayLanguages
/**
* Affiche les langues parlées par un utilisateur et son niveau.
* @param User $user
*
**/
public function displayLanguages($userId)
{
// On récupère les langues parlées par un utilisateur dans un array.
$language_manager = new LanguageManager($db);
$languages = self::getUsersLanguages($userId);
foreach ($languages as $language) {
var_dump($language);
$level = $language->levelId();
echo '<h1>' . $language_manager->getLanguage($language->languageId()) . '<h1>';
Form::level_form($level);
}
}