Change record status: 
Project: 
Introduced in branch: 
11.5.x
Introduced in version: 
11.x
Description: 

A new event, Drupal\Core\Config\ConfigLangcodeResolveEvent, resolves the langcode for configuration saved without one. Core subscribes to it and answers with system.site:default_langcode. Configuration entities and installed configuration get this resolved langcode when they have none.

Config::save() adds a langcode when configuration becomes translatable and has none, and removes it when configuration stops being translatable.

Changing system.site:default_langcode now triggers a batch, built by Drupal\language\DefaultLangcodeConfigUpdater, that updates existing configuration whose langcode matches the old default to the new one. Modules can add batch operations through Drupal\language\Event\LanguageDefaultLangcodeChangeEvent</ode>, and can exclude configuration names with <code>hook_language_update_config_langcode_list_alter().

API additions

  • StorableConfigBase::castValue() takes a new $is_translatable parameter.
  • ConfigEntityStorage::__construct(), and the field storage classes that extend it, take a new $event_dispatcher parameter.
  • LocaleConfigSubscriber::updateLocaleStorage() and ::processTranslatableData() take a new $original_config parameter.

Deprecations

  1. Drupal\locale\LocaleConfigManager::updateDefaultConfigLangcodes()
  2. Drupal\locale\LocaleConfigBatch::batchUpdateDefaultConfigLangcodes()
  3. $update_default_config_langcodes parameter from LocaleConfigBatch::buildBatch()

There are no replacements.

Impacts: 
Module developers