You are here

public function LanguageManager::getLanguage in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Language/LanguageManager.php \Drupal\Core\Language\LanguageManager::getLanguage()

Returns a language object from the given language code.

Parameters

string $langcode: The language code.

Return value

\Drupal\core\Language\LanguageInterface|null A fully-populated language object or NULL.

Overrides LanguageManagerInterface::getLanguage

2 calls to LanguageManager::getLanguage()
LanguageManager::getLanguageName in core/lib/Drupal/Core/Language/LanguageManager.php
Produced the printed name for a language for display.
LanguageManager::isLanguageLocked in core/lib/Drupal/Core/Language/LanguageManager.php
Checks whether a language is locked.

File

core/lib/Drupal/Core/Language/LanguageManager.php, line 155
Contains \Drupal\Core\Language\LanguageManager.

Class

LanguageManager
Class responsible for providing language support on language-unaware sites.

Namespace

Drupal\Core\Language

Code

public function getLanguage($langcode) {
  $languages = $this
    ->getLanguages(LanguageInterface::STATE_ALL);
  return isset($languages[$langcode]) ? $languages[$langcode] : NULL;
}