function domain_locale_language_load in Domain Locale 7
Same name and namespace in other branches
- 6 domain_locale.module \domain_locale_language_load()
Helper function to retrieve a single language from site's enabled languages list.
Added here since locale module does not expose this kind of functionality.
Parameters
string|object $langcode: The language code as a string, or an object with the 'language' attribute.
Return value
object Provides output similar to language_default() in bootstrap process.
See also
domain_locale_language_default()
1 call to domain_locale_language_load()
- domain_locale_language_default in ./
domain_locale.module - Retrieves default language for currently active domain
File
- ./
domain_locale.module, line 371 - Provides domain specific language settings.
Code
function domain_locale_language_load($langcode) {
if (is_object($langcode)) {
$langcode = $langcode->language;
}
$sql = <<<SQL
SELECT
language, name, native, direction, enabled, plurals, formula, domain,
prefix, javascript, weight
FROM {languages}
WHERE enabled = 1 AND language = :lang
SQL;
$lang = db_query($sql, array(
':lang' => $langcode,
))
->fetchObject();
return $lang;
}