function language_initialize in Drupal 7
Same name and namespace in other branches
- 6 includes/language.inc \language_initialize()
Chooses a language based on language negotiation provider settings.
Parameters
$type: The language type key to find the language for.
Return value
The negotiated language object.
Related topics
2 calls to language_initialize()
- drupal_language_initialize in includes/
bootstrap.inc - Initializes all the defined language types.
- language_negotiation_get_switch_links in includes/
language.inc - Returns the language switch links for the given language.
File
- includes/
language.inc, line 484 - Language Negotiation API.
Code
function language_initialize($type) {
// Execute the language negotiation providers in the order they were set up and return the
// first valid language found.
$negotiation = variable_get("language_negotiation_{$type}", array());
foreach ($negotiation as $provider_id => $provider) {
$language = language_provider_invoke($provider_id, $provider);
if ($language) {
$language->provider = $provider_id;
return $language;
}
}
// If no other language was found use the default one.
$language = language_default();
$language->provider = LANGUAGE_NEGOTIATION_DEFAULT;
return $language;
}