function LocaleFileManager::deleteTranslationFiles
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.
File
-
core/
modules/ locale/ src/ File/ LocaleFileManager.php, line 95
Class
- LocaleFileManager
- Provide Locale File helper methods.
Namespace
Drupal\locale\FileCode
public function deleteTranslationFiles(array $projects = [], array $langcodes = []) : bool {
$fail = FALSE;
locale_translation_file_history_delete($projects, $langcodes);
// Delete all translation files from the translations directory.
if ($files = $this->getInterfaceTranslationFiles($projects, $langcodes)) {
foreach ($files as $file) {
try {
$this->fileSystem
->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.