You are here

function install_select_locale in Drupal 5

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

Find all .po files for the current profile and allow admin to select which to use.

Return value

The selected language.

1 call to install_select_locale()
install_main in ./install.php
The Drupal installation happens in a series of steps. We begin by verifying that the current environment meets our minimum requirements. We then go on to verify that settings.php is properly configured. From there we connect to the configured database…

File

./install.php, line 445

Code

function install_select_locale($profilename) {
  include_once './includes/file.inc';
  include_once './includes/form.inc';

  // Collect possible locales, add default
  $locales = file_scan_directory('./profiles/' . $profilename, '\\.po$', array(
    '.',
    '..',
    'CVS',
  ), 0, FALSE);
  array_unshift($locales, (object) array(
    'name' => 'en',
  ));

  // Don't need to choose locale if only one (English) is available.
  if (sizeof($locales) == 1) {
    return FALSE;
  }
  else {
    foreach ($locales as $locale) {
      if ($_POST['locale'] == $locale->name) {
        return $locale->name;
      }
    }
    drupal_maintenance_theme();
    drupal_set_title(st('Choose your preferred language'));
    print theme('install_page', drupal_get_form('install_select_locale_form', $locales));
    exit;
  }
}