1 locale.module locale_language_insert($language)

Implements hook_language_insert().

File

core/modules/locale/locale.module, line 437
Add language handling functionality and enables the translation of the user interface to languages other than English.

Code

function locale_language_insert($language) {
  include_once BACKDROP_ROOT . '/core/includes/locale.inc';

  // Add new language to the list of language prefixes.
  $prefixes = locale_language_negotiation_url_prefixes();
  $prefixes[$language->langcode] = (empty($language->default) ? $language->langcode : '');
  locale_language_negotiation_url_prefixes_save($prefixes);

  // Add language to the list of language domains.
  $domains = locale_language_negotiation_url_domains();
  $domains[$language->langcode] = '';
  locale_language_negotiation_url_domains_save($domains);

  // @todo move these two cache clears out. See http://drupal.org/node/1293252
  // Changing the language settings impacts the interface.
  cache('page')->flush();
  // Force JavaScript translation file re-creation for the new language.
  _locale_invalidate_js($language->langcode);
}