本文整理匯總了PHP中i18n::getLocales方法的典型用法代碼示例。如果您正苦於以下問題:PHP i18n::getLocales方法的具體用法?PHP i18n::getLocales怎麽用?PHP i18n::getLocales使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類i18n
的用法示例。
在下文中一共展示了i18n::getLocales方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: rex_create_lang
function rex_create_lang($locale = "de_de", $searchpath = '')
{
global $REX;
$_searchpath = $searchpath;
if ($searchpath == '') {
$searchpath = $REX['INCLUDE_PATH'] . "/lang";
}
$lang_object = new i18n($locale, $searchpath);
if ($_searchpath == '') {
$REX['LOCALES'] = $lang_object->getLocales($searchpath);
}
return $lang_object;
}
示例2: i18n
$DB[2][LOGIN] = "";
$DB[2][PSW] = "";
$DB[2][NAME] = "";
// ----------------- IMAGEMAGICKPATHS
$REX[IMAGEMAGICK] = false;
$REX[IMAGEMAGICK_PATH] = "/usr/bin/convert";
// ----------------- COMMUNITY
// ------------------------------------------------------------ wenn magic quotes off
if (!get_magic_quotes_gpc()) {
include_once $REX[INCLUDE_PATH] . "/functions/function_rex_mquotes.inc.php";
}
// ------------------------------------------------------------ includes
// hier wird die i18n sprachklasse erzeugt
include_once $REX[INCLUDE_PATH] . "/classes/class.i18n.inc.php";
$I18N = new i18n($REX[LANG], $REX[INCLUDE_PATH] . "/lang/");
$REX[LOCALES] = i18n::getLocales($REX[INCLUDE_PATH] . "/lang/");
include $REX[INCLUDE_PATH] . "/functions/function_showmicrotime.inc.php";
// klassen
// include $REX[INCLUDE_PATH]."/classes/class.ftp.inc.php";
include_once $REX[INCLUDE_PATH] . "/classes/class.sql.inc.php";
include_once $REX[INCLUDE_PATH] . "/classes/class.select.inc.php";
include_once $REX[INCLUDE_PATH] . "/classes/class.article.inc.php";
include_once $REX[INCLUDE_PATH] . "/classes/class.login.inc.php";
include_once $REX[INCLUDE_PATH] . "/classes/class.form.inc.php";
include_once $REX[INCLUDE_PATH] . "/classes/class.list.inc.php";
include_once $REX[INCLUDE_PATH] . "/classes/class.board.inc.php";
include_once $REX[INCLUDE_PATH] . "/classes/class.mime_mail.inc.php";
include_once $REX[INCLUDE_PATH] . "/classes/class.mail_decode.inc.php";
include_once $REX[INCLUDE_PATH] . "/classes/class.tar.inc.php";
include_once $REX[INCLUDE_PATH] . "/classes/class.stat.inc.php";
// OO Classes
示例3: rex_create_lang
/**
* Funktion zum Anlegen eines Sprache-Objekts
*
* @param $locale Locale der Sprache
* @param $searchpath Pfad zum Ordner indem die Sprachdatei gesucht werden soll
* @param $setlocale TRUE, wenn die locale für die Umgebung gesetzt werden soll, sonst FALSE
* @return unknown_type
*/
function rex_create_lang($locale = "de_de", $searchpath = '', $setlocale = TRUE)
{
global $REX;
$_searchpath = $searchpath;
if ($searchpath == '') {
$searchpath = $REX['INCLUDE_PATH'] . DIRECTORY_SEPARATOR . "lang";
}
$lang_object = new i18n($locale, $searchpath);
if ($_searchpath == '') {
$REX['LOCALES'] = $lang_object->getLocales($searchpath);
}
if ($setlocale) {
$locales = array();
foreach (explode(',', trim($lang_object->msg('setlocale'))) as $locale) {
$locales[] = $locale . '.' . strtoupper(str_replace('iso-', 'iso', $lang_object->msg('htmlcharset')));
$locales[] = $locale . '.' . strtoupper(str_replace('iso-', 'iso', str_replace("-", "", $lang_object->msg('htmlcharset'))));
$locales[] = $locale . '.' . strtolower(str_replace('iso-', 'iso', $lang_object->msg('htmlcharset')));
$locales[] = $locale . '.' . strtolower(str_replace('iso-', 'iso', str_replace("-", "", $lang_object->msg('htmlcharset'))));
}
foreach (explode(',', trim($lang_object->msg('setlocale'))) as $locale) {
$locales[] = $locale;
}
setlocale(LC_ALL, $locales);
}
return $lang_object;
}
示例4: display
public static function display()
{
$r = "";
if ($_POST['cc_form'] == 'settings') {
$name_lookup = array();
Database::beginTransaction();
foreach ($_POST as $key => $value) {
if ($key == 'cc_form') {
continue;
}
if (substr($key, 0, 12) == 'cc_settings_') {
$name_lookup[substr($key, 12)] = explode('|', $value);
continue;
}
$setting_name = $key;
//var_dump(array_key_exists($key, $name_lookup),$name_lookup);
if (!array_key_exists($setting_name, $name_lookup)) {
continue;
}
if ($key == 'clean-urls') {
$value = (bool) $value;
}
Database::update('settings', array('data'), array(serialize($value)), array('package = ? AND name = ?', $name_lookup[$setting_name][1], $name_lookup[$setting_name][0]));
}
$r .= Message::success(__('admin', 'settings-saved'));
Database::endTransaction();
}
$settings = Database::select('settings', '*', array('package = ? OR package = ? OR package = ? OR package = ?', 'core', 'admin', 'site', 'gui'), array('package', 'ASC', 'name', 'ASC'));
$settings = $settings->fetchAll(PDO::FETCH_ASSOC);
$rows = array();
foreach ($settings as $row) {
if (!array_key_exists($row['package'], $rows)) {
$rows[$row['package']] = array();
}
$rows[$row['package']][] = $row;
}
ksort($rows);
$form = new Form('self', 'POST', 'settings');
foreach ($rows as $cat => $catRows) {
$form->startFieldset(__('settings', $cat));
foreach ($catRows as $row) {
$data = unserialize($row['data']);
$form->addHidden('cc_settings_' . UTF8::slugify($row['name']), $row['name'] . '|' . $row['package']);
if ($row['name'] == 'clean urls') {
$form->addSelectList(__('settings', $row['name']), UTF8::slugify($row['name']), array(1 => __('admin', 'yes'), 0 => __('admin', 'no')), true, $data);
} else {
if ($row['name'] == 'theme') {
$themes = Themes::getThemeList();
$options = array();
foreach ($themes as $slug => $ini) {
$options[$slug] = $ini['name'];
}
$form->addSelectList(__('settings', $row['name']), UTF8::slugify($row['name']), $options, true, $data);
} else {
if ($row['name'] == 'locale') {
$locales = i18n::getLocales();
$form->addSelectList(__('settings', $row['name']), UTF8::slugify($row['name']), $locales, false, $data);
} else {
if ($row['name'] == 'homepage id') {
$form->addSelectList(__('settings', $row['name']), UTF8::slugify($row['name']), Content::optionListArrayFromArray(Content::parseNavigation()), true, $data);
} else {
if ($row['name'] == 'site name') {
$form->addInput(__('settings', $row['name']), 'text', UTF8::slugify($row['name']), $data);
} else {
if ($row['name'] == 'editor') {
$editors = Editors::getNamesOfRegistered();
$form->addSelectList(__('settings', $row['name']), UTF8::slugify($row['name']), $editors, false, $data);
} else {
if ($row['name'] == 'homepage') {
$form->addSelectList(__('settings', $row['name']), UTF8::slugify($row['name']), Admin::getAdminPageOptions(), true, $data);
}
}
}
}
}
}
}
}
$form->endFieldset();
}
$form->startFieldset('');
$form->addSubmit('', 'save-settings', __('admin', 'save'));
$form->endFieldset();
return array(__('admin', 'settings'), $r . $form->endAndGetHTML());
}
示例5: rex_create_lang
function rex_create_lang($locale, $searchpath = '')
{
global $REX;
$_searchpath = $searchpath;
if ($searchpath == '') {
$searchpath = $REX['INCLUDE_PATH'] . "/lang";
}
$lang_object = new i18n($locale, $searchpath);
if ($_searchpath == '') {
$REX['LOCALES'] = $lang_object->getLocales($searchpath);
}
return $lang_object;
/*
if ($use_as_fallback)
{
$REX['LANG_FALLBACK_OBJ'] =
}
else
{
$REX['LANG_OBJ'] = $I18N = new i18n($locale, $searchpath);
}
*/
}
示例6: rex_create_lang
function rex_create_lang($locale = "de_de", $searchpath = '')
{
global $REX;
$_searchpath = $searchpath;
if ($searchpath == '') {
$searchpath = $REX['INCLUDE_PATH'] . "/lang";
}
$lang_object = new i18n($locale, $searchpath);
if ($_searchpath == '') {
$REX['LOCALES'] = $lang_object->getLocales($searchpath);
}
$locale = trim($lang_object->msg('setlocale'));
$charset = trim($lang_object->msg('htmlcharset'));
$charset_alt = str_replace('iso-', 'iso', $charset);
$setted = setlocale(LC_ALL, $locale . '.' . $charset, $locale . '.' . $charset_alt, $locale);
return $lang_object;
}