Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
By Gábor Hojtsy on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.0.x
Introduced in version:
8.0.0
Issue links:
Description:
The locale.typed.config service is renamed to locale.config_manager for consistency with other services in core and within locale module. The signature and name of several methods changed too:
Before | After | Reason |
---|---|---|
LocaleConfigManager::hasTranslation($language) | LocaleConfigManager::hasTranslation($langcode) | We took langcode in every other method. |
locale_config_update_multiple($names, $langcodes) | LocaleConfigManager::updateConfigTranslations($names, $langcodes) | Did things that are the primary responsibility of the locale config manager. |
LocaleConfigManager::deleteComponentTranslations() | --- | Locale is additive, should not respond on component removal. |
LocaleConfigManager::get($name) | LocaleConfigManager::getTranslatableDefaultConfig($name) | Does not return a possibly half-broken typed config anymore. Instead its a nested array of TranslationWrappers. |
public LocaleConfigManager::saveTranslationData($name, $langcode, $data) | protected LocaleConfigManager::saveTranslationOverride($name, $langcode, $data) | Now that both overrides and active config managed here, required a rename to be more specific. |
--- | protected LocaleConfigManager::saveTranslationActive($name, $data) | New method to save translation to active config. |
public LocaleConfigManager::deleteTranslationData($name, $langcode) | protected LocaleConfigManager::deleteTranslationOverride($name, $langcode) | Now that both overrides and active config managed here, required a rename to be more specific. |
LocaleConfigManager::getComponentNames(array $components) | LocaleConfigManager::getComponentNames(array $components = array()) | Was documented to be optional, but the code did not do justice to the docs. |
--- | LocaleConfigManager::reset() | To reset the internal cache used by translateString(). Needed now that we use it for more things. |
--- | LocaleConfigManager::getStringTranslation($name, $langcode, $source, $context) | Takes on responsibility that LocaleConfigSubscriber had duplicate code for (which is now removed). |
--- | LocaleConfigManager::getDefaultConfigLangcode($name) | Utility method to look up default language code of shipped config. |
--- | LocaleConfigManager::getActiveConfigLangcode($name) | Utility method to look up active language code of current config. |
--- | LocaleConfigManager::isSupported($name) | Utility method to verify if this configuration is supported in the locale integration at all. Used both here and in LocaleConfigSubscriber to avoid duplicating logic. |
LocaleConfigManager::isUpdatingConfigTranslation() | LocaleConfigManager::isUpdatingConfigTranslationFromLocale() | Renamed to make the responsibility clear. The prior code indicated this may not have been understood well. |
Impacts:
Module developers