function LocaleLanguages::getTranslatableLanguages

Same name and namespace in other branches
  1. 11.x core/modules/locale/src/LocaleLanguages.php \Drupal\locale\LocaleLanguages::getTranslatableLanguages()

Returns list of translatable languages.

Return value

array Array of installed languages keyed by language name. English is omitted unless it is marked as translatable.

File

core/modules/locale/src/LocaleLanguages.php, line 25

Class

LocaleLanguages
Manages which languages are translatable and checks a specific language.

Namespace

Drupal\locale

Code

public function getTranslatableLanguages() : array {
  $languages = $this->languageManager
    ->getLanguages();
  if (!$this->isTranslatable('en')) {
    unset($languages['en']);
  }
  return $languages;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.