You are here

function _locale_prepare_predefined_list in Drupal 7

Same name and namespace in other branches
  1. 6 includes/locale.inc \_locale_prepare_predefined_list()

Prepares the language code list for a select form item with only the unsupported ones

Related topics

2 calls to _locale_prepare_predefined_list()
locale_languages_predefined_form in modules/locale/locale.admin.inc
Predefined language setup form.
locale_translate_import_form in modules/locale/locale.admin.inc
User interface for the translation import screen.

File

includes/locale.inc, line 2201
Administration functions for locale.module.

Code

function _locale_prepare_predefined_list() {
  include_once DRUPAL_ROOT . '/includes/iso.inc';
  $languages = language_list();
  $predefined = _locale_get_predefined_list();
  foreach ($predefined as $key => $value) {
    if (isset($languages[$key])) {
      unset($predefined[$key]);
      continue;
    }

    // Include native name in output, if possible
    if (count($value) > 1) {
      $tname = t($value[0]);
      $predefined[$key] = $tname == $value[1] ? $tname : "{$tname} ({$value[1]})";
    }
    else {
      $predefined[$key] = t($value[0]);
    }
  }
  asort($predefined);
  return $predefined;
}