locale_supported_languages
modules/locale/locale.module, строка 243
- Версии
- 5
locale_supported_languages($reset = FALSE, $getall = FALSE)
Returns list of languages supported on this site.
Параметры
$reset
Refresh cached language list.
$getall
Return all languages (even disabled ones)
Код
<?php
function locale_supported_languages($reset = FALSE, $getall = FALSE) {
static $enabled = NULL;
static $all = NULL;
if ($reset) {
unset($enabled); unset($all);
}
if (is_null($enabled)) {
$enabled = $all = array();
$all['name'] = $all['formula'] = $enabled['name'] = $enabled['formula'] = array();
$result = db_query('SELECT locale, name, formula, enabled FROM {locales_meta} ORDER BY isdefault DESC, enabled DESC, name ASC');
while ($row = db_fetch_object($result)) {
$all['name'][$row->locale] = $row->name;
$all['formula'][$row->locale] = $row->formula;
if ($row->enabled) {
$enabled['name'][$row->locale] = $row->name;
$enabled['formula'][$row->locale] = $row->formula;
}
}
}
return $getall ? $all : $enabled;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии