Commit 44ad6d79 authored by alexpott's avatar alexpott

Issue #2345969 by webflo, mauzeh: Fixed Keep English during installation.

parent 1c95b46b
......@@ -1566,7 +1566,9 @@ function install_download_additional_translations_operations(&$install_state) {
if ($langcode != 'en') {
\Drupal::config('system.site')->set('langcode', $langcode)->save();
\Drupal::service('language.default')->set($language);
entity_delete_multiple('configurable_language', array('en'));
if (empty($install_state['profile_info']['keep_english'])) {
entity_delete_multiple('configurable_language', array('en'));
}
}
// If there is more than one language or the single one is not English, we
......
<?php
/**
* @file
* Contains \Drupal\system\Tests\Installer\InstallerTranslationMultipleLanguageForeignTest.
*/
namespace Drupal\system\Tests\Installer;
use Drupal\simpletest\InstallerTestBase;
/**
* Tests translation files for multiple languages get imported during install.
*
* @group Installer
*/
class InstallerTranslationMultipleLanguageKeepEnglishTest extends InstallerTestBase {
/**
* Overrides the language code in which to install Drupal.
*
* @var string
*/
protected $langcode = 'de';
/**
* Switch to the multilingual testing profile
*
* @var string
*/
protected $profile = 'testing_multilingual';
/**
* {@inheritdoc}
*/
protected function setUpLanguage() {
// Place custom local translations in the translations directory.
mkdir(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE);
file_put_contents(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.de.po', "msgid \"\"\nmsgstr \"\"\nmsgid \"Save and continue\"\nmsgstr \"Save and continue German\"");
file_put_contents(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.es.po', "msgid \"\"\nmsgstr \"\"\nmsgid \"Save and continue\"\nmsgstr \"Save and continue Spanish\"");
parent::setUpLanguage();
$this->translations['Save and continue'] = 'Save and continue German';
}
/**
* Tests that English is still present.
*/
public function testKeepEnglish() {
$this->assertTrue((bool) \Drupal::languageManager()->getLanguage('en'), 'English is present.');
}
}
......@@ -6,3 +6,4 @@ core: 8.x
hidden: true
dependencies:
- locale
keep_english: true
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment