3 namespace Drupal\language\Plugin\LanguageNegotiation;
5 use Drupal\language\LanguageNegotiationMethodBase;
6 use Symfony\Component\HttpFoundation\Request;
9 * Identifies the language from the interface text language selected for page.
11 * @LanguageNegotiation(
12 * id = Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUI::METHOD_ID,
13 * types = {Drupal\Core\Language\LanguageInterface::TYPE_CONTENT},
15 * name = @Translation("Interface"),
16 * description = @Translation("Use the detected interface language.")
19 class LanguageNegotiationUI extends LanguageNegotiationMethodBase {
22 * The language negotiation method id.
24 const METHOD_ID = 'language-interface';
29 public function getLangcode(Request $request = NULL) {
30 return $this->languageManager ? $this->languageManager->getCurrentLanguage()->getId() : NULL;