You are here

function locale_supported_languages in Localization client 5

Returns list of languages supported on this site.

Parameters

$reset Refresh cached language list.:

$getall Return all languages (even disabled ones):

6 calls to locale_supported_languages()
l10n_client_footer in ./l10n_client.module
Implementation of hook_footer().
locale_admin_manage_delete_form in locale/locale.module
User interface for the language deletion confirmation screen.
locale_admin_manage_delete_form_submit in locale/locale.module
Process language deletion submissions.
locale_get_plural in locale/locale.module
Returns plural form index for a specific number.
locale_refresh_cache in locale/locale.module
Refreshes database stored cache of translations.

... See full list

File

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