You are here

public function LanguageNegotiationUI::getLangcode in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUI.php \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUI::getLangcode()

Performs language negotiation.

Parameters

\Symfony\Component\HttpFoundation\Request $request: (optional) The current request. Defaults to NULL if it has not been initialized yet.

Return value

string A valid language code or FALSE if the negotiation was unsuccessful.

Overrides LanguageNegotiationMethodInterface::getLangcode

File

core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUI.php, line 34
Contains \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUI.

Class

LanguageNegotiationUI
Identifies the language from the interface text language selected for page.

Namespace

Drupal\language\Plugin\LanguageNegotiation

Code

public function getLangcode(Request $request = NULL) {
  return $this->languageManager ? $this->languageManager
    ->getCurrentLanguage()
    ->getId() : NULL;
}