diff --git a/core/modules/locale/lib/Drupal/locale/Locale.php b/core/modules/locale/lib/Drupal/locale/Locale.php new file mode 100644 index 0000000..46a4e3c --- /dev/null +++ b/core/modules/locale/lib/Drupal/locale/Locale.php @@ -0,0 +1,30 @@ +getStringNames($next)) { + if (!empty($options['refresh_configuration']) && $names = Locale::storage()->getStringNames($next)) { $context['sandbox']['refresh']['names'] = $names; } } @@ -770,7 +770,7 @@ function locale_translate_delete_translation_files($projects = array(), $langcod */ function locale_config_batch_update_components(array $options, $langcodes = array(), $components = array()) { $langcodes = $langcodes ? $langcodes : array_keys(locale_translatable_language_list()); - if ($langcodes && $names = locale_config()->getComponentNames($components)) { + if ($langcodes && $names = Locale::storage()->getComponentNames($components)) { return locale_config_batch_build($names, $langcodes, $options); } } @@ -872,15 +872,15 @@ function locale_config_update_multiple(array $names, $langcodes = array()) { $langcodes = $langcodes ? $langcodes : array_keys(locale_translatable_language_list()); $count = 0; foreach ($names as $name) { - $wrapper = locale_config()->get($name); + $wrapper = Locale::storage()->get($name); foreach ($langcodes as $langcode) { $translation = $wrapper->getValue() ? $wrapper->getTranslation($langcode, TRUE)->getValue() : NULL; if ($translation) { - locale_config()->saveTranslationData($name, $langcode, $translation); + Locale::storage()->saveTranslationData($name, $langcode, $translation); $count++; } else { - locale_config()->deleteTranslationData($name, $langcode); + Locale::storage()->deleteTranslationData($name, $langcode); } } } diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index 429253f..f81bc81 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -320,7 +320,7 @@ function locale_language_delete($language) { locale_translate_delete_translation_files(array(), array($language->langcode)); // Remove translated configuration objects. - locale_config()->deleteLanguageTranslations($language->langcode); + Locale::storage()->deleteLanguageTranslations($language->langcode); // Changing the language settings impacts the interface: _locale_invalidate_js($language->langcode); @@ -564,7 +564,7 @@ function locale_system_remove($components) { module_load_include('compare.inc', 'locale'); Drupal::moduleHandler()->loadInclude('locale', 'inc', 'bulk'); // Delete configuration translations. - locale_config()->deleteComponentTranslations($components, array_keys($language_list)); + Locale::storage()->deleteComponentTranslations($components, array_keys($language_list)); // Only when projects are removed, the translation files and records will be // deleted. Not each disabled module will remove a project. E.g. sub modules. @@ -1088,7 +1088,7 @@ function _locale_refresh_translations($langcodes, $lids = array()) { * List of string identifiers that have been updated / created. */ function _locale_refresh_configuration(array $langcodes, array $lids) { - if ($lids && $langcodes && $names = locale_config()->getStringNames($lids)) { + if ($lids && $langcodes && $names = Locale::storage()->getStringNames($lids)) { Drupal::moduleHandler()->loadInclude('locale', 'inc', 'bulk'); locale_config_update_multiple($names, $langcodes); } @@ -1354,17 +1354,3 @@ function _locale_rebuild_js($langcode = NULL) { return TRUE; } } - -/** - * Returns the locale configuration manager service. - * - * Use the locale config manager service for creating locale-wrapped typed - * configuration objects. - * - * @see \Drupal\Core\TypedData\TypedDataManager::create() - * - * @return \Drupal\locale\LocaleConfigManager - */ -function locale_config() { - return drupal_container()->get('locale.config.typed'); -}