Selected foreign language is not the site default language when the site template recipe is applied
1. Run the CMS 2 installer.
2. Pick German (shown as Deutsch) on the first install step where you set the site.
3. Add this instrumentation to core to check whether German is actually the site default language when recipes are applied.
4. It is not.
This change in `RecipeRunner::installModule()`
```php
\Drupal::service('module_installer')->install([$module]);
\Drupal::service('config.installer')->setSyncing(FALSE);
+ $default_langcode = \Drupal::languageManager()->getDefaultLanguage()->getId();
+ \Drupal::logger('recipe')->notice(
+ 'Recipe installed module %module while the site default language was %langcode.',
+ [
+ '%module' => $module,
+ '%langcode' => $default_langcode,
+ ]
+ );
$context['message'] = t('Installed %module module.', ['%module' => \Drupal::service('extension.list.module')->getName($module)]);
$context['results']['module'][] = $module;
```
And this change in `RecipeConfigInstaller::installRecipeConfig()`
```php
// Sort $config_to_create in the order of the least dependent first.
$dependency_manager = new ConfigDependencyManager();
$dependency_manager->setData($config_to_create);
$config_to_create = array_merge(array_flip($dependency_manager->sortAll()), $config_to_create);
// Create the optional configuration if there is any left after filtering.
if (!empty($config_to_create)) {
+ $default_langcode = \Drupal::languageManager()->getDefaultLanguage()->getId();
+ foreach (array_keys($config_to_create) as $config_name) {
+ \Drupal::logger('recipe')->notice(
+ 'Recipe imported config %config_name while the site default language was %langcode.',
+ [
+ '%config_name' => $config_name,
+ '%langcode' => $default_langcode,
+ ]
+ );
+ }
$this->createConfiguration(StorageInterface::DEFAULT_COLLECTION, $config_to_create);
}
```
These are not suggested core changes, hence the inline diff style. I used them to instrument recipe application. When installing Drupal CMS Haven in German, it logged all of these log messages up until the last one as **site default language English**.
issue