Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. locale.module

function locale_system_remove

Delete translation history of modules and themes.

Only the translation history is removed, not the source strings or translations. This is not possible because strings are shared between modules and we have no record of which string is used by which module.

Parameters

array $components: An array of arrays of component (theme and/or module) names to import translations for, indexed by type.

2 calls to locale_system_remove()
LocaleHooks::modulePreuninstall in core/modules/locale/src/Hook/LocaleHooks.php
Implements hook_module_preuninstall().
LocaleHooks::themesUninstalled in core/modules/locale/src/Hook/LocaleHooks.php
Implements hook_themes_uninstalled().

File

core/modules/locale/locale.module, line 269

Code

function locale_system_remove($components) {
    $components += [
        'module' => [],
        'theme' => [],
    ];
    $list = array_merge($components['module'], $components['theme']);
    if (locale_translatable_language_list()) {
        $module_handler = \Drupal::moduleHandler();
        $module_handler->loadInclude('locale', 'inc', 'locale.compare');
        $module_handler->loadInclude('locale', 'inc', 'locale.bulk');
        // 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.
        $projects = array_keys(locale_translation_get_projects());
        if ($list = array_intersect($list, $projects)) {
            locale_translation_file_history_delete($list);
            // Remove translation files.
            locale_translate_delete_translation_files($list, []);
            // Remove translatable projects.
            // Follow-up issue https://www.drupal.org/node/1842362 to replace the
            // {locale_project} table. Then change this to a function call.
            \Drupal::service('locale.project')->deleteMultiple($list);
            // Clear the translation status.
            locale_translation_status_delete_projects($list);
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal