1 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

File

core/includes/locale.inc, line 212
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;
}