function locale_translate_delete_translation_files
Same name in other branches
- 9 core/modules/locale/locale.bulk.inc \locale_translate_delete_translation_files()
- 8.9.x core/modules/locale/locale.bulk.inc \locale_translate_delete_translation_files()
- 10 core/modules/locale/locale.bulk.inc \locale_translate_delete_translation_files()
Deletes interface translation files and translation history records.
Parameters
array $projects: (optional) Project names from which to delete the translation files and history. Defaults to all projects.
array $langcodes: (optional) Language codes from which to delete the translation files and history. Defaults to all languages.
Return value
bool TRUE if files are removed successfully. FALSE if one or more files could not be deleted.
3 calls to locale_translate_delete_translation_files()
- locale_configurable_language_delete in core/
modules/ locale/ locale.module - Implements hook_ENTITY_TYPE_delete() for 'configurable_language'.
- locale_system_remove in core/
modules/ locale/ locale.module - Delete translation history of modules and themes.
- locale_translation_batch_version_check in core/
modules/ locale/ locale.batch.inc - Implements callback_batch_operation().
File
-
core/
modules/ locale/ locale.bulk.inc, line 511
Code
function locale_translate_delete_translation_files(array $projects = [], array $langcodes = []) {
$fail = FALSE;
locale_translation_file_history_delete($projects, $langcodes);
// Delete all translation files from the translations directory.
if ($files = locale_translate_get_interface_translation_files($projects, $langcodes)) {
foreach ($files as $file) {
try {
\Drupal::service('file_system')->delete($file->uri);
} catch (FileException) {
$fail = TRUE;
}
}
}
return !$fail;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.