function locale_language_from_user

7.x locale.inc locale_language_from_user($languages)

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'

File

drupal-7.x/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;
}