Determines the language to be assigned to URLs when none is detected.
The language negotiation process has a fallback chain that ends with the default language provider. Each built-in language type has a separate initialization:
$languages: (optional) An array of valid language objects. This is passed by language_provider_invoke() to every language provider callback, but it is not actually needed here. Defaults to NULL.
$language_type: (optional) The language type to fall back to. Defaults to the interface language.
A valid language code.
function locale_language_url_fallback($language = NULL, $language_type = LANGUAGE_TYPE_INTERFACE) {
$default = language_default();
$prefix = variable_get('locale_language_negotiation_url_part', LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX) == LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX;
// If the default language is not configured to convey language information,
// a missing URL language information indicates that URL language should be
// the default one, otherwise we fall back to an already detected language.
if ($prefix && empty($default->prefix) || !$prefix && empty($default->domain)) {
return $default->language;
}
else {
return $GLOBALS[$language_type]->language;
}
}