Issue #2474537 by Noe_, tstoeckler, michaellenahan, cilefen: Installing in a non-English language fails for command-line installations (Drush, ...)

8.0.x
Alex Pott 2015-05-18 06:03:27 +01:00
parent 4d4635c123
commit 99aa2d6748
2 changed files with 21 additions and 3 deletions

View File

@ -1045,7 +1045,7 @@ function drupal_check_module($module) {
function install_profile_info($profile, $langcode = 'en') {
$cache = &drupal_static(__FUNCTION__, array());
if (!isset($cache[$profile])) {
if (!isset($cache[$profile][$langcode])) {
// Set defaults for module info.
$defaults = array(
'dependencies' => array(),
@ -1067,9 +1067,9 @@ function install_profile_info($profile, $langcode = 'en') {
$info['dependencies'] = array_unique(array_merge($required, $info['dependencies'], $locale));
$cache[$profile] = $info;
$cache[$profile][$langcode] = $info;
}
return $cache[$profile];
return $cache[$profile][$langcode];
}
/**

View File

@ -42,4 +42,22 @@ class InstallerLanguageTest extends KernelTestBase {
}
}
/**
* Tests profile info caching in non-English languages.
*/
function testInstallerTranslationCache() {
require_once 'core/includes/install.inc';
// Prime the drupal_get_filename() static cache with the location of the
// testing profile as it is not the currently active profile and we don't
// yet have any cached way to retrieve its location.
// @todo Remove as part of https://www.drupal.org/node/2186491
drupal_get_filename('profile', 'testing', 'core/profiles/testing/testing.info.yml');
$info_en = install_profile_info('testing', 'en');
$info_nl = install_profile_info('testing', 'nl');
$this->assertFalse(in_array('locale', $info_en['dependencies']), 'Locale is not set when installing in English.');
$this->assertTrue(in_array('locale', $info_nl['dependencies']), 'Locale is set when installing in Dutch.');
}
}