本文整理汇总了PHP中Lang::getCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Lang::getCode方法的具体用法?PHP Lang::getCode怎么用?PHP Lang::getCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lang
的用法示例。
在下文中一共展示了Lang::getCode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: TokenIsMissingException
<div class="box">
<?php
if (!array_key_exists('token', $_REQUEST)) {
throw new TokenIsMissingException();
}
$token = $_REQUEST['token'];
if (!Utilities::isValidUID($token)) {
throw new TokenHasBadFormatException($token);
}
$lang = array_key_exists('lang', $_REQUEST) ? $_REQUEST['lang'] : null;
$available = Lang::getAvailableLanguages();
if (!array_key_exists($lang, $available)) {
$lang = Lang::getCode();
}
$url = '?s=translate_email&token=' . $token . '&lang=';
if (count($available) > 1) {
echo '<div class="buttons">';
foreach ($available as $id => $dfn) {
if ($id == $lang) {
echo '<span class="selected">' . Utilities::sanitizeOutput($dfn['name']) . '</span>';
} else {
echo '<a href="' . $url . $id . '">' . Utilities::sanitizeOutput($dfn['name']) . '</a>';
}
}
echo '</div>';
}
$translatable = TranslatableEmail::fromToken($token);
$translation = $translatable->translate($lang);
/*
* Do not call Template::sanitizeOutput on email contents after that because
* TranslatableEmail::translate calls Translation::replace which itself calls
示例2:
?>
" data-lang="<?php
echo $lang;
?>
" title="<?php
echo $content['name'];
?>
">
<img src="{img:core/<?php
echo $lang;
?>
.png}" /> <label><?php
echo $content['name'];
?>
</label>
<?php
if ($lang == Lang::getCode()) {
?>
<span class="fa fa-check"></span>
<?php
}
?>
</a>
</li>
<?php
}
?>
</ul>
</li>
<?php
}
示例3: showLangSelector
/**
* Allows to show the lang selector button
*/
private function showLangSelector()
{
echo "<li class='has-dropdown' id='li_lang'>";
echo " <a href='#' title='Choisissez votre langue'><i class='fa fa-language'></i><label>" . lang::tr('Language') . "</label></a>";
echo " <ul class='dropdown'>";
$langs = Lang::getAvailableLanguages();
$currentLang = Lang::getCode();
foreach ($langs as $lang => $content) {
echo "<li>";
echo "<a class='lang" . ($lang == $currentLang ? ' nocursor' : '') . "' data-lang='" . $lang . "' title='" . $content['name'] . "'>";
echo "<img src='" . Config::get('site_url') . ('/lib/images/' . $lang . '.png') . "'/> <label>" . $content['name'] . "</label>";
if ($lang == $currentLang) {
echo " <i class='fa fa-check'></i>";
}
echo "</a>";
echo "</li>";
}
echo "</ul>";
echo "</li>";
}
示例4:
<script src="<?php
echo Config::get('site_url') . '/lib/foundation/js/vendor/modernizr.js';
?>
"></script>
<script type="text/javascript">
notes.php_lang = <?php
echo "'" . Lang::getCode() . "'";
?>
;
</script>
<?php
$currentLanguage = Lang::getCode();
if ($currentLanguage == 'en') {
$currentLanguage = 'en-gb';
}
echo "<script type='text/javascript' src='" . Config::get('site_url') . "/lib/fullcalendar/lang/" . $currentLanguage . ".js' ></script>";
?>
<!-- COMMON -->
<script type="text/javascript" src="./js/common/utilities.js"></script>
<script type="text/javascript" src="./js/common/constants.js"></script>
<script type="text/javascript" src="./js/common/exceptions.js"></script>
示例5:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php
echo Lang::getCode();
?>
" xml:lang="<?php
echo Lang::getCode();
?>
">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>{cfg:application_name}</title>
<?php
GUI::includeStylesheets();
?>
<?php
GUI::includeFavicon();
?>
<script type="text/javascript" src="{path:app-config.js.php}"></script>
<?php
GUI::includeScripts();
?>
<meta name="robots" content="noindex, nofollow" />
<meta name="auth" content="noindex, nofollow" />
</head>