function LocaleHooks::configurableLanguageDelete
Implements hook_ENTITY_TYPE_delete() for 'configurable_language'.
File
-
core/
modules/ locale/ src/ Hook/ LocaleHooks.php, line 140
Class
- LocaleHooks
- Hook implementations for locale.
Namespace
Drupal\locale\HookCode
public function configurableLanguageDelete(ConfigurableLanguageInterface $language) {
// Remove translations.
\Drupal::service('locale.storage')->deleteTranslations([
'language' => $language->id(),
]);
// Remove interface translation files.
\Drupal::moduleHandler()->loadInclude('locale', 'inc', 'locale.bulk');
locale_translate_delete_translation_files([], [
$language->id(),
]);
// Remove translated configuration objects.
\Drupal::service('locale.config_manager')->deleteLanguageTranslations($language->id());
// Changing the language settings impacts the interface:
_locale_invalidate_js($language->id());
\Drupal::cache('render')->deleteAll();
// Clear locale translation caches.
locale_translation_status_delete_languages([
$language->id(),
]);
\Drupal::cache()->delete('locale:' . $language->id());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.