1 locale.install locale_uninstall()

Implements hook_uninstall().

File

core/modules/locale/locale.install, line 74
Install, update and uninstall functions for the locale module.

Code

function locale_uninstall() {
  // Delete all JavaScript translation files.
  $locale_js_directory = 'public://' . settings_get('locale_js_directory', 'languages');

  if (is_dir($locale_js_directory)) {
    $locale_javascripts = state_get('locale_translation_javascript', array());
    foreach ($locale_javascripts as $langcode => $file_suffix) {
      if (!empty($file_suffix)) {
        file_unmanaged_delete($locale_js_directory . '/' . $langcode . '_' . $file_suffix . '.js');
      }
    }
    // Delete the JavaScript translations directory if empty.
    if (!file_scan_directory($locale_js_directory, '/.*/')) {
      backdrop_rmdir($locale_js_directory);
    }
  }

  // Clear state values.
  state_del('locale_javascript_parsed');
  state_del('locale_translation_javascript');
}