Same name and namespace in other branches
  1. 4.6.x modules/locale.module \locale_supported_languages()
  2. 5.x modules/locale/locale.module \locale_supported_languages()

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()
locale_admin_manage_delete_form in modules/locale.module
User interface for the language deletion confirmation screen.
locale_admin_manage_delete_form_submit in modules/locale.module
Process language deletion submissions.
locale_get_plural in modules/locale.module
Returns plural form index for a specific number.
locale_initialize in includes/common.inc
Initialize the localization system.
locale_refresh_cache in modules/locale.module
Refreshes database stored cache of translations.

... See full list

File

modules/locale.module, line 252
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;
}