Community Documentation

drupal_language_initialize

7 bootstrap.inc drupal_language_initialize()
8 bootstrap.inc drupal_language_initialize()

Initializes all the defined language types.

▾ 5 functions call drupal_language_initialize()

drupal_bootstrap in includes/bootstrap.inc
Ensures Drupal is bootstrapped to the specified phase.
install_begin_request in includes/install.core.inc
Begin an installation request, modifying the installation state as needed.
LocaleUninstallFunctionalTest::testUninstallProcess in modules/locale/locale.test
Check if the values of the Locale variables are correct after uninstall.
locale_uninstall in modules/locale/locale.install
Implements hook_uninstall().
PathMonolingualTestCase::setUp in modules/path/path.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…

File

includes/bootstrap.inc, line 2540
Functions that need to be loaded on every Drupal request.

Code

<?php
function drupal_language_initialize() {
  $types = language_types();

  // Ensure the language is correctly returned, even without multilanguage
  // support. Also make sure we have a $language fallback, in case a language
  // negotiation callback needs to do a full bootstrap.
  // Useful for eg. XML/HTML 'lang' attributes.
  $default = language_default();
  foreach ($types as $type) {
    $GLOBALS[$type] = $default;
  }
  if (drupal_multilingual()) {
    include_once DRUPAL_ROOT . '/includes/language.inc';
    foreach ($types as $type) {
      $GLOBALS[$type] = language_initialize($type);
    }
    // Allow modules to react on language system initialization in multilingual
    // environments.
    bootstrap_invoke_all('language_init');
  }
}
?>
Login or register to post comments