You are here

function locale_translation_status_delete_languages in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/locale/locale.module \locale_translation_status_delete_languages()
  2. 10 core/modules/locale/locale.module \locale_translation_status_delete_languages()

Delete language entries from the status cache.

Parameters

array $langcodes: Language code(s) to be deleted from the cache.

1 call to locale_translation_status_delete_languages()
locale_configurable_language_delete in core/modules/locale/locale.module
Implements hook_ENTITY_TYPE_delete() for 'configurable_language'.

File

core/modules/locale/locale.module, line 950
Enables the translation of the user interface to languages other than English.

Code

function locale_translation_status_delete_languages($langcodes) {
  if ($status = locale_translation_get_status()) {
    foreach ($status as $project => $languages) {
      foreach ($languages as $langcode => $source) {
        if (in_array($langcode, $langcodes)) {
          unset($status[$project][$langcode]);
        }
      }
      \Drupal::keyValue('locale.translation_status')
        ->set($project, $status[$project]);
    }
  }
}