diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 3bc3276..b8d1a26 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -1550,7 +1550,10 @@ function install_import_translations(&$install_state) { include_once __DIR__ . '/../modules/locale/locale.bulk.inc'; $langcode = $install_state['parameters']['langcode']; - $language = ConfigurableLanguage::createFromLangcode($langcode); + if (!($language = entity_load('configurable_language', $langcode))) { + // Create the language if not already shipped with a profile. + $language = ConfigurableLanguage::createFromLangcode($langcode); + } $language->set('default', TRUE); $language->save(); @@ -1768,6 +1771,11 @@ function install_check_translations($langcode, $server_pattern) { $translations_directory_exists = TRUE; } + // The file already exists, no need to attempt to download. + if ($existing_file = glob($translations_directory . '/drupal-*.' . $langcode . '.po')) { + return; + } + // Build URLs for the translation file and the translation server. $releases = install_get_localization_release(); $translation_urls = array(); diff --git a/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageForeignTest.php b/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageForeignTest.php index e4ada83..183fce9 100644 --- a/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageForeignTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageForeignTest.php @@ -26,22 +26,6 @@ class InstallerTranslationMultipleLanguageForeignTest extends InstallerTranslati /** * {@inheritdoc} */ - protected function setUpTestingLanguages() { - // Only need to add a Spanish configurable language explicitly because - // German will already be added via the installer language. - $this->settings = array( - 'testing_add_languages' => array( - 0 => (object) array( - 'value' => 'es', - 'required' => TRUE, - ), - ), - ); - } - - /** - * {@inheritdoc} - */ protected function setUpLanguage() { parent::setUpLanguage(); $this->translations['Save and continue'] = 'Save and continue German'; diff --git a/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php b/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php index 9d607b0..879b007 100644 --- a/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php @@ -17,32 +17,11 @@ class InstallerTranslationMultipleLanguageTest extends InstallerTestBase { /** - * Add a setting to instruct the testing profile to add languages. + * Switch to the multilingual testing profile + * + * @var string */ - protected function setUpTestingLanguages() { - // Need to add both Spanish and German configurable language explicitly - // because the installer language is English. - $this->settings = array( - 'testing_add_languages' => array( - 0 => (object) array( - 'value' => 'es', - 'required' => TRUE, - ), - 1 => (object) array( - 'value' => 'de', - 'required' => TRUE, - ), - ), - ); - } - - /** - * {@inheritdoc} - */ - protected function setUp() { - $this->setUpTestingLanguages(); - parent::setUp(); - } + protected $profile = 'testing_multilingual'; /** * {@inheritdoc} diff --git a/core/profiles/testing_multilingual/config/install/language.entity.de.yml b/core/profiles/testing_multilingual/config/install/language.entity.de.yml new file mode 100644 index 0000000..e72a74a --- /dev/null +++ b/core/profiles/testing_multilingual/config/install/language.entity.de.yml @@ -0,0 +1,7 @@ +id: de +label: German +direction: 0 +weight: 0 +locked: false +status: true +langcode: en diff --git a/core/profiles/testing_multilingual/config/install/language.entity.es.yml b/core/profiles/testing_multilingual/config/install/language.entity.es.yml new file mode 100644 index 0000000..e8b4dca --- /dev/null +++ b/core/profiles/testing_multilingual/config/install/language.entity.es.yml @@ -0,0 +1,7 @@ +id: es +label: Spanish +direction: 0 +weight: 0 +locked: false +status: true +langcode: en diff --git a/core/profiles/testing_multilingual/testing_multilingual.info.yml b/core/profiles/testing_multilingual/testing_multilingual.info.yml new file mode 100644 index 0000000..3615e0b --- /dev/null +++ b/core/profiles/testing_multilingual/testing_multilingual.info.yml @@ -0,0 +1,8 @@ +name: Testing multilingual +type: profile +description: 'Minimal profile for running tests with a multilingual installer.' +version: VERSION +core: 8.x +hidden: true +dependencies: + - locale