diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 1ecd819..6e7aab9 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -1453,11 +1453,11 @@ function install_translations_directory() { */ 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'); + ->addArgument(install_translations_directory()); + $container->register('string_translator.custom_strings', 'Drupal\Core\StringTranslation\Translator\CustomStrings'); + $container->register('string_translation', 'Drupal\Core\StringTranslation\TranslationManager') + ->addMethodCall('addTranslator', array(new Reference('string_translator.file_translation'))) + ->addMethodCall('addTranslator', array(new Reference('string_translator.custom_strings'))); } /** diff --git a/core/modules/system/lib/Drupal/system/Tests/Installer/InstallerTranslationTest.php b/core/modules/system/lib/Drupal/system/Tests/Installer/InstallerTranslationTest.php index 1f689ac..90ac157 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Installer/InstallerTranslationTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Installer/InstallerTranslationTest.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\system\Tests\Installer\InstallerTranslationTest. + * Contains \Drupal\system\Tests\Installer\InstallerTranslationTest. */ namespace Drupal\system\Tests\Installer; @@ -34,7 +34,7 @@ protected function setUp() { $this->originalBatch = batch_get(); // Add the translations directory so we can retrieve german translations. - $conf['locale.settings']['translation.path'] = drupal_get_path('module', 'simpletest') . '/files/translations'; + $conf['locale.settings']['translation.path'] = drupal_get_path('module', 'simpletest') . '/files/translations'; // Create the database prefix for this test. $this->prepareDatabasePrefix(); @@ -60,9 +60,10 @@ protected function setUp() { $variable_groups = array( 'system.file' => array( 'path.private' => $this->private_files_directory, - 'path.temporary' => $this->temp_files_directory, + 'path.temporary' => $this->temp_files_directory, ), - 'locale.settings' => array( + 'locale.settings' => array( + 'translation.use_source' => 'local', 'translation.path' => $this->translation_files_directory, ), ); @@ -81,10 +82,24 @@ protected function setUp() { ); $this->writeSettings($settings); - $this->drupalGet($GLOBALS['base_url'] . '/core/install.php?langcode=de&profile=minimal'); - // Make sure that interface is translated. - $this->assertNoText('Set up database', 'Set up database string succesflly translated.'); - $this->drupalPost(NULL, array(), 'Save and continue'); + // Submit the installer with German language. + $this->drupalPost($GLOBALS['base_url'] . '/core/install.php', array('langcode' => 'de'), 'Save and continue'); + + // On the following page where installation profile is being selected, + // the interface should be already translated. + $this->assertNoText('Set up database', '"Set up database" string successfully translated.'); + $this->assertNoText('Save and continue', '"Save and continue" string successfully translated.'); + + // Get the "Save and continue" submit button translated value from + // the translated interface. + $submit_value = (string) current($this->xpath('//input[@type="submit"]/@value')); + + // Submit the minimal profile installation. + $this->drupalPost(NULL, array('profile' => 'minimal'), $submit_value); + + // Submit the next step. + $this->drupalPost(NULL, array(), $submit_value); + // Reload config directories. include $this->public_files_directory . '/settings.php'; $prefix = substr($this->public_files_directory, strlen(conf_path() . '/files/'));