function install_select_locale in Drupal 6
Same name and namespace in other branches
- 5 install.php \install_select_locale()
- 7 includes/install.core.inc \install_select_locale()
Allow admin to select which locale to use for the current profile.
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 530
Code
function install_select_locale($profilename) {
include_once './includes/file.inc';
include_once './includes/form.inc';
// Find all available locales.
$locales = install_find_locales($profilename);
// If only the built-in (English) language is available,
// and we are using the default profile, inform the user
// that the installer can be localized. Otherwise we assume
// the user know what he is doing.
if (count($locales) == 1) {
if ($profilename == 'default') {
install_task_list('locale-select');
drupal_set_title(st('Choose language'));
if (!empty($_GET['localize'])) {
$output = '<p>' . st('With the addition of an appropriate translation package, this installer is capable of proceeding in another language of your choice. To install and use Drupal in a language other than English:') . '</p>';
$output .= '<ul><li>' . st('Determine if <a href="@translations" target="_blank">a translation of this Drupal version</a> is available in your language of choice. A translation is provided via a translation package; each translation package enables the display of a specific version of Drupal in a specific language. Not all languages are available for every version of Drupal.', array(
'@translations' => 'http://localize.drupal.org',
)) . '</li>';
$output .= '<li>' . st('If an alternative translation package of your choice is available, download and extract its contents to your Drupal root directory.') . '</li>';
$output .= '<li>' . st('Return to choose language using the second link below and select your desired language from the displayed list. Reloading the page allows the list to automatically adjust to the presence of new translation packages.') . '</li>';
$output .= '</ul><p>' . st('Alternatively, to install and use Drupal in English, or to defer the selection of an alternative language until after installation, select the first link below.') . '</p>';
$output .= '<p>' . st('How should the installation continue?') . '</p>';
$output .= '<ul><li><a href="install.php?profile=' . $profilename . '&locale=en">' . st('Continue installation in English') . '</a></li><li><a href="install.php?profile=' . $profilename . '">' . st('Return to choose a language') . '</a></li></ul>';
}
else {
$output = '<ul><li><a href="install.php?profile=' . $profilename . '&locale=en">' . st('Install Drupal in English') . '</a></li><li><a href="install.php?profile=' . $profilename . '&localize=true">' . st('Learn how to install Drupal in other languages') . '</a></li></ul>';
}
print theme('install_page', $output);
exit;
}
// One language, but not the default profile, assume
// the user knows what he is doing.
return FALSE;
}
else {
// Allow profile to pre-select the language, skipping the selection.
$function = $profilename . '_profile_details';
if (function_exists($function)) {
$details = $function();
if (isset($details['language'])) {
foreach ($locales as $locale) {
if ($details['language'] == $locale->name) {
return $locale->name;
}
}
}
}
if (!empty($_POST['locale'])) {
foreach ($locales as $locale) {
if ($_POST['locale'] == $locale->name) {
return $locale->name;
}
}
}
install_task_list('locale-select');
drupal_set_title(st('Choose language'));
print theme('install_page', drupal_get_form('install_select_locale_form', $locales));
exit;
}
}