=== modified file 'includes/bootstrap.inc' --- includes/bootstrap.inc 2008-10-16 21:16:06 +0000 +++ includes/bootstrap.inc 2008-10-19 21:22:44 +0000 @@ -1152,18 +1152,6 @@ function drupal_maintenance_theme() { } /** - * Return the name of the localisation function. Use in code that needs to - * run both during installation and normal operation. - */ -function get_t() { - static $t; - if (is_null($t)) { - $t = function_exists('install_main') ? 'st' : 't'; - } - return $t; -} - -/** * Choose a language for the current page, based on site and user preferences. */ function drupal_init_language() { @@ -1577,3 +1565,158 @@ function registry_load_path_files($retur /** * @} End of "ingroup registry". */ + +/** + * Translate strings to the page language or a given language. + * + * All human-readable text that will be displayed somewhere within a page should + * be run through the t() function. + * + * Examples: + * @code + * if (!$info || !$info['extension']) { + * form_set_error('picture_upload', t('The uploaded file was not an image.')); + * } + * + * $form['submit'] = array( + * '#type' => 'submit', + * '#value' => t('Log in'), + * ); + * @endcode + * + * Any text within t() can be extracted by translators and changed into + * the equivalent text in their native language. + * + * Special variables called "placeholders" are used to signal dynamic + * information in a string which should not be translated. Placeholders + * can also be used for text that may change from time to time + * (such as link paths) to be changed without requiring updates to translations. + * + * For example: + * @code + * $output = t('There are currently %members and %visitors online.', array( + * '%members' => format_plural($total_users, '1 user', '@count users'), + * '%visitors' => format_plural($guests->count, '1 guest', '@count guests'))); + * @endcode + * + * There are three styles of placeholders: + * - !variable, which indicates that the text should be inserted as-is. This is + * useful for inserting variables into things like e-mail. + * @code + * $message[] = t("If you don't want to receive such e-mails, you can change your settings at !url.", array('!url' => url("user/$account->uid", array('absolute' => TRUE)))); + * @endcode + * + * - @variable, which indicates that the text should be run through check_plain, + * to escape HTML characters. Use this for any output that's displayed within + * a Drupal page. + * @code + * drupal_set_title($title = t("@name's blog", array('@name' => $account->name)), PASS_THROUGH); + * @endcode + * + * - %variable, which indicates that the string should be HTML escaped and + * highlighted with theme_placeholder() which shows up by default as + * emphasized. + * @code + * $message = t('%name-from sent %name-to an e-mail.', array('%name-from' => $user->name, '%name-to' => $account->name)); + * @endcode + * + * When using t(), try to put entire sentences and strings in one t() call. + * This makes it easier for translators, as it provides context as to what each + * word refers to. HTML markup within translation strings is allowed, but should + * be avoided if possible. The exception are embedded links; link titles add a + * context for translators, so should be kept in the main string. + * + * Here is an example of incorrect usage of t(): + * @code + * $output .= t('
Go to the @contact-page.
', array('@contact-page' => l(t('contact page'), 'contact'))); + * @endcode + * + * Here is an example of t() used correctly: + * @code + * $output .= '' . t('Go to the contact page.', array('@contact-page' => url('contact'))) . '
'; + * @endcode + * + * Also avoid escaping quotation marks wherever possible. + * + * Incorrect: + * @code + * $output .= t('Don\'t click me.'); + * @endcode + * + * Correct: + * @code + * $output .= t("Don't click me."); + * @endcode + * + * @param $string + * A string containing the English string to translate. + * @param $args + * An associative array of replacements to make after translation. Incidences + * of any key in this array are replaced with the corresponding value. + * Based on the first character of the key, the value is escaped and/or themed: + * - !variable: inserted as is + * - @variable: escape plain text to HTML (check_plain) + * - %variable: escape text and theme as a placeholder for user-submitted + * content (check_plain + theme_placeholder) + * @param $langcode + * Optional language code to translate to a language other than what is used + * to display the page. + * @param $install_time + * Optional boolean indicating that the string is used during install. + * @return + * The translated string. + */ +function t($string, $args = array(), $langcode = NULL, $install_time) { + global $language, $bootstrap_language, $bootstrap_full; + static $custom_strings; + + if (!isset($langcode)) { + $langcode = isset($language->language) ? $language->language : 'en'; + } + if (!isset($bootstrap_language) && drupal_get_bootstrap_phase() >= DRUPAL_BOOTSTRAP_LANGUAGE) { + $bootstrap_language = TRUE; + } + if (!isset($bootstrap_full) && drupal_get_bootstrap_phase() == DRUPAL_BOOTSTRAP_FULL) { + $bootstrap_full = TRUE; + } + + // First, check for an array of customized strings. If present, use the array + // *instead of* database lookups. This is a high performance way to provide a + // handful of string replacements. See settings.php for examples. + // Cache the $custom_strings variable to improve performance. + if (!isset($custom_strings[$langcode])) { + $custom_strings[$langcode] = defined('MAINTENANCE_MODE') ? install_load_strings() : variable_get('locale_custom_strings_' . $langcode, array()); + } + // Custom strings work for English too, even if locale module is disabled. + if (isset($custom_strings[$langcode][$string])) { + $string = $custom_strings[$langcode][$string]; + } + // Translate with locale module if enabled. + elseif ($bootstrap_language && $langcode != 'en' && function_exists('locale')) { + $string = locale($string, $langcode); + } + if (empty($args)) { + return $string; + } + else { + // Transform arguments before inserting them. + foreach ($args as $key => &$value) { + switch ($key[0]) { + case '@': + // Escaped only. + $value = check_plain($value); + break; + + case '%': + default: + // Escaped and placeholder. + $value = $bootstrap_full ? theme('placeholder', $value) : '' . $value . ''; + break; + + case '!': + // Pass-through. + } + } + return strtr($string, $args); + } +} === modified file 'includes/common.inc' --- includes/common.inc 2008-10-15 16:05:51 +0000 +++ includes/common.inc 2008-10-19 21:20:03 +0000 @@ -682,7 +682,7 @@ function _drupal_log_error($type, $messa drupal_set_message(t('@type: %message in %function (line %line of %file).', array('@type' => $type, '%message' => $message, '%function' => $caller['function'], '%line' => $caller['line'], '%file' => $caller['file'])), 'error'); } - watchdog('php', '%type: %message in %function (line %line of %file).', array('%type' => $type, '%message' => $message, '%function' => $caller['function'], '%file' => $caller['file'], '%line' => $caller['line']), WATCHDOG_ERROR); + watchdog('php', '%type: %message in %function (line %line of %file).', array('%type' => $type, '%message' => $message, '%function' => $caller['function'], '%file' => $caller['file'], '%line' => $caller['line']), WATCHDOG_ERROR); if ($fatal) { drupal_set_header($_SERVER['SERVER_PROTOCOL'] . ' Service unavailable'); @@ -691,7 +691,7 @@ function _drupal_log_error($type, $messa print theme('page', t('The website encountered an unexpected error. Please try again later.'), FALSE); } else { - print theme('maintenance_page', t('The website encountered an unexpected error. Please try again later.'), FALSE); + print theme('maintenance_page', t('The website encountered an unexpected error. Please try again later.'), FALSE); } exit; } @@ -774,153 +774,6 @@ function fix_gpc_magic() { } /** - * Translate strings to the page language or a given language. - * - * All human-readable text that will be displayed somewhere within a page should - * be run through the t() function. - * - * Examples: - * @code - * if (!$info || !$info['extension']) { - * form_set_error('picture_upload', t('The uploaded file was not an image.')); - * } - * - * $form['submit'] = array( - * '#type' => 'submit', - * '#value' => t('Log in'), - * ); - * @endcode - * - * Any text within t() can be extracted by translators and changed into - * the equivalent text in their native language. - * - * Special variables called "placeholders" are used to signal dynamic - * information in a string which should not be translated. Placeholders - * can also be used for text that may change from time to time - * (such as link paths) to be changed without requiring updates to translations. - * - * For example: - * @code - * $output = t('There are currently %members and %visitors online.', array( - * '%members' => format_plural($total_users, '1 user', '@count users'), - * '%visitors' => format_plural($guests->count, '1 guest', '@count guests'))); - * @endcode - * - * There are three styles of placeholders: - * - !variable, which indicates that the text should be inserted as-is. This is - * useful for inserting variables into things like e-mail. - * @code - * $message[] = t("If you don't want to receive such e-mails, you can change your settings at !url.", array('!url' => url("user/$account->uid", array('absolute' => TRUE)))); - * @endcode - * - * - @variable, which indicates that the text should be run through check_plain, - * to escape HTML characters. Use this for any output that's displayed within - * a Drupal page. - * @code - * drupal_set_title($title = t("@name's blog", array('@name' => $account->name)), PASS_THROUGH); - * @endcode - * - * - %variable, which indicates that the string should be HTML escaped and - * highlighted with theme_placeholder() which shows up by default as - * emphasized. - * @code - * $message = t('%name-from sent %name-to an e-mail.', array('%name-from' => $user->name, '%name-to' => $account->name)); - * @endcode - * - * When using t(), try to put entire sentences and strings in one t() call. - * This makes it easier for translators, as it provides context as to what each - * word refers to. HTML markup within translation strings is allowed, but should - * be avoided if possible. The exception are embedded links; link titles add a - * context for translators, so should be kept in the main string. - * - * Here is an example of incorrect usage of t(): - * @code - * $output .= t('Go to the @contact-page.
', array('@contact-page' => l(t('contact page'), 'contact'))); - * @endcode - * - * Here is an example of t() used correctly: - * @code - * $output .= '' . t('Go to the contact page.', array('@contact-page' => url('contact'))) . '
'; - * @endcode - * - * Also avoid escaping quotation marks wherever possible. - * - * Incorrect: - * @code - * $output .= t('Don\'t click me.'); - * @endcode - * - * Correct: - * @code - * $output .= t("Don't click me."); - * @endcode - * - * @param $string - * A string containing the English string to translate. - * @param $args - * An associative array of replacements to make after translation. Incidences - * of any key in this array are replaced with the corresponding value. - * Based on the first character of the key, the value is escaped and/or themed: - * - !variable: inserted as is - * - @variable: escape plain text to HTML (check_plain) - * - %variable: escape text and theme as a placeholder for user-submitted - * content (check_plain + theme_placeholder) - * @param $langcode - * Optional language code to translate to a language other than what is used - * to display the page. - * @return - * The translated string. - */ -function t($string, $args = array(), $langcode = NULL) { - global $language; - static $custom_strings; - - if (!isset($langcode)) { - $langcode = $language->language; - } - - // First, check for an array of customized strings. If present, use the array - // *instead of* database lookups. This is a high performance way to provide a - // handful of string replacements. See settings.php for examples. - // Cache the $custom_strings variable to improve performance. - if (!isset($custom_strings[$langcode])) { - $custom_strings[$langcode] = variable_get('locale_custom_strings_' . $langcode, array()); - } - // Custom strings work for English too, even if locale module is disabled. - if (isset($custom_strings[$langcode][$string])) { - $string = $custom_strings[$langcode][$string]; - } - // Translate with locale module if enabled. - elseif (function_exists('locale') && $langcode != 'en') { - $string = locale($string, $langcode); - } - if (empty($args)) { - return $string; - } - else { - // Transform arguments before inserting them. - foreach ($args as $key => $value) { - switch ($key[0]) { - case '@': - // Escaped only. - $args[$key] = check_plain($value); - break; - - case '%': - default: - // Escaped and placeholder. - $args[$key] = theme('placeholder', $value); - break; - - case '!': - // Pass-through. - } - } - return strtr($string, $args); - } -} - -/** * @defgroup validation Input validation * @{ * Functions to validate user input. @@ -2773,7 +2626,7 @@ function drupal_system_listing($mask, $d /** * Hands off structured Drupal arrays to type-specific *_alter implementations. - * + * * This dispatch function hands off structured Drupal arrays to type-specific * *_alter implementations. It ensures a consistent interface for all altering * operations. === modified file 'includes/form.inc' --- includes/form.inc 2008-10-15 14:17:26 +0000 +++ includes/form.inc 2008-10-19 21:20:03 +0000 @@ -661,9 +661,6 @@ function drupal_redirect_form($form, $re function _form_validate($elements, &$form_state, $form_id = NULL) { static $complete_form; - // 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]) { @@ -678,12 +675,12 @@ function _form_validate($elements, &$for // checkboxes, can return a valid value of '0'. Instead, check the // length if it's a string, and the item count if it's an array. if ($elements['#required'] && (!count($elements['#value']) || (is_string($elements['#value']) && strlen(trim($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']), NULL, TRUE)); } // 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'])), NULL, TRUE)); } if (isset($elements['#options']) && isset($elements['#value'])) { @@ -697,13 +694,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.', array(), NULL, TRUE)); 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.', array(), NULL, TRUE)); watchdog('form', 'Illegal choice %choice in %name element.', array('%choice' => $elements['#value'], '%name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title']), WATCHDOG_ERROR); } } @@ -1761,7 +1758,7 @@ function form_process_radios($element) { /** * Add input format selector to text elements with the #input_format property. * - * The #input_format property should be the ID of an input format, found in + * The #input_format property should be the ID of an input format, found in * {filter_formats}.format, which gets passed to filter_form(). * * If the property #input_format is set, the form element will be expanded into @@ -1777,7 +1774,7 @@ function form_process_radios($element) { * '#type' => 'textarea', * '#title' => t('Body'), * '#input_format' => isset($node->format) ? $node->format : FILTER_FORMAT_DEFAULT, - * ); + * ); * @endcode * * Becomes: @@ -2253,23 +2250,20 @@ function theme_file($element) { * @ingroup themeable */ function theme_form_element($element, $value) { - // This is also used in the installer, pre-database setup. - $t = get_t(); - $output = '' . st('To set up your @drupal database, enter the following information.', array('@drupal' => drupal_install_profile_name())) . '
', + '#title' => t('Basic options', array(), NULL, TRUE), + '#description' => '' . t('To set up your @drupal database, enter the following information.', array('@drupal' => drupal_install_profile_name()), NULL, TRUE) . '
', ); if (count($drivers) == 1) { @@ -239,24 +239,24 @@ function install_settings_form(&$form_st '#type' => 'hidden', '#value' => current(array_keys($drivers)), ); - $database_description = st('The name of the %driver database your @drupal data will be stored in. It must exist on your server before @drupal can be installed.', array('%driver' => current($drivers), '@drupal' => drupal_install_profile_name())); + $database_description = t('The name of the %driver database your @drupal data will be stored in. It must exist on your server before @drupal can be installed.', array('%driver' => current($drivers), '@drupal' => drupal_install_profile_name()), NULL, TRUE); } else { $form['basic_options']['driver'] = array( '#type' => 'radios', - '#title' => st('Database type'), + '#title' => t('Database type', array(), NULL, TRUE), '#required' => TRUE, '#options' => $drivers, '#default_value' => !empty($database['driver']) ? $database['driver'] : current(array_keys($drivers)), - '#description' => st('The type of database your @drupal data will be stored in.', array('@drupal' => drupal_install_profile_name())), + '#description' => t('The type of database your @drupal data will be stored in.', array('@drupal' => drupal_install_profile_name()), NULL, TRUE), ); - $database_description = st('The name of the database your @drupal data will be stored in. It must exist on your server before @drupal can be installed.', array('@drupal' => drupal_install_profile_name())); + $database_description = t('The name of the database your @drupal data will be stored in. It must exist on your server before @drupal can be installed.', array('@drupal' => drupal_install_profile_name()), NULL, TRUE); } // Database name $form['basic_options']['database'] = array( '#type' => 'textfield', - '#title' => st('Database name'), + '#title' => t('Database name', array(), NULL, TRUE), '#default_value' => empty($database['database']) ? '' : $database['database'], '#size' => 45, '#maxlength' => 45, @@ -267,7 +267,7 @@ function install_settings_form(&$form_st // Database username $form['basic_options']['username'] = array( '#type' => 'textfield', - '#title' => st('Database username'), + '#title' => t('Database username', array(), NULL, TRUE), '#default_value' => empty($database['username']) ? '' : $database['username'], '#size' => 45, '#maxlength' => 45, @@ -277,7 +277,7 @@ function install_settings_form(&$form_st // Database username $form['basic_options']['password'] = array( '#type' => 'password', - '#title' => st('Database password'), + '#title' => t('Database password', array(), NULL, TRUE), '#default_value' => empty($database['password']) ? '' : $database['password'], '#size' => 45, '#maxlength' => 45, @@ -285,47 +285,47 @@ function install_settings_form(&$form_st $form['advanced_options'] = array( '#type' => 'fieldset', - '#title' => st('Advanced options'), + '#title' => t('Advanced options', array(), NULL, TRUE), '#collapsible' => TRUE, '#collapsed' => TRUE, - '#description' => st("These options are only necessary for some sites. If you're not sure what you should enter here, leave the default settings or check with your hosting provider.") + '#description' => t("These options are only necessary for some sites. If you're not sure what you should enter here, leave the default settings or check with your hosting provider.", array(), NULL, TRUE) ); // Database host $form['advanced_options']['host'] = array( '#type' => 'textfield', - '#title' => st('Database host'), + '#title' => t('Database host', array(), NULL, TRUE), '#default_value' => empty($database['host']) ? 'localhost' : $database['host'], '#size' => 45, '#maxlength' => 45, '#required' => TRUE, - '#description' => st('If your database is located on a different server, change this.'), + '#description' => t('If your database is located on a different server, change this.', array(), NULL, TRUE), ); // Database port $form['advanced_options']['port'] = array( '#type' => 'textfield', - '#title' => st('Database port'), + '#title' => t('Database port', array(), NULL, TRUE), '#default_value' => empty($database['port']) ? '' : $database['port'], '#size' => 45, '#maxlength' => 45, - '#description' => st('If your database server is listening to a non-standard port, enter its number.'), + '#description' => t('If your database server is listening to a non-standard port, enter its number.', array(), NULL, TRUE), ); // Table prefix $db_prefix = ($profile == 'default') ? 'drupal_' : $profile . '_'; $form['advanced_options']['db_prefix'] = array( '#type' => 'textfield', - '#title' => st('Table prefix'), + '#title' => t('Table prefix', array(), NULL, TRUE), '#default_value' => '', '#size' => 45, '#maxlength' => 45, - '#description' => st('If more than one application will be sharing this database, enter a table prefix such as %prefix for your @drupal site here.', array('@drupal' => drupal_install_profile_name(), '%prefix' => $db_prefix)), + '#description' => t('If more than one application will be sharing this database, enter a table prefix such as %prefix for your @drupal site here.', array('@drupal' => drupal_install_profile_name(), '%prefix' => $db_prefix), NULL, TRUE), ); $form['save'] = array( '#type' => 'submit', - '#value' => st('Save and continue'), + '#value' => t('Save and continue', array(), NULL, TRUE), ); $form['errors'] = array(); @@ -352,18 +352,18 @@ function _install_settings_form_validate global $databases; // Verify the table prefix if (!empty($database['prefix']) && is_string($database['prefix']) && !preg_match('/^[A-Za-z0-9_.]+$/', $database['dprefix'])) { - form_set_error('db_prefix', st('The database table prefix you have entered, %db_prefix, is invalid. The table prefix can only contain alphanumeric characters, periods, or underscores.', array('%db_prefix' => $db_prefix)), 'error'); + form_set_error('db_prefix', t('The database table prefix you have entered, %db_prefix, is invalid. The table prefix can only contain alphanumeric characters, periods, or underscores.', array('%db_prefix' => $db_prefix), NULL, TRUE), 'error'); } if (!empty($database['port']) && !is_numeric($database['port'])) { - form_set_error('db_port', st('Database port must be a number.')); + form_set_error('db_port', t('Database port must be a number.', array(), NULL, TRUE)); } // Check database type $database_types = drupal_detect_database_types(); $driver = $database['driver']; if (!isset($database_types[$driver])) { - form_set_error('driver', st("In your %settings_file file you have configured @drupal to use a %driver server, however your PHP installation currently does not support this database type.", array('%settings_file' => $settings_file, '@drupal' => drupal_install_profile_name(), '%driver' => $database['driver']))); + form_set_error('driver', t("In your %settings_file file you have configured @drupal to use a %driver server, however your PHP installation currently does not support this database type.", array('%settings_file' => $settings_file, '@drupal' => drupal_install_profile_name(), '%driver' => $database['driver']), array(), NULL, TRUE)); } else { if (isset($form)) { @@ -375,7 +375,7 @@ function _install_settings_form_validate $return = $test->test(); if (!$return || $test->error) { if (!empty($test->success)) { - form_set_error('db_type', st('In order for Drupal to work, and to continue with the installation process, you must resolve all permission issues reported above. We were able to verify that we have permission for the following commands: %commands. For more help with configuring your database server, see the Installation and upgrading handbook. If you are unsure what any of this means you should probably contact your hosting provider.', array('%commands' => implode($test->success, ', ')))); + form_set_error('db_type', t('In order for Drupal to work, and to continue with the installation process, you must resolve all permission issues reported above. We were able to verify that we have permission for the following commands: %commands. For more help with configuring your database server, see the Installation and upgrading handbook. If you are unsure what any of this means you should probably contact your hosting provider.', array('%commands' => implode($test->success, ', ')), NULL, TRUE)); } else { form_set_error('driver', ''); @@ -438,7 +438,7 @@ function install_select_profile() { install_task_list('profile-select'); - drupal_set_title(st('Select an installation profile')); + drupal_set_title(t('Select an installation profile', array(), NULL, TRUE)); print theme('install_page', drupal_get_form('install_select_profile_form', $profiles)); exit; } @@ -487,7 +487,7 @@ function install_select_profile_form(&$f } $form['submit'] = array( '#type' => 'submit', - '#value' => st('Save and continue'), + '#value' => t('Save and continue', array(), NULL, TRUE), ); return $form; } @@ -521,18 +521,18 @@ function install_select_locale($profilen if (count($locales) == 1) { if ($profilename == 'default') { install_task_list('locale-select'); - drupal_set_title(st('Choose language')); + drupal_set_title(t('Choose language', array(), NULL, TRUE)); if (!empty($_GET['localize'])) { - $output = '' . 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:') . '
'; - $output .= '' . 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.') . '
'; - $output .= '' . st('How should the installation continue?') . '
'; - $output .= ''; + $output = '' . t('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:', array(), NULL, TRUE) . '
'; + $output .= '' . t('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.', array(), NULL, TRUE) . '
'; + $output .= '' . t('How should the installation continue?', array(), NULL, TRUE) . '
'; + $output .= '' . st('We were unable to find any installer profiles. Installer profiles tell us what modules to enable and what schema to install in the database. A profile is necessary to continue with the installation process.') . '
'); + drupal_set_title(t('No profiles available', array(), NULL, TRUE)); + print theme('install_page', '' . t('We were unable to find any installer profiles. Installer profiles tell us what modules to enable and what schema to install in the database. A profile is necessary to continue with the installation process.', array(), NULL, TRUE) . '
'); exit; } @@ -613,8 +613,8 @@ function install_no_profile_error() { function install_already_done_error() { global $base_url; - drupal_set_title(st('Drupal already installed')); - print theme('install_page', st('' . st('Congratulations, @drupal has been successfully installed.', array('@drupal' => drupal_install_profile_name())) . '
'; - $output .= '' . (isset($messages['error']) ? st('Please review the messages above before continuing on to your new site.', array('@url' => url(''))) : st('You may now visit your new site.', array('@url' => url('')))) . '
'; + $output = '' . t('Congratulations, @drupal has been successfully installed.', array('@drupal' => drupal_install_profile_name()), NULL, TRUE) . '
'; + $output .= '' . (isset($messages['error']) ? t('Please review the messages above before continuing on to your new site.', array('@url' => url('')), NULL, TRUE) : t('You may now visit your new site.', array('@url' => url('')), NULL, TRUE)) . '
'; $task = 'done'; } @@ -853,7 +853,7 @@ function _install_module_batch($module, // steps. module_enable(array($module)); $context['results'][] = $module; - $context['message'] = st('Installed %module module.', array('%module' => $module_name)); + $context['message'] = t('Installed %module module.', array('%module' => $module_name), NULL, TRUE); } /** @@ -918,30 +918,30 @@ function install_check_requirements($pro if (!$exists) { $requirements['settings file exists'] = array( - 'title' => st('Settings file'), - 'value' => st('The settings file does not exist.'), + 'title' => t('Settings file', array(), NULL, TRUE), + 'value' => t('The settings file does not exist.', array(), NULL, TRUE), 'severity' => REQUIREMENT_ERROR, - 'description' => st('The @drupal installer requires that you create a settings file as part of the installation process. Copy the %default_file file to %file. More details about installing Drupal are available in INSTALL.txt.', array('@drupal' => drupal_install_profile_name(), '%file' => $file, '%default_file' => $conf_path .'/default.settings.php')), + 'description' => t('The @drupal installer requires that you create a settings file as part of the installation process. Copy the %default_file file to %file. More details about installing Drupal are available in INSTALL.txt.', array('@drupal' => drupal_install_profile_name(), '%file' => $file, '%default_file' => $conf_path .'/default.settings.php'), NULL, TRUE), ); } elseif ($exists) { $requirements['settings file exists'] = array( - 'title' => st('Settings file'), - 'value' => st('The %file file exists.', array('%file' => $file)), + 'title' => t('Settings file', array(), NULL, TRUE), + 'value' => t('The %file file exists.', array('%file' => $file), NULL, TRUE), ); } if (!$writable) { $requirements['settings file writable'] = array( - 'title' => st('Settings file'), - 'value' => st('The settings file is not writable.'), + 'title' => t('Settings file', array(), NULL, TRUE), + 'value' => t('The settings file is not writable.', array(), NULL, TRUE), 'severity' => REQUIREMENT_ERROR, - 'description' => st('The @drupal installer requires write permissions to %file during the installation process. If you are unsure how to grant file permissions, please consult the online handbook.', array('@drupal' => drupal_install_profile_name(), '%file' => $file, '@handbook_url' => 'http://drupal.org/server-permissions')), + 'description' => t('The @drupal installer requires write permissions to %file during the installation process. If you are unsure how to grant file permissions, please consult the online handbook.', array('@drupal' => drupal_install_profile_name(), '%file' => $file, '@handbook_url' => 'http://drupal.org/server-permissions'), NULL, TRUE), ); } elseif ($writable) { $requirements['settings file'] = array( - 'title' => st('Settings file'), - 'value' => st('Settings file is writable.'), + 'title' => t('Settings file', array(), NULL, TRUE), + 'value' => t('Settings file is writable.', array(), NULL, TRUE), ); } } @@ -954,13 +954,13 @@ function install_check_requirements($pro function install_task_list($active = NULL) { // Default list of tasks. $tasks = array( - 'profile-select' => st('Choose profile'), - 'locale-select' => st('Choose language'), - 'requirements' => st('Verify requirements'), - 'database' => st('Set up database'), - 'profile-install-batch' => st('Install profile'), - 'locale-initial-batch' => st('Set up translations'), - 'configure' => st('Configure site'), + 'profile-select' => t('Choose profile', array(), NULL, TRUE), + 'locale-select' => t('Choose language', array(), NULL, TRUE), + 'requirements' => t('Verify requirements', array(), NULL, TRUE), + 'database' => t('Set up database', array(), NULL, TRUE), + 'profile-install-batch' => t('Install profile', array(), NULL, TRUE), + 'locale-initial-batch' => t('Set up translations', array(), NULL, TRUE), + 'configure' => t('Configure site', array(), NULL, TRUE), ); $profiles = install_find_profiles(); @@ -971,7 +971,7 @@ function install_task_list($active = NUL // and rename 'Install profile'. if (count($profiles) == 1) { unset($tasks['profile-select']); - $tasks['profile-install-batch'] = st('Install site'); + $tasks['profile-install-batch'] = t('Install site', array(), NULL, TRUE); } // Add tasks defined by the profile. @@ -991,12 +991,12 @@ function install_task_list($active = NUL } else { // If required, add remaining translations import task. - $tasks += array('locale-remaining-batch' => st('Finish translations')); + $tasks += array('locale-remaining-batch' => t('Finish translations', array(), NULL, TRUE)); } // Add finished step as the last task. $tasks += array( - 'finished' => st('Finished') + 'finished' => t('Finished', array(), NULL, TRUE) ); // Let the theming function know that 'finished' and 'done' @@ -1013,51 +1013,51 @@ function install_task_list($active = NUL function install_configure_form(&$form_state, $url) { $form['intro'] = array( - '#markup' => st('To configure your website, please provide the following information.'), + '#markup' => t('To configure your website, please provide the following information.', array(), NULL, TRUE), '#weight' => -10, ); $form['site_information'] = array( '#type' => 'fieldset', - '#title' => st('Site information'), + '#title' => t('Site information', array(), NULL, TRUE), '#collapsible' => FALSE, ); $form['site_information']['site_name'] = array( '#type' => 'textfield', - '#title' => st('Site name'), + '#title' => t('Site name', array(), NULL, TRUE), '#required' => TRUE, '#weight' => -20, ); $form['site_information']['site_mail'] = array( '#type' => 'textfield', - '#title' => st('Site e-mail address'), + '#title' => t('Site e-mail address', array(), NULL, TRUE), '#default_value' => ini_get('sendmail_from'), - '#description' => st("The From address in automated e-mails sent during registration and new password requests, and other notifications. (Use an address ending in your site's domain to help prevent this e-mail being flagged as spam.)"), + '#description' => t("The From address in automated e-mails sent during registration and new password requests, and other notifications. (Use an address ending in your site's domain to help prevent this e-mail being flagged as spam.)", array(), NULL, TRUE), '#required' => TRUE, '#weight' => -15, ); $form['admin_account'] = array( '#type' => 'fieldset', - '#title' => st('Administrator account'), + '#title' => t('Administrator account', array(), NULL, TRUE), '#collapsible' => FALSE, ); $form['admin_account']['account']['#tree'] = TRUE; $form['admin_account']['markup'] = array( - '#markup' => '' . st('The administrator account has complete access to the site; it will automatically be granted all permissions and can perform any administrative activity. This will be the only account that can perform certain activities, so keep its credentials safe.') . '
', + '#markup' => '' . t('The administrator account has complete access to the site; it will automatically be granted all permissions and can perform any administrative activity. This will be the only account that can perform certain activities, so keep its credentials safe.', array(), NULL, TRUE) . '
', '#weight' => -10, ); $form['admin_account']['account']['name'] = array('#type' => 'textfield', - '#title' => st('Username'), + '#title' => t('Username', array(), NULL, TRUE), '#maxlength' => USERNAME_MAX_LENGTH, - '#description' => st('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.'), + '#description' => t('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.', array(), NULL, TRUE), '#required' => TRUE, '#weight' => -10, ); $form['admin_account']['account']['mail'] = array('#type' => 'textfield', - '#title' => st('E-mail address'), + '#title' => t('E-mail address'), '#maxlength' => EMAIL_MAX_LENGTH, - '#description' => st('All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.'), + '#description' => t('All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.', array(), NULL, TRUE), '#required' => TRUE, '#weight' => -5, ); @@ -1070,24 +1070,24 @@ function install_configure_form(&$form_s $form['server_settings'] = array( '#type' => 'fieldset', - '#title' => st('Server settings'), + '#title' => t('Server settings', array(), NULL, TRUE), '#collapsible' => FALSE, ); $form['server_settings']['date_default_timezone'] = array( '#type' => 'select', - '#title' => st('Default time zone'), + '#title' => t('Default time zone', array(), NULL, TRUE), '#default_value' => 0, '#options' => _system_zonelist(), - '#description' => st('By default, dates in this site will be displayed in the chosen time zone.'), + '#description' => t('By default, dates in this site will be displayed in the chosen time zone.', array(), NULL, TRUE), '#weight' => 5, ); $form['server_settings']['clean_url'] = array( '#type' => 'radios', - '#title' => st('Clean URLs'), + '#title' => t('Clean URLs', array(), NULL, TRUE), '#default_value' => 0, - '#options' => array(0 => st('Disabled'), 1 => st('Enabled')), - '#description' => st('This option makes Drupal emit "clean" URLs (i.e. without?q=
in the URL).'),
+ '#options' => array(0 => t('Disabled'), 1 => t('Enabled')),
+ '#description' => t('This option makes Drupal emit "clean" URLs (i.e. without ?q=
in the URL).', array(), NULL, TRUE),
'#disabled' => TRUE,
'#prefix' => '