You are here

function install_select_locale_form in Drupal 6

Same name and namespace in other branches
  1. 5 install.php \install_select_locale_form()
  2. 7 includes/install.core.inc \install_select_locale_form()

Form API array definition for language selection.

1 string reference to 'install_select_locale_form'
install_select_locale in ./install.php
Allow admin to select which locale to use for the current profile.

File

./install.php, line 597

Code

function install_select_locale_form(&$form_state, $locales) {
  include_once './includes/locale.inc';
  $languages = _locale_get_predefined_list();
  foreach ($locales as $locale) {

    // Try to use verbose locale name
    $name = $locale->name;
    if (isset($languages[$name])) {
      $name = $languages[$name][0] . (isset($languages[$name][1]) ? ' ' . st('(@language)', array(
        '@language' => $languages[$name][1],
      )) : '');
    }
    $form['locale'][$locale->name] = array(
      '#type' => 'radio',
      '#return_value' => $locale->name,
      '#default_value' => $locale->name == 'en' ? TRUE : FALSE,
      '#title' => $name . ($locale->name == 'en' ? ' ' . st('(built-in)') : ''),
      '#parents' => array(
        'locale',
      ),
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => st('Select language'),
  );
  return $form;
}