function language_from_user_admin

Identifies admin language from the user preferences.

Parameters

$languages: An array of valid language objects.

Return value

A valid language code on success, FALSE otherwise.

1 string reference to 'language_from_user_admin'

File

drupal/core/modules/language/language.negotiation.inc, line 212
Language negotiation functions.

Code

function language_from_user_admin($languages) {

  // User preference (only for authenticated users).
  global $user;
  if ($user->uid && !empty($user->preferred_admin_langcode) && isset($languages[$user->preferred_admin_langcode]) && path_is_admin(current_path())) {
    return $user->preferred_admin_langcode;
  }

  // No language preference from the user or not on an admin path.
  return FALSE;
}