1.20.x locale.module locale_language_update($language)

Implements hook_language_update().

File

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

Code

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

  // If the language is the default, then ensure that no other languages have
  // blank prefix codes.
  if (!empty($language->default)) {
    $prefixes = locale_language_negotiation_url_prefixes();
    foreach ($prefixes as $langcode => $prefix) {
      if ($prefix == '' && $langcode != $language->langcode) {
        $prefixes[$langcode] = $langcode;
      }
    }
    locale_language_negotiation_url_prefixes_save($prefixes);
  }

  // @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 modified language.
  _locale_invalidate_js($language->langcode);
}