1 locale.install locale_install()

Implements hook_install().

Enable URL language negotiation by default in order to have a basic working system on multilingual sites without needing any preliminary configuration.

File

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

Code

function locale_install() {
  require_once BACKDROP_ROOT . '/core/includes/language.inc';

  // Enable URL language detection for each configurable language type.
  $language_config = config('language.settings');
  foreach (language_types_get_configurable() as $type) {
    $negotiation = $language_config->get("language_negotiation.$type");
    if (empty($negotiation)) {
      $negotiation = array(LANGUAGE_NEGOTIATION_URL, LANGUAGE_NEGOTIATION_DEFAULT);
    }
    else {
      array_unshift($negotiation, LANGUAGE_NEGOTIATION_URL);
    }
    $language_config->set("language_negotiation.$type", $negotiation);
  }
  $language_config->save();
}