diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 43415e7..f75bd00 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -1361,11 +1361,6 @@ function bootstrap_hooks() {
* Translators can then rearrange the string as necessary for the language
* (e.g., in Spanish, it might be "blog de @name").
*
- * @section sec_alt_funcs_install Use During Installation Phase
- * During the Drupal installation phase, some resources used by t() wil not be
- * available to code that needs localization. See st() and get_t() for
- * alternatives.
- *
* @param $string
* A string containing the English string to translate.
* @param $args
@@ -1382,8 +1377,6 @@ function bootstrap_hooks() {
* @return
* The translated string.
*
- * @see st()
- * @see get_t()
* @see format_string()
* @ingroup sanitization
*/
@@ -2393,38 +2386,6 @@ function drupal_installation_attempted() {
}
/**
- * Returns the name of the proper localization function.
- *
- * get_t() exists to support localization for code that might run during
- * the installation phase, when some elements of the system might not have
- * loaded.
- *
- * This would include implementations of hook_install(), which could run
- * during the Drupal installation phase, and might also be run during
- * non-installation time, such as while installing the module from the the
- * module administration page.
- *
- * Example usage:
- * @code
- * $t = get_t();
- * $translated = $t('translate this');
- * @endcode
- *
- * Use t() if your code will never run during the Drupal installation phase.
- * Use st() if your code will only run during installation and never any other
- * time. Use get_t() if your code could run in either circumstance.
- *
- * @todo Remove this in favor of t().
- *
- * @see t()
- * @see st()
- * @ingroup sanitization
- */
-function get_t() {
- return 't';
-}
-
-/**
* Initializes all the defined language types and sets the default langcode.
*/
function drupal_language_initialize() {
diff --git a/core/includes/form.inc b/core/includes/form.inc
index 90d47fb..a10a8d2 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -1348,9 +1348,6 @@ function drupal_redirect_form($form_state) {
* 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]) {
@@ -1364,7 +1361,7 @@ function _form_validate(&$elements, &$form_state, $form_id = NULL) {
if (isset($elements['#needs_validation'])) {
// 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'])) {
@@ -1378,7 +1375,7 @@ function _form_validate(&$elements, &$form_state, $form_id = NULL) {
$value = in_array($elements['#type'], array('checkboxes', 'tableselect')) ? array_keys($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);
}
}
@@ -1397,7 +1394,7 @@ function _form_validate(&$elements, &$form_state, $form_id = NULL) {
form_set_value($elements, NULL, $form_state);
}
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);
}
}
@@ -1480,7 +1477,7 @@ function _form_validate(&$elements, &$form_state, $form_id = NULL) {
// constructors are encouraged to set #title anyway, and then set
// #title_display to 'invisible'. This improves accessibility.
elseif (isset($elements['#title'])) {
- form_error($elements, $t('!name field is required.', array('!name' => $elements['#title'])));
+ form_error($elements, t('!name field is required.', array('!name' => $elements['#title'])));
}
else {
form_error($elements);
@@ -3177,13 +3174,12 @@ function theme_checkboxes($variables) {
* This is used as a pre render function for checkboxes and radios.
*/
function form_pre_render_conditional_form_element($element) {
- $t = get_t();
// Set the element's title attribute to show #title as a tooltip, if needed.
if (isset($element['#title']) && $element['#title_display'] == 'attribute') {
$element['#attributes']['title'] = $element['#title'];
if (!empty($element['#required'])) {
// Append an indication that this field is required.
- $element['#attributes']['title'] .= ' (' . $t('Required') . ')';
+ $element['#attributes']['title'] .= ' (' . t('Required') . ')';
}
}
@@ -4759,11 +4755,9 @@ function theme_form_element($variables) {
* @ingroup themeable
*/
function theme_form_required_marker($variables) {
- // This is also used in the installer, pre-database setup.
- $t = get_t();
$attributes = array(
'class' => 'form-required',
- 'title' => $t('This field is required.'),
+ 'title' => t('This field is required.'),
);
return '*';
}
@@ -4793,8 +4787,6 @@ function theme_form_required_marker($variables) {
*/
function theme_form_element_label($variables) {
$element = $variables['element'];
- // This is also used in the installer, pre-database setup.
- $t = get_t();
// If title and required marker are both empty, output no label.
if ((!isset($element['#title']) || $element['#title'] === '') && empty($element['#required'])) {
@@ -4820,7 +4812,7 @@ function theme_form_element_label($variables) {
$attributes['for'] = $element['#id'];
}
- return '';
+ return '';
}
/**
@@ -5029,8 +5021,6 @@ function batch_set($batch_definition) {
}
// Base and default properties for the batch set.
- // Use get_t() to allow batches during installation.
- $t = get_t();
$init = array(
'sandbox' => array(),
'results' => array(),
@@ -5039,10 +5029,10 @@ function batch_set($batch_definition) {
'elapsed' => 0,
);
$defaults = array(
- 'title' => $t('Processing'),
- 'init_message' => $t('Initializing.'),
- 'progress_message' => $t('Completed @current of @total.'),
- 'error_message' => $t('An error has occurred.'),
+ 'title' => t('Processing'),
+ 'init_message' => t('Initializing.'),
+ 'progress_message' => t('Completed @current of @total.'),
+ 'error_message' => t('An error has occurred.'),
'css' => array(),
);
$batch_set = $init + $batch_definition + $defaults;
@@ -5132,8 +5122,7 @@ function batch_process($redirect = NULL, $url = 'batch', $redirect_callback = 'd
if ($batch['progressive']) {
// Now that we have a batch id, we can generate the redirection link in
// the generic error message.
- $t = get_t();
- $batch['error_message'] = $t('Please continue to the error page', array('@error_url' => url($url, array('query' => array('id' => $batch['id'], 'op' => 'finished')))));
+ $batch['error_message'] = t('Please continue to the error page', array('@error_url' => url($url, array('query' => array('id' => $batch['id'], 'op' => 'finished')))));
// Clear the way for the drupal_goto() redirection to the batch processing
// page, by saving and unsetting the 'destination', if there is any.
diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc
index f798392..80166ee 100644
--- a/core/includes/install.core.inc
+++ b/core/includes/install.core.inc
@@ -316,6 +316,15 @@ function install_begin_request(&$install_state) {
// Determine whether the configuration system is ready to operate.
$install_state['config_verified'] = install_verify_config_directory(CONFIG_ACTIVE_DIRECTORY) && install_verify_config_directory(CONFIG_STAGING_DIRECTORY);
+
+ // Create a minimal container for t() to work.
+ // This container will be overriden but it needed for the very early
+ // installation process when database tasks run.
+ $container = new ContainerBuilder();
+ // Register the translation services.
+ install_register_translation_service($container);
+ Drupal::setContainer($container);
+
// Check existing settings.php.
$install_state['database_verified'] = install_verify_database_settings();
$install_state['settings_verified'] = $install_state['config_verified'] && $install_state['database_verified'];
@@ -347,10 +356,13 @@ function install_begin_request(&$install_state) {
if ($install_state['settings_verified']) {
$kernel = new DrupalKernel('install', FALSE, drupal_classloader(), FALSE);
$kernel->boot();
+ $container = $kernel->getContainer();
+ // Add the file translation service to the container.
+ $container->set('string_translator.file_translation', install_file_translation_service());
+ $container->get('string_translation')->addTranslator($container->get('string_translator.file_translation'));
// Set the request in the kernel to the new created Request above
// so it is available to the rest of the installation process.
- $kernel->getContainer()
- ->set('request', $request);
+ $container->set('request', $request);
}
else {
// @todo Move into a proper Drupal\Core\DependencyInjection\InstallContainerBuilder.
@@ -374,9 +386,7 @@ function install_begin_request(&$install_state) {
$container->register('language_manager', 'Drupal\Core\Language\LanguageManager');
// Register the translation services.
- $container->register('string_translator.custom_strings', 'Drupal\Core\StringTranslation\Translator\CustomStrings')
- ->addTag('string_translator');
- $container->register('string_translation', 'Drupal\Core\StringTranslation\TranslationManager');
+ install_register_translation_service($container);
foreach (array('bootstrap', 'config', 'cache', 'menu', 'page', 'path') as $bin) {
$container
@@ -425,8 +435,6 @@ function install_begin_request(&$install_state) {
// Set up $language, so t() caller functions will still work.
drupal_language_initialize();
- // Append file translation to the translation chain.
- Drupal::translation()->addTranslator(install_file_translation_service());
// Add in installation language if present.
if (isset($install_state['parameters']['langcode'])) {
Drupal::translation()->setDefaultLangcode($install_state['parameters']['langcode']);
@@ -718,14 +726,14 @@ function install_tasks($install_state) {
// to the installation profile.
$tasks = array(
'install_select_language' => array(
- 'display_name' => st('Choose language'),
+ 'display_name' => t('Choose language'),
'run' => INSTALL_TASK_RUN_IF_REACHED,
),
'install_download_translation' => array(
'run' => $needs_download ? INSTALL_TASK_RUN_IF_REACHED : INSTALL_TASK_SKIP,
),
'install_select_profile' => array(
- 'display_name' => st('Choose profile'),
+ 'display_name' => t('Choose profile'),
'display' => count($install_state['profiles']) != 1,
'run' => INSTALL_TASK_RUN_IF_REACHED,
),
@@ -733,10 +741,10 @@ function install_tasks($install_state) {
'run' => INSTALL_TASK_RUN_IF_REACHED,
),
'install_verify_requirements' => array(
- 'display_name' => st('Verify requirements'),
+ 'display_name' => t('Verify requirements'),
),
'install_settings_form' => array(
- 'display_name' => st('Set up database'),
+ 'display_name' => t('Set up database'),
'type' => 'form',
// Even though the form only allows the user to enter database settings,
// we still need to display it if settings.php is invalid in any way,
@@ -749,17 +757,17 @@ function install_tasks($install_state) {
'run' => INSTALL_TASK_RUN_IF_REACHED,
),
'install_profile_modules' => array(
- 'display_name' => count($install_state['profiles']) == 1 ? st('Install site') : st('Installation profile'),
+ 'display_name' => count($install_state['profiles']) == 1 ? t('Install site') : t('Installation profile'),
'type' => 'batch',
),
'install_import_translations' => array(
- 'display_name' => st('Set up translations'),
+ 'display_name' => t('Set up translations'),
'display' => $needs_translations,
'type' => 'batch',
'run' => $needs_translations ? INSTALL_TASK_RUN_IF_NOT_COMPLETED : INSTALL_TASK_SKIP,
),
'install_configure_form' => array(
- 'display_name' => st('Configure site'),
+ 'display_name' => t('Configure site'),
'type' => 'form',
),
);
@@ -785,19 +793,19 @@ function install_tasks($install_state) {
// Finish by adding the remaining core tasks.
$tasks += array(
'install_import_translations_remaining' => array(
- 'display_name' => st('Finish translations'),
+ 'display_name' => t('Finish translations'),
'display' => $needs_translations,
'type' => 'batch',
'run' => $needs_translations ? INSTALL_TASK_RUN_IF_NOT_COMPLETED : INSTALL_TASK_SKIP,
),
'install_update_configuration_translations' => array(
- 'display_name' => st('Translate configuration'),
+ 'display_name' => t('Translate configuration'),
'display' => $needs_translations,
'type' => 'batch',
'run' => $needs_translations ? INSTALL_TASK_RUN_IF_NOT_COMPLETED : INSTALL_TASK_SKIP,
),
'install_finished' => array(
- 'display_name' => st('Finished'),
+ 'display_name' => t('Finished'),
),
);
@@ -1041,21 +1049,21 @@ function install_settings_form($form, &$form_state, &$install_state) {
$settings_file = $conf_path . '/settings.php';
$database = isset($databases['default']['default']) ? $databases['default']['default'] : array();
- drupal_set_title(st('Database configuration'));
+ drupal_set_title(t('Database configuration'));
$drivers = drupal_get_database_types();
$drivers_keys = array_keys($drivers);
$form['driver'] = array(
'#type' => 'radios',
- '#title' => st('Database type'),
+ '#title' => t('Database type'),
'#required' => TRUE,
'#default_value' => !empty($database['driver']) ? $database['driver'] : current($drivers_keys),
- '#description' => st('The type of database your @drupal data will be stored in.', array('@drupal' => drupal_install_profile_distribution_name())),
+ '#description' => t('The type of database your @drupal data will be stored in.', array('@drupal' => drupal_install_profile_distribution_name())),
);
if (count($drivers) == 1) {
$form['driver']['#disabled'] = TRUE;
- $form['driver']['#description'] .= ' ' . st('Your PHP configuration only supports a single database type, so it has been automatically selected.');
+ $form['driver']['#description'] .= ' ' . t('Your PHP configuration only supports a single database type, so it has been automatically selected.');
}
// Add driver specific configuration options.
@@ -1063,7 +1071,7 @@ function install_settings_form($form, &$form_state, &$install_state) {
$form['driver']['#options'][$key] = $driver->name();
$form['settings'][$key] = $driver->getFormOptions($database);
- $form['settings'][$key]['#prefix'] = '
';
$form['settings'][$key]['#type'] = 'container';
$form['settings'][$key]['#tree'] = TRUE;
$form['settings'][$key]['advanced_options']['#parents'] = array($key);
@@ -1077,7 +1085,7 @@ function install_settings_form($form, &$form_state, &$install_state) {
$form['actions'] = array('#type' => 'actions');
$form['actions']['save'] = array(
'#type' => 'submit',
- '#value' => st('Save and continue'),
+ '#value' => t('Save and continue'),
'#limit_validation_errors' => array(
array('driver'),
array(isset($form_state['input']['driver']) ? $form_state['input']['driver'] : current($drivers_keys)),
@@ -1137,7 +1145,7 @@ function install_database_errors($database, $settings_file) {
$database_types = drupal_get_database_types();
$driver = $database['driver'];
if (!isset($database_types[$driver])) {
- $errors['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_distribution_name(), '%driver' => $driver));
+ $errors['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_distribution_name(), '%driver' => $driver));
}
else {
// Run driver specific validation
@@ -1246,7 +1254,7 @@ function install_select_profile(&$install_state) {
// URL.
if ($install_state['interactive']) {
include_once __DIR__ . '/form.inc';
- drupal_set_title(st('Select an installation profile'));
+ drupal_set_title(t('Select an installation profile'));
$form = drupal_get_form('install_select_profile_form', $install_state);
return drupal_render($form);
}
@@ -1354,22 +1362,22 @@ function install_select_profile_form($form, &$form_state, $install_state) {
}
// The profile name and description are extracted for translation from the
- // .info file, so we can use st() on them even though they are dynamic data
+ // .info file, so we can use t() on them even though they are dynamic data
// at this point.
$form['profile'] = array(
'#type' => 'radios',
- '#title' => st('Select an installation profile'),
+ '#title' => t('Select an installation profile'),
'#title_display' => 'invisible',
- '#options' => array_map('st', $names),
+ '#options' => array_map('t', $names),
'#default_value' => 'standard',
);
foreach (array_keys($names) as $profile) {
- $form['profile'][$profile]['#description'] = isset($profiles[$profile]['description']) ? st($profiles[$profile]['description']) : '';
+ $form['profile'][$profile]['#description'] = isset($profiles[$profile]['description']) ? t($profiles[$profile]['description']) : '';
}
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
- '#value' => st('Save and continue'),
+ '#value' => t('Save and continue'),
);
return $form;
}
@@ -1385,7 +1393,7 @@ function install_select_profile_form($form, &$form_state, $install_state) {
*/
function install_find_translations() {
$translations = array();
- $files = install_file_translation_service()->findTranslationFiles();
+ $files = Drupal::service('string_translator.file_translation')->findTranslationFiles();
// English does not need a translation file.
array_unshift($files, (object) array('name' => 'en'));
foreach ($files as $uri => $file) {
@@ -1408,20 +1416,44 @@ function install_find_translations() {
*/
function install_file_translation_service() {
static $translation;
-
if (!isset($translation)) {
- if (isset($GLOBALS['conf']['locale.settings']['translation.path'])) {
- $directory = $GLOBALS['conf']['locale.settings']['translation.path'];
- }
- else {
- $directory = conf_path() . '/files/translations';
- }
- $translation = new FileTranslation($directory);
+ $translation = new FileTranslation(install_translations_directory());
}
return $translation;
}
/**
+ * Finds the translations directory for the installation.
+ *
+ * @return string
+ * The path to the installation directory.
+ */
+function install_translations_directory() {
+ if (isset($GLOBALS['conf']['locale.settings']['translation.path'])) {
+ $directory = $GLOBALS['conf']['locale.settings']['translation.path'];
+ }
+ else {
+ $directory = conf_path() . '/files/translations';
+ }
+ return $directory;
+}
+
+/**
+ * Build a file translation service for installation.
+ *
+ * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
+ * The container to append translation related services.
+ */
+function install_register_translation_service(ContainerBuilder $container) {
+ $container->register('string_translator.file_translation', 'Drupal\Core\StringTranslation\Translator\FileTranslation')
+ ->addArgument(install_translations_directory())
+ ->addTag('string_translator');
+ $container->register('string_translator.custom_strings', 'Drupal\Core\StringTranslation\Translator\CustomStrings')
+ ->addTag('string_translator');
+ $container->register('string_translation', 'Drupal\Core\StringTranslation\TranslationManager');
+}
+
+/**
* Selects which language to use during installation.
*
* @param $install_state
@@ -1462,7 +1494,7 @@ function install_select_language(&$install_state) {
// translation files were found the form shows a select list of the
// corresponding languages to choose from.
if ($install_state['interactive']) {
- drupal_set_title(st('Choose language'));
+ drupal_set_title(t('Choose language'));
include_once __DIR__ . '/form.inc';
$elements = drupal_get_form('install_select_language_form', count($files) > 1 ? $files : array());
return drupal_render($elements);
@@ -1525,7 +1557,7 @@ function install_select_language_form($form, &$form_state, $files = array()) {
$browser_langcode = language_from_browser($browser_options);
$form['langcode'] = array(
'#type' => 'select',
- '#title' => st('Choose language'),
+ '#title' => t('Choose language'),
'#title_display' => 'invisible',
'#options' => $select_options,
// Use the browser detected language as default or English if nothing found.
@@ -1541,7 +1573,7 @@ function install_select_language_form($form, &$form_state, $files = array()) {
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
- '#value' => st('Save and continue'),
+ '#value' => t('Save and continue'),
);
return $form;
}
@@ -1666,7 +1698,7 @@ function install_get_localization_release() {
*/
function install_no_profile_error() {
drupal_set_title(st('No profiles available'));
- return st('We were unable to find any installation profiles. Installation 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.');
+ return t('We were unable to find any installation profiles. Installation 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.');
}
/**
@@ -1676,7 +1708,7 @@ function install_already_done_error() {
global $base_url;
drupal_set_title(st('Drupal already installed'));
- return st('
To start over, you must empty your existing database, delete your active configuration, and copy default.settings.php over settings.php.
To install to a different database, edit the appropriate settings.php file in the sites folder.
To locate your active configuration, view the appropriate settings.php file in the sites folder.
To upgrade an existing installation, proceed to the update script.
', array('@base-url' => $base_url));
}
/**
@@ -1755,8 +1787,8 @@ function install_profile_modules(&$install_state) {
}
$batch = array(
'operations' => $operations,
- 'title' => st('Installing @drupal', array('@drupal' => drupal_install_profile_distribution_name())),
- 'error_message' => st('The installation has encountered an error.'),
+ 'title' => t('Installing @drupal', array('@drupal' => drupal_install_profile_distribution_name())),
+ 'error_message' => t('The installation has encountered an error.'),
'finished' => '_install_profile_modules_finished',
);
return $batch;
@@ -1841,7 +1873,7 @@ function _install_prepare_import() {
* @ingroup forms
*/
function install_configure_form($form, &$form_state, &$install_state) {
- drupal_set_title(st('Configure site'));
+ drupal_set_title(t('Configure site'));
// Warn about settings.php permissions risk
$settings_dir = conf_path();
@@ -1854,7 +1886,7 @@ function install_configure_form($form, &$form_state, &$install_state) {
// distract from the message that the Drupal installation has completed
// successfully.)
if (empty($_POST) && (!drupal_verify_install_file(DRUPAL_ROOT . '/' . $settings_file, FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE) || !drupal_verify_install_file(DRUPAL_ROOT . '/' . $settings_dir, FILE_NOT_WRITABLE, 'dir'))) {
- drupal_set_message(st('All necessary changes to %dir and %file have been made, so you should remove write permissions to them now in order to avoid security risks. If you are unsure how to do so, consult the online handbook.', array('%dir' => $settings_dir, '%file' => $settings_file, '@handbook_url' => 'http://drupal.org/server-permissions')), 'warning');
+ drupal_set_message(t('All necessary changes to %dir and %file have been made, so you should remove write permissions to them now in order to avoid security risks. If you are unsure how to do so, consult the online handbook.', array('%dir' => $settings_dir, '%file' => $settings_file, '@handbook_url' => 'http://drupal.org/server-permissions')), 'warning');
}
drupal_add_library('system', 'drupal.system');
@@ -1943,10 +1975,10 @@ function install_finished(&$install_state) {
// registered by the installation profile are registered correctly.
drupal_flush_all_caches();
- drupal_set_title(st('@drupal installation complete', array('@drupal' => drupal_install_profile_distribution_name())), PASS_THROUGH);
+ drupal_set_title(t('@drupal installation complete', array('@drupal' => drupal_install_profile_distribution_name())), PASS_THROUGH);
$messages = drupal_set_message();
- $output = '
';
// Ensure the URL that is generated for the home page does not have 'install.php'
// in it.
$request = Request::createFromGlobals();
@@ -1954,7 +1986,7 @@ function install_finished(&$install_state) {
$generator->setBasePath(str_replace('/core', '', $request->getBasePath()) . '/');
$generator->setScriptPath('');
$url = $generator->generateFromPath('');
- $output .= '
' . (isset($messages['error']) ? st('Review the messages above before visiting your new site.', array('@url' => $url)) : st('Visit your new site.', array('@url' => $url))) . '
';
+ $output .= '
' . (isset($messages['error']) ? t('Review the messages above before visiting your new site.', array('@url' => $url)) : t('Visit your new site.', array('@url' => $url))) . '
';
// Run cron to populate update status tables (if available) so that users
// will be warned if they've installed an out of date Drupal version.
@@ -1979,7 +2011,7 @@ function _install_module_batch($module, $module_name, &$context) {
// steps.
module_enable(array($module), FALSE);
$context['results'][] = $module;
- $context['message'] = st('Installed %module module.', array('%module' => $module_name));
+ $context['message'] = t('Installed %module module.', array('%module' => $module_name));
}
/**
@@ -2048,39 +2080,39 @@ function install_check_translations($install_state) {
// If the translations directory does not exists, throw an error.
if (!$translations_directory_exists) {
$requirements['translations directory exists'] = array(
- 'title' => st('Translations directory'),
- 'value' => st('The translations directory does not exist.'),
+ 'title' => t('Translations directory'),
+ 'value' => t('The translations directory does not exist.'),
'severity' => REQUIREMENT_ERROR,
- 'description' => st('The installer requires that you create a translations directory as part of the installation process. Create the directory %translations_directory . More details about installing Drupal are available in INSTALL.txt.', array('%translations_directory' => $translations_directory, '@install_txt' => base_path() . 'core/INSTALL.txt')),
+ 'description' => t('The installer requires that you create a translations directory as part of the installation process. Create the directory %translations_directory . More details about installing Drupal are available in INSTALL.txt.', array('%translations_directory' => $translations_directory, '@install_txt' => base_path() . 'core/INSTALL.txt')),
);
}
else {
$requirements['translations directory exists'] = array(
- 'title' => st('Translations directory'),
- 'value' => st('The diretory %translations_directory exists.', array('%translations_directory' => $translations_directory)),
+ 'title' => t('Translations directory'),
+ 'value' => t('The diretory %translations_directory exists.', array('%translations_directory' => $translations_directory)),
);
// If the translations directory is not readable, throw an error.
if (!$readable) {
$requirements['translations directory readable'] = array(
- 'title' => st('Translations directory'),
- 'value' => st('The translations directory is not readable.'),
+ 'title' => t('Translations directory'),
+ 'value' => t('The translations directory is not readable.'),
'severity' => REQUIREMENT_ERROR,
- 'description' => st('The installer requires read permissions to %translations_directory at all times. If you are unsure how to grant file permissions, consult the online handbook.', array('%translations_directory' => $translations_directory, '@handbook_url' => 'http://drupal.org/server-permissions')),
+ 'description' => t('The installer requires read permissions to %translations_directory at all times. If you are unsure how to grant file permissions, consult the online handbook.', array('%translations_directory' => $translations_directory, '@handbook_url' => 'http://drupal.org/server-permissions')),
);
}
// If translations directory is not writable, throw an error.
if (!$writable) {
$requirements['translations directory writable'] = array(
- 'title' => st('Translations directory'),
- 'value' => st('The translations directory is not writable.'),
+ 'title' => t('Translations directory'),
+ 'value' => t('The translations directory is not writable.'),
'severity' => REQUIREMENT_ERROR,
- 'description' => st('The installer requires write permissions to %translations_directory during the installation process. If you are unsure how to grant file permissions, consult the online handbook.', array('%translations_directory' => $translations_directory, '@handbook_url' => 'http://drupal.org/server-permissions')),
+ 'description' => t('The installer requires write permissions to %translations_directory during the installation process. If you are unsure how to grant file permissions, consult the online handbook.', array('%translations_directory' => $translations_directory, '@handbook_url' => 'http://drupal.org/server-permissions')),
);
}
else {
$requirements['translations directory writable'] = array(
- 'title' => st('Translations directory'),
- 'value' => st('The translations directory is writable.'),
+ 'title' => t('Translations directory'),
+ 'value' => t('The translations directory is writable.'),
);
}
}
@@ -2088,31 +2120,31 @@ function install_check_translations($install_state) {
// If the translations server can not be contacted, throw an error.
if (!$online) {
$requirements['online'] = array(
- 'title' => st('Internet'),
- 'value' => st('The translation server is offline.'),
+ 'title' => t('Internet'),
+ 'value' => t('The translation server is offline.'),
'severity' => REQUIREMENT_ERROR,
- 'description' => st('The installer requires to contact the translation server to download a translation file. Check your internet connection and verify that your website can reach the translation server at !server_url.', array('!server_url' => $server_url)),
+ 'description' => t('The installer requires to contact the translation server to download a translation file. Check your internet connection and verify that your website can reach the translation server at !server_url.', array('!server_url' => $server_url)),
);
}
else {
$requirements['online'] = array(
- 'title' => st('Internet'),
- 'value' => st('The translation server is online.'),
+ 'title' => t('Internet'),
+ 'value' => t('The translation server is online.'),
);
// If translation file is not found at the translation server, throw an
// error.
if (!$translation_available) {
$requirements['translation available'] = array(
- 'title' => st('Translation'),
- 'value' => st('The %language translation is not available.', array('%language' => $language)),
+ 'title' => t('Translation'),
+ 'value' => t('The %language translation is not available.', array('%language' => $language)),
'severity' => REQUIREMENT_ERROR,
- 'description' => st('The %language translation file is not available at the translation server. Choose a different language or select English and translate your website later.', array('%language' => $language, '!url' => check_url($_SERVER['SCRIPT_NAME']))),
+ 'description' => t('The %language translation file is not available at the translation server. Choose a different language or select English and translate your website later.', array('%language' => $language, '!url' => check_url($_SERVER['SCRIPT_NAME']))),
);
}
else {
$requirements['translation available'] = array(
- 'title' => st('Translation'),
- 'value' => st('The %language translation is available.', array('%language' => $language)),
+ 'title' => t('Translation'),
+ 'value' => t('The %language translation is available.', array('%language' => $language)),
);
}
}
@@ -2122,10 +2154,10 @@ function install_check_translations($install_state) {
if (!$translation_downloaded) {
$requirements['translation downloaded'] = array(
- 'title' => st('Translation'),
- 'value' => st('The %language translation could not be downloaded.', array('%language' => $language)),
+ 'title' => t('Translation'),
+ 'value' => t('The %language translation could not be downloaded.', array('%language' => $language)),
'severity' => REQUIREMENT_ERROR,
- 'description' => st('The %language translation file could not be downloaded. Choose a different language or select English and translate your website later.', array('%language' => $language, '!url' => check_url($_SERVER['SCRIPT_NAME']))),
+ 'description' => t('The %language translation file could not be downloaded. Choose a different language or select English and translate your website later.', array('%language' => $language, '!url' => check_url($_SERVER['SCRIPT_NAME']))),
);
}
}
@@ -2167,10 +2199,10 @@ function install_check_requirements($install_state) {
// error.
if (!drupal_verify_install_file($default_settings_file, FILE_EXIST|FILE_READABLE)) {
$requirements['default settings file exists'] = array(
- 'title' => st('Default settings file'),
- 'value' => st('The default settings file does not exist.'),
+ 'title' => t('Default settings file'),
+ 'value' => t('The default settings file does not exist.'),
'severity' => REQUIREMENT_ERROR,
- 'description' => st('The @drupal installer requires that the %default-file file not be modified in any way from the original download.', array('@drupal' => drupal_install_profile_distribution_name(), '%default-file' => $default_settings_file)),
+ 'description' => t('The @drupal installer requires that the %default-file file not be modified in any way from the original download.', array('@drupal' => drupal_install_profile_distribution_name(), '%default-file' => $default_settings_file)),
);
}
// Otherwise, if settings.php does not exist yet, we can try to copy
@@ -2222,47 +2254,47 @@ function install_check_requirements($install_state) {
// If settings.php does not exist, throw an error.
if (!$exists) {
$requirements['settings file exists'] = array(
- 'title' => st('Settings file'),
- 'value' => st('The settings file does not exist.'),
+ 'title' => t('Settings file'),
+ 'value' => t('The settings file does not exist.'),
'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_distribution_name(), '%file' => $file, '%default_file' => $default_settings_file, '@install_txt' => base_path() . 'core/INSTALL.txt')),
+ '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_distribution_name(), '%file' => $file, '%default_file' => $default_settings_file, '@install_txt' => base_path() . 'core/INSTALL.txt')),
);
}
else {
$requirements['settings file exists'] = array(
- 'title' => st('Settings file'),
- 'value' => st('The %file file exists.', array('%file' => $file)),
+ 'title' => t('Settings file'),
+ 'value' => t('The %file file exists.', array('%file' => $file)),
);
// If settings.php is not readable, throw an error.
if (!$readable) {
$requirements['settings file readable'] = array(
- 'title' => st('Settings file'),
- 'value' => st('The settings file is not readable.'),
+ 'title' => t('Settings file'),
+ 'value' => t('The settings file is not readable.'),
'severity' => REQUIREMENT_ERROR,
- 'description' => st('@drupal requires read permissions to %file at all times. If you are unsure how to grant file permissions, consult the online handbook.', array('@drupal' => drupal_install_profile_distribution_name(), '%file' => $file, '@handbook_url' => 'http://drupal.org/server-permissions')),
+ 'description' => t('@drupal requires read permissions to %file at all times. If you are unsure how to grant file permissions, consult the online handbook.', array('@drupal' => drupal_install_profile_distribution_name(), '%file' => $file, '@handbook_url' => 'http://drupal.org/server-permissions')),
);
}
// If settings.php is not writable, throw an error.
if (!$writable) {
$requirements['settings file writable'] = array(
- 'title' => st('Settings file'),
- 'value' => st('The settings file is not writable.'),
+ 'title' => t('Settings file'),
+ 'value' => t('The settings file is not writable.'),
'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, consult the online handbook.', array('@drupal' => drupal_install_profile_distribution_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, consult the online handbook.', array('@drupal' => drupal_install_profile_distribution_name(), '%file' => $file, '@handbook_url' => 'http://drupal.org/server-permissions')),
);
}
else {
$requirements['settings file'] = array(
- 'title' => st('Settings file'),
- 'value' => st('The settings file is writable.'),
+ 'title' => t('Settings file'),
+ 'value' => t('The settings file is writable.'),
);
}
if (!empty($settings_file_ownership_error)) {
$requirements['settings file ownership'] = array(
- 'title' => st('Settings file'),
- 'value' => st('The settings file is owned by the web server.'),
+ 'title' => t('Settings file'),
+ 'value' => t('The settings file is owned by the web server.'),
'severity' => REQUIREMENT_ERROR,
- 'description' => st('The @drupal installer failed to create a settings file with proper file ownership. Log on to your web server, remove the existing %file file, and create a new one by copying the %default_file file to %file. More details about installing Drupal are available in INSTALL.txt. If you have problems with the file permissions on your server, consult the online handbook.', array('@drupal' => drupal_install_profile_distribution_name(), '%file' => $file, '%default_file' => $default_settings_file, '@install_txt' => base_path() . 'core/INSTALL.txt', '@handbook_url' => 'http://drupal.org/server-permissions')),
+ 'description' => t('The @drupal installer failed to create a settings file with proper file ownership. Log on to your web server, remove the existing %file file, and create a new one by copying the %default_file file to %file. More details about installing Drupal are available in INSTALL.txt. If you have problems with the file permissions on your server, consult the online handbook.', array('@drupal' => drupal_install_profile_distribution_name(), '%file' => $file, '%default_file' => $default_settings_file, '@install_txt' => base_path() . 'core/INSTALL.txt', '@handbook_url' => 'http://drupal.org/server-permissions')),
);
}
}
@@ -2297,9 +2329,9 @@ function install_display_requirements($install_state, $requirements) {
// and indicating a desire to continue anyway. See drupal_requirements_url().
if ($severity == REQUIREMENT_ERROR || ($severity == REQUIREMENT_WARNING && empty($install_state['parameters']['continue']))) {
if ($install_state['interactive']) {
- drupal_set_title(st('Requirements problem'));
+ drupal_set_title(t('Requirements problem'));
$status_report = theme('status_report', array('requirements' => $requirements));
- $status_report .= st('Check the messages and try again.', array('!url' => check_url(drupal_requirements_url($severity))));
+ $status_report .= t('Check the messages and try again.', array('!url' => check_url(drupal_requirements_url($severity))));
return $status_report;
}
else {
@@ -2334,32 +2366,32 @@ function install_display_requirements($install_state, $requirements) {
function _install_configure_form($form, &$form_state, &$install_state) {
$form['site_information'] = array(
'#type' => 'details',
- '#title' => st('Site information'),
+ '#title' => t('Site information'),
);
$form['site_information']['site_name'] = array(
'#type' => 'textfield',
- '#title' => st('Site name'),
+ '#title' => t('Site name'),
'#required' => TRUE,
'#weight' => -20,
);
$form['site_information']['site_mail'] = array(
'#type' => 'email',
- '#title' => st('Site e-mail address'),
+ '#title' => t('Site e-mail address'),
'#default_value' => ini_get('sendmail_from'),
- '#description' => st("Automated e-mails, such as registration information, will be sent from this address. Use an address ending in your site's domain to help prevent these e-mails from being flagged as spam."),
+ '#description' => t("Automated e-mails, such as registration information, will be sent from this address. Use an address ending in your site's domain to help prevent these e-mails from being flagged as spam."),
'#required' => TRUE,
'#weight' => -15,
);
$form['admin_account'] = array(
'#type' => 'details',
- '#title' => st('Site maintenance account'),
+ '#title' => t('Site maintenance account'),
);
$form['admin_account']['account']['#tree'] = TRUE;
$form['admin_account']['account']['name'] = array('#type' => 'textfield',
- '#title' => st('Username'),
+ '#title' => t('Username'),
'#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.'),
'#required' => TRUE,
'#weight' => -10,
'#attributes' => array('class' => array('username')),
@@ -2367,7 +2399,7 @@ function _install_configure_form($form, &$form_state, &$install_state) {
$form['admin_account']['account']['mail'] = array(
'#type' => 'email',
- '#title' => st('E-mail address'),
+ '#title' => t('E-mail address'),
'#required' => TRUE,
'#weight' => -5,
);
@@ -2380,42 +2412,42 @@ function _install_configure_form($form, &$form_state, &$install_state) {
$form['server_settings'] = array(
'#type' => 'details',
- '#title' => st('Server settings'),
+ '#title' => t('Server settings'),
);
$countries = Drupal::service('country_manager')->getList();
$form['server_settings']['site_default_country'] = array(
'#type' => 'select',
- '#title' => st('Default country'),
+ '#title' => t('Default country'),
'#empty_value' => '',
'#default_value' => config('system.date')->get('country.default'),
'#options' => $countries,
- '#description' => st('Select the default country for the site.'),
+ '#description' => t('Select the default country for the site.'),
'#weight' => 0,
);
$form['server_settings']['date_default_timezone'] = array(
'#type' => 'select',
- '#title' => st('Default time zone'),
+ '#title' => t('Default time zone'),
'#default_value' => date_default_timezone_get(),
'#options' => system_time_zones(),
- '#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.'),
'#weight' => 5,
'#attributes' => array('class' => array('timezone-detect')),
);
$form['update_notifications'] = array(
'#type' => 'details',
- '#title' => st('Update notifications'),
+ '#title' => t('Update notifications'),
);
$form['update_notifications']['update_status_module'] = array(
'#type' => 'checkboxes',
'#options' => array(
- 1 => st('Check for updates automatically'),
- 2 => st('Receive e-mail notifications'),
+ 1 => t('Check for updates automatically'),
+ 2 => t('Receive e-mail notifications'),
),
'#default_value' => array(1, 2),
- '#description' => st('The system will notify you when updates and important security releases are available for installed components. Anonymous information about your site is sent to Drupal.org.', array('@drupal' => 'http://drupal.org')),
+ '#description' => t('The system will notify you when updates and important security releases are available for installed components. Anonymous information about your site is sent to Drupal.org.', array('@drupal' => 'http://drupal.org')),
'#weight' => 15,
);
$form['update_notifications']['update_status_module'][2] = array(
@@ -2429,7 +2461,7 @@ function _install_configure_form($form, &$form_state, &$install_state) {
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
- '#value' => st('Save and continue'),
+ '#value' => t('Save and continue'),
'#weight' => 15,
);
diff --git a/core/includes/install.inc b/core/includes/install.inc
index 503b3da..41dc7e7 100644
--- a/core/includes/install.inc
+++ b/core/includes/install.inc
@@ -9,8 +9,6 @@
use Drupal\Component\Utility\Crypt;
use Drupal\Core\Database\Database;
use Drupal\Core\DrupalKernel;
-use Drupal\Core\StringTranslation\TranslationManager;
-use Drupal\Core\StringTranslation\Translator\CustomStrings;
/**
* Requirement severity -- Informational message only.
@@ -600,10 +598,10 @@ function drupal_verify_profile($install_state) {
$modules[] = '' . drupal_ucfirst($module) . '';
}
$requirements['required_modules'] = array(
- 'title' => st('Required modules'),
- 'value' => st('Required modules not found.'),
+ 'title' => t('Required modules'),
+ 'value' => t('Required modules not found.'),
'severity' => REQUIREMENT_ERROR,
- 'description' => st('The following modules are required but were not found. Move them into the appropriate modules subdirectory, such as /modules. Missing modules: !modules', array('!modules' => implode(', ', $modules))),
+ 'description' => t('The following modules are required but were not found. Move them into the appropriate modules subdirectory, such as /modules. Missing modules: !modules', array('!modules' => implode(', ', $modules))),
);
}
return $requirements;
@@ -931,45 +929,6 @@ function drupal_requirements_url($severity) {
}
/**
- * Translates a string when some systems are not available.
- *
- * Used during the install process, when database, theme, and localization
- * system is possibly not yet available.
- *
- * Use t() if your code will never run during the Drupal installation phase.
- * Use st() if your code will only run during installation and never any other
- * time. Use get_t() if your code could run in either circumstance.
- *
- * @see t()
- * @see get_t()
- * @ingroup sanitization
- */
-function st($string, array $args = array(), array $options = array()) {
- global $install_state;
- static $install_translation;
-
- // This may be invoked before the container has been initialized.
- $container = Drupal::getContainer();
- if ($container && $container->has('translation')) {
- // Since the container is properly initialized, we can use standard translation.
- return t($string, $args, $options);
- }
- elseif (drupal_installation_attempted() && isset($install_state['parameters']['langcode'])) {
- // The translation service is not there yet, use a temporary one.
- if (!isset($install_translation)) {
- $install_translation = new TranslationManager();
- foreach (array(new CustomStrings(), install_file_translation_service()) as $translator) {
- $install_translation->addTranslator($translator);
- }
- $install_translation->setDefaultLangcode($install_state['parameters']['langcode']);
- }
- return $install_translation->translate($string, $args, $options);
- }
- // Just return an untraslated string.
- return format_string($string, $args);
-}
-
-/**
* Checks an installation profile's requirements.
*
* @param string $profile
diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc
index b9a513c..6a07c71 100644
--- a/core/includes/theme.maintenance.inc
+++ b/core/includes/theme.maintenance.inc
@@ -119,7 +119,6 @@ function _theme_load_offline_registry($theme, $base_theme = NULL, $theme_engine
* @ingroup themeable
*/
function theme_task_list($variables) {
- $t = get_t();
$items = $variables['items'];
$active = $variables['active'];
@@ -130,12 +129,12 @@ function theme_task_list($variables) {
foreach ($items as $k => $item) {
if ($active == $k) {
$class = 'active';
- $status = '(' . $t('active') . ')';
+ $status = '(' . t('active') . ')';
$done = FALSE;
}
else {
$class = $done ? 'done' : '';
- $status = $done ? '(' . $t('done') . ')' : '';
+ $status = $done ? '(' . t('done') . ')' : '';
}
$output .= '
';
diff --git a/core/includes/unicode.inc b/core/includes/unicode.inc
index 1b9bcf1..9540d42 100644
--- a/core/includes/unicode.inc
+++ b/core/includes/unicode.inc
@@ -12,13 +12,10 @@
* Returns Unicode library status and errors.
*/
function unicode_requirements() {
- // Ensure translations don't break during installation.
- $t = get_t();
-
$libraries = array(
- Unicode::STATUS_SINGLEBYTE => $t('Standard PHP'),
- Unicode::STATUS_MULTIBYTE => $t('PHP Mbstring Extension'),
- Unicode::STATUS_ERROR => $t('Error'),
+ Unicode::STATUS_SINGLEBYTE => t('Standard PHP'),
+ Unicode::STATUS_MULTIBYTE => t('PHP Mbstring Extension'),
+ Unicode::STATUS_ERROR => t('Error'),
);
$severities = array(
Unicode::STATUS_SINGLEBYTE => REQUIREMENT_WARNING,
@@ -29,30 +26,30 @@ function unicode_requirements() {
$library = Unicode::getStatus();
$requirements['unicode'] = array(
- 'title' => $t('Unicode library'),
+ 'title' => t('Unicode library'),
'value' => $libraries[$library],
'severity' => $severities[$library],
);
$t_args = array('@url' => 'http://www.php.net/mbstring');
switch ($failed_check) {
case 'mb_strlen':
- $requirements['unicode']['description'] = $t('Operations on Unicode strings are emulated on a best-effort basis. Install the PHP mbstring extension for improved Unicode support.', $t_args);
+ $requirements['unicode']['description'] = t('Operations on Unicode strings are emulated on a best-effort basis. Install the PHP mbstring extension for improved Unicode support.', $t_args);
break;
case 'mbstring.func_overload':
- $requirements['unicode']['description'] = $t('Multibyte string function overloading in PHP is active and must be disabled. Check the php.ini mbstring.func_overload setting. Please refer to the PHP mbstring documentation for more information.', $t_args);
+ $requirements['unicode']['description'] = t('Multibyte string function overloading in PHP is active and must be disabled. Check the php.ini mbstring.func_overload setting. Please refer to the PHP mbstring documentation for more information.', $t_args);
break;
case 'mbstring.encoding_translation':
- $requirements['unicode']['description'] = $t('Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini mbstring.encoding_translation setting. Please refer to the PHP mbstring documentation for more information.', $t_args);
+ $requirements['unicode']['description'] = t('Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini mbstring.encoding_translation setting. Please refer to the PHP mbstring documentation for more information.', $t_args);
break;
case 'mbstring.http_input':
- $requirements['unicode']['description'] = $t('Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini mbstring.http_input setting. Please refer to the PHP mbstring documentation for more information.', $t_args);
+ $requirements['unicode']['description'] = t('Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini mbstring.http_input setting. Please refer to the PHP mbstring documentation for more information.', $t_args);
break;
case 'mbstring.http_output':
- $requirements['unicode']['description'] = $t('Multibyte string output conversion in PHP is active and must be disabled. Check the php.ini mbstring.http_output setting. Please refer to the PHP mbstring documentation for more information.', $t_args);
+ $requirements['unicode']['description'] = t('Multibyte string output conversion in PHP is active and must be disabled. Check the php.ini mbstring.http_output setting. Please refer to the PHP mbstring documentation for more information.', $t_args);
break;
}
diff --git a/core/lib/Drupal/Component/Gettext/PoStreamReader.php b/core/lib/Drupal/Component/Gettext/PoStreamReader.php
index f611fba..e3ac4b8 100644
--- a/core/lib/Drupal/Component/Gettext/PoStreamReader.php
+++ b/core/lib/Drupal/Component/Gettext/PoStreamReader.php
@@ -280,7 +280,6 @@ private function readLine() {
'%uri' => $this->getURI(),
'%line' => $this->_line_number,
);
- $t = get_t();
// Trim away the linefeed. \\n might appear at the end of the string if
// another line continuing the same string follows. We can remove that.
@@ -306,7 +305,7 @@ private function readLine() {
}
else {
// A comment following any other context is a syntax error.
- $this->_errors[] = $t('The translation stream %uri contains an error: "msgstr" was expected but not found on line %line.', $log_vars);
+ $this->_errors[] = t('The translation stream %uri contains an error: "msgstr" was expected but not found on line %line.', $log_vars);
return FALSE;
}
return;
@@ -316,7 +315,7 @@ private function readLine() {
if ($this->_context != 'MSGID') {
// A plural form can only be added to an msgid directly.
- $this->_errors[] = $t('The translation stream %uri contains an error: "msgid_plural" was expected but not found on line %line.', $log_vars);
+ $this->_errors[] = t('The translation stream %uri contains an error: "msgid_plural" was expected but not found on line %line.', $log_vars);
return FALSE;
}
@@ -327,7 +326,7 @@ private function readLine() {
$quoted = $this->parseQuoted($line);
if ($quoted === FALSE) {
// The plural form must be wrapped in quotes.
- $this->_errors[] = $t('The translation stream %uri contains a syntax error on line %line.', $log_vars);
+ $this->_errors[] = t('The translation stream %uri contains a syntax error on line %line.', $log_vars);
return FALSE;
}
@@ -354,7 +353,7 @@ private function readLine() {
}
elseif ($this->_context == 'MSGID') {
// We are currently already in the context, meaning we passed an id with no data.
- $this->_errors[] = $t('The translation stream %uri contains an error: "msgid" is unexpected on line %line.', $log_vars);
+ $this->_errors[] = t('The translation stream %uri contains an error: "msgid" is unexpected on line %line.', $log_vars);
return FALSE;
}
@@ -365,7 +364,7 @@ private function readLine() {
$quoted = $this->parseQuoted($line);
if ($quoted === FALSE) {
// The message id must be wrapped in quotes.
- $this->_errors[] = $t('The translation stream %uri contains an error: invalid format for "msgid" on line %line.', $log_vars, $log_vars);
+ $this->_errors[] = t('The translation stream %uri contains an error: invalid format for "msgid" on line %line.', $log_vars, $log_vars);
return FALSE;
}
@@ -383,7 +382,7 @@ private function readLine() {
}
elseif (!empty($this->_current_item['msgctxt'])) {
// A context cannot apply to another context.
- $this->_errors[] = $t('The translation stream %uri contains an error: "msgctxt" is unexpected on line %line.', $log_vars);
+ $this->_errors[] = t('The translation stream %uri contains an error: "msgctxt" is unexpected on line %line.', $log_vars);
return FALSE;
}
@@ -394,7 +393,7 @@ private function readLine() {
$quoted = $this->parseQuoted($line);
if ($quoted === FALSE) {
// The context string must be quoted.
- $this->_errors[] = $t('The translation stream %uri contains an error: invalid format for "msgctxt" on line %line.', $log_vars);
+ $this->_errors[] = t('The translation stream %uri contains an error: invalid format for "msgctxt" on line %line.', $log_vars);
return FALSE;
}
@@ -412,13 +411,13 @@ private function readLine() {
($this->_context != 'MSGSTR_ARR')) {
// Plural message strings must come after msgid, msgxtxt,
// msgid_plural, or other msgstr[] entries.
- $this->_errors[] = $t('The translation stream %uri contains an error: "msgstr[]" is unexpected on line %line.', $log_vars);
+ $this->_errors[] = t('The translation stream %uri contains an error: "msgstr[]" is unexpected on line %line.', $log_vars);
return FALSE;
}
// Ensure the plurality is terminated.
if (strpos($line, ']') === FALSE) {
- $this->_errors[] = $t('The translation stream %uri contains an error: invalid format for "msgstr[]" on line %line.', $log_vars);
+ $this->_errors[] = t('The translation stream %uri contains an error: invalid format for "msgstr[]" on line %line.', $log_vars);
return FALSE;
}
@@ -433,7 +432,7 @@ private function readLine() {
$quoted = $this->parseQuoted($line);
if ($quoted === FALSE) {
// The string must be quoted.
- $this->_errors[] = $t('The translation stream %uri contains an error: invalid format for "msgstr[]" on line %line.', $log_vars);
+ $this->_errors[] = t('The translation stream %uri contains an error: invalid format for "msgstr[]" on line %line.', $log_vars);
return FALSE;
}
if (!isset($this->_current_item['msgstr']) || !is_array($this->_current_item['msgstr'])) {
@@ -450,7 +449,7 @@ private function readLine() {
if (($this->_context != 'MSGID') && ($this->_context != 'MSGCTXT')) {
// Strings are only valid within an id or context scope.
- $this->_errors[] = $t('The translation stream %uri contains an error: "msgstr" is unexpected on line %line.', $log_vars);
+ $this->_errors[] = t('The translation stream %uri contains an error: "msgstr" is unexpected on line %line.', $log_vars);
return FALSE;
}
@@ -461,7 +460,7 @@ private function readLine() {
$quoted = $this->parseQuoted($line);
if ($quoted === FALSE) {
// The string must be quoted.
- $this->_errors[] = $t('The translation stream %uri contains an error: invalid format for "msgstr" on line %line.', $log_vars);
+ $this->_errors[] = t('The translation stream %uri contains an error: invalid format for "msgstr" on line %line.', $log_vars);
return FALSE;
}
@@ -476,7 +475,7 @@ private function readLine() {
$quoted = $this->parseQuoted($line);
if ($quoted === FALSE) {
// This string must be quoted.
- $this->_errors[] = $t('The translation stream %uri contains an error: string continuation expected on line %line.', $log_vars);
+ $this->_errors[] = t('The translation stream %uri contains an error: string continuation expected on line %line.', $log_vars);
return FALSE;
}
@@ -506,7 +505,7 @@ private function readLine() {
}
else {
// No valid context to append to.
- $this->_errors[] = $t('The translation stream %uri contains an error: unexpected string on line %line.', $log_vars);
+ $this->_errors[] = t('The translation stream %uri contains an error: unexpected string on line %line.', $log_vars);
return FALSE;
}
return;
@@ -519,7 +518,7 @@ private function readLine() {
$this->_current_item = array();
}
elseif ($this->_context != 'COMMENT') {
- $this->_errors[] = $t('The translation stream %uri ended unexpectedly at line %line.', $log_vars);
+ $this->_errors[] = t('The translation stream %uri ended unexpectedly at line %line.', $log_vars);
return FALSE;
}
}
diff --git a/core/lib/Drupal/Core/Database/Driver/mysql/Install/Tasks.php b/core/lib/Drupal/Core/Database/Driver/mysql/Install/Tasks.php
index 0f09aae..e4ecd99 100644
--- a/core/lib/Drupal/Core/Database/Driver/mysql/Install/Tasks.php
+++ b/core/lib/Drupal/Core/Database/Driver/mysql/Install/Tasks.php
@@ -27,7 +27,7 @@ class Tasks extends InstallTasks {
* Returns a human-readable name string for MySQL and equivalent databases.
*/
public function name() {
- return st('MySQL, MariaDB, or equivalent');
+ return t('MySQL, MariaDB, or equivalent');
}
/**
@@ -70,13 +70,13 @@ protected function connect() {
catch (DatabaseNotFoundException $e) {
// Still no dice; probably a permission issue. Raise the error to the
// installer.
- $this->fail(st('Database %database not found. The server reports the following message when attempting to create the database: %error.', array('%database' => $database, '%error' => $e->getMessage())));
+ $this->fail(t('Database %database not found. The server reports the following message when attempting to create the database: %error.', array('%database' => $database, '%error' => $e->getMessage())));
}
}
else {
// Database connection failed for some other reason than the database
// not existing.
- $this->fail(st('Failed to connect to your database server. The server reports the following message: %error.
Is the database server running?
Does the database exist or does the database user have sufficient privileges to create the database?
Have you entered the correct database name?
Have you entered the correct username and password?
Have you entered the correct database hostname?
', array('%error' => $e->getMessage())));
+ $this->fail(t('Failed to connect to your database server. The server reports the following message: %error.
Is the database server running?
Does the database exist or does the database user have sufficient privileges to create the database?
Have you entered the correct database name?
Have you entered the correct username and password?
Have you entered the correct database hostname?
', array('%error' => $e->getMessage())));
return FALSE;
}
}
diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
index 1a053c0..1c97985 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
@@ -34,7 +34,7 @@ public function __construct() {
}
public function name() {
- return st('PostgreSQL');
+ return t('PostgreSQL');
}
public function minimumVersion() {
@@ -84,13 +84,13 @@ protected function connect() {
catch (DatabaseNotFoundException $e) {
// Still no dice; probably a permission issue. Raise the error to the
// installer.
- $this->fail(st('Database %database not found. The server reports the following message when attempting to create the database: %error.', array('%database' => $database, '%error' => $e->getMessage())));
+ $this->fail(t('Database %database not found. The server reports the following message when attempting to create the database: %error.', array('%database' => $database, '%error' => $e->getMessage())));
}
}
else {
// Database connection failed for some other reason than the database
// not existing.
- $this->fail(st('Failed to connect to your database server. The server reports the following message: %error.
Is the database server running?
Does the database exist, and have you entered the correct database name?
Have you entered the correct username and password?
Have you entered the correct database hostname?
', array('%error' => $e->getMessage())));
+ $this->fail(t('Failed to connect to your database server. The server reports the following message: %error.
Is the database server running?
Does the database exist, and have you entered the correct database name?
Have you entered the correct username and password?
Have you entered the correct database hostname?
', array('%error' => $e->getMessage())));
return FALSE;
}
}
@@ -103,7 +103,7 @@ protected function connect() {
protected function checkEncoding() {
try {
if (db_query('SHOW server_encoding')->fetchField() == 'UTF8') {
- $this->pass(st('Database is encoded in UTF-8'));
+ $this->pass(t('Database is encoded in UTF-8'));
}
else {
$replacements = array(
@@ -113,11 +113,11 @@ protected function checkEncoding() {
);
$text = 'The %driver database must use %encoding encoding to work with Drupal.';
$text .= 'Recreate the database with %encoding encoding. See !link for more details.';
- $this->fail(st($text, $replacements));
+ $this->fail(t($text, $replacements));
}
}
catch (\Exception $e) {
- $this->fail(st('Drupal could not determine the encoding of the database was set to UTF-8'));
+ $this->fail(t('Drupal could not determine the encoding of the database was set to UTF-8'));
}
}
@@ -236,4 +236,3 @@ function initializeDatabase() {
}
}
}
-
diff --git a/core/lib/Drupal/Core/Database/Driver/sqlite/Install/Tasks.php b/core/lib/Drupal/Core/Database/Driver/sqlite/Install/Tasks.php
index ab12bcc..1079688 100644
--- a/core/lib/Drupal/Core/Database/Driver/sqlite/Install/Tasks.php
+++ b/core/lib/Drupal/Core/Database/Driver/sqlite/Install/Tasks.php
@@ -16,7 +16,7 @@ class Tasks extends InstallTasks {
protected $pdoDriver = 'sqlite';
public function name() {
- return st('SQLite');
+ return t('SQLite');
}
/**
@@ -35,8 +35,8 @@ public function getFormOptions($database) {
unset($form['username'], $form['password'], $form['advanced_options']['host'], $form['advanced_options']['port']);
// Make the text more accurate for SQLite.
- $form['database']['#title'] = st('Database file');
- $form['database']['#description'] = st('The absolute path to the file where @drupal data will be stored. This must be writable by the web server and should exist outside of the web root.', array('@drupal' => drupal_install_profile_distribution_name()));
+ $form['database']['#title'] = t('Database file');
+ $form['database']['#description'] = t('The absolute path to the file where @drupal data will be stored. This must be writable by the web server and should exist outside of the web root.', array('@drupal' => drupal_install_profile_distribution_name()));
$default_database = conf_path(FALSE, TRUE) . '/files/.ht.sqlite';
$form['database']['#default_value'] = empty($database['database']) ? $default_database : $database['database'];
return $form;
@@ -86,17 +86,16 @@ protected function connect() {
catch (DatabaseNotFoundException $e) {
// Still no dice; probably a permission issue. Raise the error to the
// installer.
- $this->fail(st('Database %database not found. The server reports the following message when attempting to create the database: %error.', array('%database' => $database, '%error' => $e->getMessage())));
+ $this->fail(t('Database %database not found. The server reports the following message when attempting to create the database: %error.', array('%database' => $database, '%error' => $e->getMessage())));
}
}
else {
// Database connection failed for some other reason than the database
// not existing.
- $this->fail(st('Failed to connect to your database server. The server reports the following message: %error.
Is the database server running?
Does the database exist, and have you entered the correct database name?
Have you entered the correct username and password?
Have you entered the correct database hostname?
', array('%error' => $e->getMessage())));
+ $this->fail(t('Failed to connect to your database server. The server reports the following message: %error.
Is the database server running?
Does the database exist, and have you entered the correct database name?
Have you entered the correct username and password?
Have you entered the correct database hostname?
', array('%error' => $e->getMessage())));
return FALSE;
}
}
return TRUE;
}
}
-
diff --git a/core/lib/Drupal/Core/Database/Install/Tasks.php b/core/lib/Drupal/Core/Database/Install/Tasks.php
index b051c75..d46251b 100644
--- a/core/lib/Drupal/Core/Database/Install/Tasks.php
+++ b/core/lib/Drupal/Core/Database/Install/Tasks.php
@@ -137,7 +137,7 @@ public function runTasks() {
}
}
else {
- throw new TaskException(st("Failed to run all tasks against the database server. The task %task wasn't found.", array('%task' => $task['function'])));
+ throw new TaskException(t("Failed to run all tasks against the database server. The task %task wasn't found.", array('%task' => $task['function'])));
}
}
}
@@ -166,7 +166,7 @@ protected function connect() {
$this->pass('Drupal can CONNECT to the database ok.');
}
catch (\Exception $e) {
- $this->fail(st('Failed to connect to your database server. The server reports the following message: %error.
Is the database server running?
Does the database exist, and have you entered the correct database name?
Have you entered the correct username and password?
Have you entered the correct database hostname?
', array('%error' => $e->getMessage())));
+ $this->fail(t('Failed to connect to your database server. The server reports the following message: %error.
Is the database server running?
Does the database exist, and have you entered the correct database name?
Have you entered the correct username and password?