locale_supported_languages

Versions
4.6 – 5
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 functions call locale_supported_languages()

locale_admin_manage_delete_form in modules/locale/locale.module
User interface for the language deletion confirmation screen.
locale_admin_manage_delete_form_submit in modules/locale/locale.module
Process language deletion submissions.
locale_get_plural in modules/locale/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/locale.module
Refreshes database stored cache of translations.
locale_user in modules/locale/locale.module
Implementation of hook_user().
_locale_admin_export_screen in includes/locale.inc
User interface for the translation export screen
_locale_admin_import in includes/locale.inc
User interface for the translation import screen.
_locale_admin_import_submit in includes/locale.inc
Process the locale import form submission.
_locale_admin_manage_screen in includes/locale.inc
User interface for the language management screen.
_locale_admin_manage_screen_submit in includes/locale.inc
Process locale admin manager form submissions.
_locale_prepare_iso_list in includes/locale.inc
Prepares the language code list for a select form item with only the unsupported ones
_locale_string_edit in includes/locale.inc
User interface for string editing.
_locale_string_language_list in includes/locale.inc
List languages in search result table
_locale_string_seek_form in includes/locale.inc
User interface for the string search screen

Code

modules/locale/locale.module, line 243

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

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.