You are here

function locale_initialize in Drupal 4

Same name and namespace in other branches
  1. 5 includes/common.inc \locale_initialize()

Initialize the localization system.

1 call to locale_initialize()
_drupal_bootstrap_full in includes/common.inc

File

includes/common.inc, line 573
Common functions that many Drupal modules will need to reference.

Code

function locale_initialize() {
  global $user;
  if (function_exists('i18n_get_lang')) {
    return i18n_get_lang();
  }
  if (function_exists('locale')) {
    $languages = locale_supported_languages();
    $languages = $languages['name'];
  }
  else {

    // Ensure the locale/language is correctly returned, even without locale.module.
    // Useful for e.g. XML/HTML 'lang' attributes.
    $languages = array(
      'en' => 'English',
    );
  }
  if ($user->uid && isset($languages[$user->language])) {
    return $user->language;
  }
  else {
    return key($languages);
  }
}