1.20.x bootstrap.inc backdrop_language_initialize()

Initializes all the defined language types.

File

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

Code

function backdrop_language_initialize() {

  // 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();
  $default_types = language_types_get_default();
  foreach ($default_types as $type_name => $configurable) {
    $GLOBALS[$type_name] = $default;
  }

  if (language_multilingual()) {
    include_once BACKDROP_ROOT . '/core/includes/language.inc';
    $types = language_types_info();
    foreach ($types as $type_name => $type_info) {
      $GLOBALS[$type_name] = language_types_initialize($type_name);
    }
    // Allow modules to react on language system initialization in multilingual
    // environments.
    bootstrap_invoke_all('language_init');
  }
}