function locale_translate_delete_translation_files

locale_translate_delete_translation_files(array $projects = array(), array $langcodes = array())

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/locale.bulk.inc, line 502
Mass import-export and batch import functionality for Gettext .po files.

Code

function locale_translate_delete_translation_files(array $projects = array(), array $langcodes = array()) {
  $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) {
      $success = file_unmanaged_delete($file->uri);
      if (!$success) {
        $fail = TRUE;
      }
    }
  }
  return !$fail;
}

© 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.bulk.inc/function/locale_translate_delete_translation_files/8.1.x