You are here

function install_select_locale_form in Drupal 7

Same name and namespace in other branches
  1. 5 install.php \install_select_locale_form()
  2. 6 install.php \install_select_locale_form()

Form constructor for the language selection form.

Related topics

1 string reference to 'install_select_locale_form'
install_select_locale in includes/install.core.inc
Installation task; select which locale to use for the current profile.

File

includes/install.core.inc, line 1322
API functions for installing Drupal.

Code

function install_select_locale_form($form, &$form_state, $locales, $profilename) {
  include_once DRUPAL_ROOT . '/includes/iso.inc';
  $languages = _locale_get_predefined_list();
  foreach ($locales as $locale) {
    $name = $locale->langcode;
    if (isset($languages[$name])) {
      $name = $languages[$name][0] . (isset($languages[$name][1]) ? ' ' . st('(@language)', array(
        '@language' => $languages[$name][1],
      )) : '');
    }
    $form['locale'][$locale->langcode] = array(
      '#type' => 'radio',
      '#return_value' => $locale->langcode,
      '#default_value' => $locale->langcode == 'en' ? 'en' : '',
      '#title' => $name . ($locale->langcode == 'en' ? ' ' . st('(built-in)') : ''),
      '#parents' => array(
        'locale',
      ),
    );
  }
  if (count($locales) == 1) {
    $form['help'] = array(
      '#markup' => '<p><a href="install.php?profile=' . $profilename . '&amp;localize=true">' . st('Learn how to install Drupal in other languages') . '</a></p>',
    );
  }
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => st('Save and continue'),
  );
  return $form;
}