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.
array $components: An array of arrays of component (theme and/or module) names to import translations for, indexed by type.
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');
// Delete configuration translations.
\Drupal\locale\Locale::config()
->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.
$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.
// Followup issue http://drupal.org/node/1842362 to replace the
// {locale_project} table. Then change this to a function call.
db_delete('locale_project')
->condition('name', $list)
->execute();
// Clear the translation status.
locale_translation_status_delete_projects($list);
}
}
}