function LanguageManager::getLanguageName
Same name in other branches
- 9 core/lib/Drupal/Core/Language/LanguageManager.php \Drupal\Core\Language\LanguageManager::getLanguageName()
- 8.9.x core/lib/Drupal/Core/Language/LanguageManager.php \Drupal\Core\Language\LanguageManager::getLanguageName()
- 10 core/lib/Drupal/Core/Language/LanguageManager.php \Drupal\Core\Language\LanguageManager::getLanguageName()
Overrides LanguageManagerInterface::getLanguageName
File
-
core/
lib/ Drupal/ Core/ Language/ LanguageManager.php, line 163
Class
- LanguageManager
- Class responsible for providing language support on language-unaware sites.
Namespace
Drupal\Core\LanguageCode
public function getLanguageName($langcode) {
if ($langcode == LanguageInterface::LANGCODE_NOT_SPECIFIED) {
return new TranslatableMarkup('None');
}
if ($language = $this->getLanguage($langcode)) {
return $language->getName();
}
if (empty($langcode)) {
return new TranslatableMarkup('Unknown');
}
return new TranslatableMarkup('Unknown (@langcode)', [
'@langcode' => $langcode,
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.