locale_update_7001

Versions
7
locale_update_7001()

Upgrade language negotiation settings.

Related topics

Code

modules/locale/locale.install, line 47

<?php
function locale_update_7001() {
  require_once DRUPAL_ROOT . '/includes/language.inc';

  switch (variable_get('language_negotiation', 0)) {
    // LANGUAGE_NEGOTIATION_NONE.
    case 0:
      $negotiation = array();
      break;

    // LANGUAGE_NEGOTIATION_PATH_DEFAULT.
    case 1:
      $negotiation = array(LOCALE_LANGUAGE_NEGOTIATION_URL);
      break;

    // LANGUAGE_NEGOTIATION_PATH.
    case 2:
      $negotiation = array(LOCALE_LANGUAGE_NEGOTIATION_URL, LOCALE_LANGUAGE_NEGOTIATION_USER, LOCALE_LANGUAGE_NEGOTIATION_BROWSER);
      break;

    // LANGUAGE_NEGOTIATION_DOMAIN.
    case 3:
      variable_set('locale_language_negotiation_url_part', LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN);
      $negotiation = array(LOCALE_LANGUAGE_NEGOTIATION_URL);
      break;
  }

  // Save new language negotiation options: UI language is tied to content
  // language as this was Drupal 6 behavior.
  language_negotiation_set(LANGUAGE_TYPE_CONTENT, array_flip($negotiation));
  language_negotiation_set(LANGUAGE_TYPE_INTERFACE, array(LOCALE_LANGUAGE_NEGOTIATION_CONTENT => 0));
  language_negotiation_set(LANGUAGE_TYPE_URL, array(LOCALE_LANGUAGE_NEGOTIATION_URL => 0));

  // Unset the old language negotiation system variable.
  variable_del('language_negotiation');

  return array();
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.