You are here

function locale_language_from_user in Drupal 7

Identify language from the user preferences.

Parameters

$languages: An array of valid language objects.

Return value

A valid language code on success, FALSE otherwise.

Related topics

1 string reference to 'locale_language_from_user'
locale_language_negotiation_info in modules/locale/locale.module
Implements hook_language_negotiation_info().

File

includes/locale.inc, line 213
Administration functions for locale.module.

Code

function locale_language_from_user($languages) {

  // User preference (only for logged users).
  global $user;
  if ($user->uid) {
    return $user->language;
  }

  // No language preference from the user.
  return FALSE;
}