W3cubDocs

/Drupal 8

function locale_system_remove

locale_system_remove($components)

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.

File

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

Code

function locale_system_remove($components) {
  $components += array('module' => array(), 'theme' => array());
  $list = array_merge($components['module'], $components['theme']);
  if ($language_list = locale_translatable_language_list()) {
    module_load_include('compare.inc', 'locale');
    \Drupal::moduleHandler()->loadInclude('locale', 'bulk.inc');

    // 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, array());

      // 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);
    }

  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!locale!locale.module/function/locale_system_remove/8.1.x