1 language.module language_delete($langcode)

Delete a language.

Parameters

$langcode: Language code of the language to be deleted.

Return value

TRUE if language is successfully deleted. Otherwise FALSE.:

File

core/modules/language/language.module, line 195
Add language handling functionality to Backdrop.

Code

function language_delete($langcode) {
  $languages = language_list();
  if (isset($languages[$langcode])) {
    $language = $languages[$langcode];

    module_invoke_all('language_delete', $language);

    // Remove the language.
    $config = config('language.settings');
    $config->clear('languages.' . $language->langcode);
    $config->save();

    if ($language->enabled) {
      $core_config = config('system.core');
      $core_config->set('language_count', $core_config->get('language_count', 1) - 1);
      $core_config->save();
    }

    backdrop_static_reset('language_list');

    $t_args = array('%language' => $language->name, '%langcode' => $language->langcode);
    watchdog('language', 'The %language (%langcode) language has been removed.', $t_args);
    return TRUE;
  }
  return FALSE;
}