locale_supported_languages

5 locale.module locale_supported_languages($reset = FALSE, $getall = FALSE)

Returns list of languages supported on this site.

Parameters

$reset Refresh cached language list.:

$getall Return all languages (even disabled ones):

15 calls to locale_supported_languages()

File

modules/locale/locale.module, line 245
Enables administrators to manage the site interface languages.

Code

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;
}
Login or register to post comments