Index: install.php =================================================================== RCS file: /cvs/drupal/drupal/install.php,v retrieving revision 1.86 diff -u -p -r1.86 install.php --- install.php 6 Nov 2007 09:00:30 -0000 1.86 +++ install.php 7 Nov 2007 21:34:10 -0000 @@ -27,6 +27,9 @@ function install_main() { // Ensure correct page headers are sent (e.g. caching) drupal_page_header(); + // Set up $language, so t() caller functions will still work. + drupal_init_language(); + // Check existing settings.php. $verify = install_verify_settings(); @@ -631,16 +634,47 @@ function install_tasks($profile, $task) drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); $_SESSION['messages'] = $messages; - // Build a page for a final task. + // Build a page for final tasks. drupal_maintenance_theme(); if (empty($task)) { - variable_set('install_task', 'configure'); - $task = 'configure'; + variable_set('install_task', 'locale-import'); + $task = 'locale-import'; } // We are using a list of if constructs here to allow for // passing from one task to the other in the same request. + // Import interface translations for the enabled modules. + if ($task == 'locale-import') { + if (!empty($install_locale) && ($install_locale != 'en')) { + include_once 'includes/locale.inc'; + // Enable installation language as default site language. + locale_add_language($install_locale, NULL, NULL, NULL, NULL, NULL, 1, TRUE); + // Collect files to import for this language. + $batch = locale_batch_by_language($install_locale); + if (!empty($batch)) { + // Start a batch, switch to 'locale-batch' task. We need to + // set the variable here, because batch_process() redirects. + variable_set('install_task', 'locale-batch'); + batch_set($batch); + $path = $base_url .'/install.php?locale='. $install_locale .'&profile='. $profile; + batch_process($path, $path); + } + } + // Found nothing to import or not foreign language, go to next task. + $task = 'configure'; + } + + // We are running a batch import of interface translation files. + // This might run in multiple HTTP requests, constantly redirecting + // to the same address, until the batch finished callback is invoked + // and the task advances to 'configure'. + if ($task == 'locale-batch') { + include_once 'includes/batch.inc'; + include_once 'includes/locale.inc'; + $output = _batch_page(); + } + if ($task == 'configure') { drupal_set_title(st('Configure site')); @@ -686,42 +720,10 @@ function install_tasks($profile, $task) // If the profile doesn't move on to a new task we assume // that it is done: we let the installer regain control and - // proceed with the locale import. + // proceed with the final page. if ($task == 'profile') { - $task = 'locale-import'; - } - } - - // Import interface translations for the enabled modules, after - // any changes made by the profile through the profile forms. - if ($task == 'locale-import') { - if (!empty($install_locale) && ($install_locale != 'en')) { - include_once 'includes/locale.inc'; - // Enable installation language as default site language. - locale_add_language($install_locale, NULL, NULL, NULL, NULL, NULL, 1, TRUE); - // Collect files to import for this language. - $batch = locale_batch_by_language($install_locale); - if (!empty($batch)) { - // Start a batch, switch to 'locale-batch' task. We need to - // set the variable here, because batch_process() redirects. - variable_set('install_task', 'locale-batch'); - batch_set($batch); - $path = $base_url .'/install.php?locale='. $install_locale .'&profile='. $profile; - batch_process($path, $path); - } + $task = 'finished'; } - // Found nothing to import or not foreign language, go to next task. - $task = 'finished'; - } - - // We are running a batch import of interface translation files. - // This might run in multiple HTTP requests, constantly redirecting - // to the same address, until the batch finished callback is invoked - // and the task advances to 'finished'. - if ($task == 'locale-batch') { - include_once 'includes/batch.inc'; - include_once 'includes/locale.inc'; - $output = _batch_page(); } // Display a 'finished' page to user. @@ -797,6 +799,7 @@ function install_task_list($active = NUL 'locale-select' => st('Choose language'), 'requirements' => st('Verify requirements'), 'database' => st('Setup database'), + 'locale-batch' => st('Import translations'), 'configure' => st('Configure site'), ); @@ -820,11 +823,9 @@ function install_task_list($active = NUL } } - // If necessary, add translation import to the task list. - if (count($locales) > 1 && !empty($_GET['locale']) && $_GET['locale'] != 'en') { - $tasks += array( - 'locale-batch' => st('Import translations'), - ); + // If not required, remove translation import from the task list. + if (count($locales) < 2 || empty($_GET['locale']) || $_GET['locale'] == 'en') { + unset($tasks['locale-batch']); } // Add finished step as the last task. Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.198 diff -u -p -r1.198 bootstrap.inc --- includes/bootstrap.inc 25 Oct 2007 15:38:24 -0000 1.198 +++ includes/bootstrap.inc 7 Nov 2007 21:34:11 -0000 @@ -1083,7 +1083,7 @@ function language_list($field = 'languag * Optional property of the language object to return */ function language_default($property = NULL) { - $language = variable_get('language_default', (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0)); + $language = variable_get('language_default', (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => '')); return $property ? $language->$property : $language; } Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.710 diff -u -p -r1.710 common.inc --- includes/common.inc 4 Nov 2007 21:24:09 -0000 1.710 +++ includes/common.inc 7 Nov 2007 21:34:16 -0000 @@ -732,7 +732,14 @@ function fix_gpc_magic() { */ function t($string, $args = array(), $langcode = NULL) { global $language; - static $custom_strings; + static $custom_strings, $last; + + $list = debug_backtrace(); + $debug = $list[1]['function'] .' - '. $language->name ."\n"; + if ($debug != $last) { + error_log($debug, 3, '/tmp/debug-installer.txt'); + $last = $debug; + } $langcode = isset($langcode) ? $langcode : $language->language; Index: includes/form.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/form.inc,v retrieving revision 1.241 diff -u -p -r1.241 form.inc --- includes/form.inc 31 Oct 2007 15:10:33 -0000 1.241 +++ includes/form.inc 7 Nov 2007 21:34:17 -0000 @@ -563,6 +563,9 @@ function drupal_redirect_form($form, $re * theming, and hook_form_alter functions. */ function _form_validate($elements, &$form_state, $form_id = NULL) { + // Also used in the installer, pre-database setup. + $t = get_t(); + // Recurse through all children. foreach (element_children($elements) as $key) { if (isset($elements[$key]) && $elements[$key]) { @@ -576,12 +579,12 @@ function _form_validate($elements, &$for // and a textfield could return '0' and empty('0') returns TRUE so we // need a special check for the '0' string. if ($elements['#required'] && empty($elements['#value']) && $elements['#value'] !== '0') { - form_error($elements, t('!name field is required.', array('!name' => $elements['#title']))); + form_error($elements, $t('!name field is required.', array('!name' => $elements['#title']))); } // Verify that the value is not longer than #maxlength. if (isset($elements['#maxlength']) && drupal_strlen($elements['#value']) > $elements['#maxlength']) { - form_error($elements, t('!name cannot be longer than %max characters but is currently %length characters long.', array('!name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title'], '%max' => $elements['#maxlength'], '%length' => drupal_strlen($elements['#value'])))); + form_error($elements, $t('!name cannot be longer than %max characters but is currently %length characters long.', array('!name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title'], '%max' => $elements['#maxlength'], '%length' => drupal_strlen($elements['#value'])))); } if (isset($elements['#options']) && isset($elements['#value'])) { @@ -595,13 +598,13 @@ function _form_validate($elements, &$for $value = $elements['#type'] == 'checkboxes' ? array_keys(array_filter($elements['#value'])) : $elements['#value']; foreach ($value as $v) { if (!isset($options[$v])) { - form_error($elements, t('An illegal choice has been detected. Please contact the site administrator.')); + form_error($elements, $t('An illegal choice has been detected. Please contact the site administrator.')); watchdog('form', 'Illegal choice %choice in !name element.', array('%choice' => $v, '!name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title']), WATCHDOG_ERROR); } } } elseif (!isset($options[$elements['#value']])) { - form_error($elements, t('An illegal choice has been detected. Please contact the site administrator.')); + form_error($elements, $t('An illegal choice has been detected. Please contact the site administrator.')); watchdog('form', 'Illegal choice %choice in %name element.', array('%choice' => $elements['#value'], '%name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title']), WATCHDOG_ERROR); } } @@ -1967,20 +1970,23 @@ function theme_file($element) { * A string representing the form element. */ function theme_form_element($element, $value) { + // This is also used in the installer, pre-database setup. + $t = get_t(); + $output = '