1 locale.module locale_language_negotiation_info()

Implements hook_language_negotiation_info().

File

core/modules/locale/locale.module, line 364
Add language handling functionality and enables the translation of the user interface to languages other than English.

Code

function locale_language_negotiation_info() {
  require_once BACKDROP_ROOT . '/core/includes/locale.inc';
  $file = '/core/includes/locale.inc';
  $providers = array();

  $providers[LANGUAGE_NEGOTIATION_URL] = array(
    'types' => array(LANGUAGE_TYPE_CONTENT, LANGUAGE_TYPE_INTERFACE, LANGUAGE_TYPE_URL),
    'callbacks' => array(
      'language' => 'locale_language_from_url',
      'switcher' => 'locale_language_switcher_url',
      'url_rewrite' => 'locale_language_url_rewrite_url',
    ),
    'file' => $file,
    'weight' => -8,
    'name' => t('URL'),
    'description' => t('Determine the language from the URL (Path prefix or domain).'),
    'config' => 'admin/config/regional/language/detection/url',
  );

  $providers[LANGUAGE_NEGOTIATION_SESSION] = array(
    'callbacks' => array(
      'language' => 'locale_language_from_session',
      'switcher' => 'locale_language_switcher_session',
      'url_rewrite' => 'locale_language_url_rewrite_session',
    ),
    'file' => $file,
    'weight' => -6,
    'name' => t('Session'),
    'description' => t('Determine the language from a request/session parameter.'),
    'config' => 'admin/config/regional/language/detection/session',
  );

  $providers[LANGUAGE_NEGOTIATION_USER] = array(
    'callbacks' => array('language' => 'locale_language_from_user'),
    'file' => $file,
    'weight' => -4,
    'name' => t('User'),
    'description' => t("Follow the user's language preference."),
  );

  $providers[LANGUAGE_NEGOTIATION_BROWSER] = array(
    'callbacks' => array('language' => 'locale_language_from_browser'),
    'file' => $file,
    'weight' => -2,
    'cache' => 0,
    'name' => t('Browser'),
    'description' => t("Determine the language from the browser's language settings."),
  );

  $providers[LANGUAGE_NEGOTIATION_INTERFACE] = array(
    'types' => array(LANGUAGE_TYPE_CONTENT),
    'callbacks' => array('language' => 'locale_language_from_interface'),
    'file' => $file,
    'weight' => 8,
    'name' => t('Interface'),
    'description' => t('Use the detected interface language.'),
  );

  $providers[LANGUAGE_NEGOTIATION_URL_FALLBACK] = array(
    'types' => array(LANGUAGE_TYPE_URL),
    'callbacks' => array('language' => 'locale_language_url_fallback'),
    'file' => $file,
    'weight' => 8,
    'name' => t('URL fallback'),
    'description' => t('Use an already detected language for URLs if none is found.'),
  );

  return $providers;
}