diff --git a/core/modules/locale/locale.services.yml b/core/modules/locale/locale.services.yml index 0e0dd47..d9a2258 100644 --- a/core/modules/locale/locale.services.yml +++ b/core/modules/locale/locale.services.yml @@ -2,6 +2,7 @@ services: locale.default.config.storage: class: Drupal\locale\LocaleDefaultConfigStorage arguments: ['@config.storage', '@language_manager'] + public: false locale.config_manager: class: Drupal\locale\LocaleConfigManager arguments: ['@config.storage', '@locale.storage', '@config.factory', '@config.typed', '@language_manager', '@locale.default.config.storage'] diff --git a/core/modules/locale/src/LocaleConfigManager.php b/core/modules/locale/src/LocaleConfigManager.php index 2f474f5..d96c758 100644 --- a/core/modules/locale/src/LocaleConfigManager.php +++ b/core/modules/locale/src/LocaleConfigManager.php @@ -109,6 +109,8 @@ class LocaleConfigManager { * The typed configuration manager. * @param \Drupal\language\ConfigurableLanguageManagerInterface $language_manager * The language manager. + * @param \Drupal\locale\LocaleDefaultConfigStorage $default_config_storage + * The locale default configuration storage. */ public function __construct(StorageInterface $config_storage, StringStorageInterface $locale_storage, ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typed_config, ConfigurableLanguageManagerInterface $language_manager, LocaleDefaultConfigStorage $default_config_storage) { $this->configStorage = $config_storage; diff --git a/core/modules/locale/src/LocaleDefaultConfigStorage.php b/core/modules/locale/src/LocaleDefaultConfigStorage.php index d17ce9a..5828f61 100644 --- a/core/modules/locale/src/LocaleDefaultConfigStorage.php +++ b/core/modules/locale/src/LocaleDefaultConfigStorage.php @@ -11,6 +11,19 @@ use Drupal\Core\Config\StorageInterface; use Drupal\language\ConfigurableLanguageManagerInterface; +/** + * Provides access to default configuration for locale integration. + * + * Allows unified access to default configuration from one of three sources: + * - Required default configuration (config/install/*) + * - Optional default configuration (config/optional/*) + * - Predefined languages mocked as default configuration (list defined in + * LocaleConfigManagerInterface::getStandardLanguageList()) + * + * These sources are considered equal in terms of how locale module interacts + * with them for translation. Their translatable source strings are exposed + * for interface translation and participate in remote translation updates. + */ class LocaleDefaultConfigStorage { /** diff --git a/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php b/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php index 3b0700f..f0bf723 100644 --- a/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php +++ b/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php @@ -202,16 +202,16 @@ public function testConfigTranslation() { * Test translatability of optional configuration in locale. */ public function testOptionalConfiguration() { - $this->checkNodeConfig(FALSE, FALSE); + $this->assertNodeConfig(FALSE, FALSE); // Enable the node module. $this->drupalPostForm('admin/modules', array('modules[Core][node][enable]' => "1"), t('Save configuration')); $this->drupalPostForm(NULL, array(), t('Continue')); $this->rebuildContainer(); - $this->checkNodeConfig(TRUE, FALSE); + $this->assertNodeConfig(TRUE, FALSE); // Enable the views module (which node provides some optional config for). $this->drupalPostForm('admin/modules', array('modules[Core][views][enable]' => "1"), t('Save configuration')); $this->rebuildContainer(); - $this->checkNodeConfig(TRUE, TRUE); + $this->assertNodeConfig(TRUE, TRUE); } /** @@ -224,7 +224,7 @@ public function testOptionalConfiguration() { * Whether to assume a sample of the optional default configuration is * present. */ - protected function checkNodeConfig($required, $optional) { + protected function assertNodeConfig($required, $optional) { // Check the required default configuration in node module. $string = $this->storage->findString(array('source' => 'Make content sticky', 'context' => '', 'type' => 'configuration')); if ($required) {