You are here

public function AccountInterface::getPreferredLangcode in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Session/AccountInterface.php \Drupal\Core\Session\AccountInterface::getPreferredLangcode()

Returns the preferred language code of the account.

Parameters

bool $fallback_to_default: (optional) Whether the return value will fall back to the site default language if the user has no language preference.

Return value

string The language code that is preferred by the account. If the preferred language is not set or is a language not configured anymore on the site, the site default is returned or an empty string is returned (if $fallback_to_default is FALSE).

3 methods override AccountInterface::getPreferredLangcode()
AccountProxy::getPreferredLangcode in core/lib/Drupal/Core/Session/AccountProxy.php
Returns the preferred language code of the account.
User::getPreferredLangcode in core/modules/user/src/Entity/User.php
Returns the preferred language code of the account.
UserSession::getPreferredLangcode in core/lib/Drupal/Core/Session/UserSession.php
Returns the preferred language code of the account.

File

core/lib/Drupal/Core/Session/AccountInterface.php, line 89
Contains \Drupal\Core\Session\AccountInterface.

Class

AccountInterface
Defines an account interface which represents the current user.

Namespace

Drupal\Core\Session

Code

public function getPreferredLangcode($fallback_to_default = TRUE);