Get all available languages for the current (or given) domain.

This will also return additional languages set via addAvailableLang().

@return array Language names keyed by language code
333439
public function getAvailableLangs( $domain = null ) {
		$domainInfo = $this->getDomainInfo( $domain ?? $this->getDomain() );
		if ( !$domainInfo ) {
			$languages = [];
		} else {
			if ( isset( $domainInfo['langs'] ) ) {
				$languages = $domainInfo['langs'];
			} else {
				$files = @scandir( $domainInfo['dir'], SCANDIR_SORT_NONE ) ?: [];

				$languages = [];
				foreach ( $files as $filename ) {
					$langCode = basename( $filename, '.json' );
					$langName = $this->getLangName( $langCode );
					if ( $langName !== '' ) {
						$languages[$langCode] = $langName;
					}
				}
				$this->addDomainInfo( $domain, [ 'langs' => $languages ] );
			}
		}

		$languages = array_merge( $languages, $this->availableLanguages );
		ksort( $languages );
		return $languages;
	}
1356338
public function getAllEnabled()
    {
        $aEnabled = $this->oCi->config->item('languages_enabled');
        $aOut     = [];

        foreach ($aEnabled as $sCode) {
            $aOut[] = $this->getByCode($sCode);
        }

        return array_filter($aOut);
    }
140908
protected function getContentLanguageCodes()
    {
        return array_map(
            function($language) {
                return $language->languageCode;
            },
            array_filter(
                $this->repository->getContentLanguageService()->loadLanguages(),
                function ($language) {
                    return $language->enabled;
                }
            )
        );
    }
1338537
public function list_languages()
    {
        static $sa_languages = array();

        if (!count($sa_languages)) {
            @include(RCUBE_LOCALIZATION_DIR . 'index.inc');

            if ($dh = @opendir(RCUBE_LOCALIZATION_DIR)) {
                while (($name = readdir($dh)) !== false) {
                    if ($name[0] == '.' || !is_dir(RCUBE_LOCALIZATION_DIR . $name)) {
                        continue;
                    }

                    if ($label = $rcube_languages[$name]) {
                        $sa_languages[$name] = $label;
                    }
                }
                closedir($dh);
            }
        }

        return $sa_languages;
    }
290169
public function getAvailableLocales() {

		foreach($this->locales as $id => $l) {
			if(!$l) {
				$this->locales[$id] = new Locale($id);
			}
		}

		return $this->locales;
	}
552689
public function getDomainNames()
    {
        return $this->getCache('domainNames', function () {
            $list = array_merge($this->aliases, $this->pointers, [$this->getDomainName()]);
            sort($list);
            return $list;
        });
    }
102030
public function getSiteLanguages()
    {
        if (empty($this->currentSiteLanguages)) {
            $this->currentSiteLanguages = $this->getSite()['languages'];
        }

        return $this->currentSiteLanguages;
    }
1029376
public function getLangNames() {
		// Lazy-load and cache
		if ( $this->langNames === null ) {
			$path = $this->localBaseDir . '/language/mw-classes/Names.php';
			// @codeCoverageIgnoreStart
			if ( !is_readable( $path ) ) {
				$this->errTrigger( 'Names.php is missing', __METHOD__, E_NOTICE );
				$this->langNames = [];
				return [];
			}
			// @codeCoverageIgnoreEnd

			// Load it
			require_once $path;
			$this->langNames = \MediaWiki\Languages\Data\Names::$names;
		}

		return $this->langNames;
	}
8079
def _get_languages(cls) -> set:
        """"""
        if not cls._server_is_alive():
            cls._start_server_on_free_port()
        url = urllib.parse.urljoin(cls._url, 'Languages')
        languages = set()
        for e in cls._get_root(url, num_tries=1):
            languages.add(e.get('abbr'))
            languages.add(e.get('abbrWithVariant'))
        return languages
630682
public function getLanguages()
    {
        if ($this->_languages === null) {
            $this->_languages = (new DbQuery())->select(['short_code', 'id'])->indexBy('short_code')->from('admin_lang')->all();
        }

        return $this->_languages;
    }
964863
public function getLabels()
    {
        $languages = array_keys(Helpers::getLanguageItems($this->fields));

        if (count($languages) > 0) {
            return $this->getTranslatedLabels($languages);
        }

        return $this->getPlainLabels();
    }
556648
private function getMatchesFromAcceptedLanguages()
    {
        $matches = [];

        $acceptLanguages = $this->request->header('Accept-Language');

        if ( ! empty($acceptLanguages)) {
            $acceptLanguages = explode(',', $acceptLanguages);

            $genericMatches = $this->retrieveGenericMatches($acceptLanguages, $matches);

            $matches = array_merge($genericMatches, $matches);
            arsort($matches, SORT_NUMERIC);
        }

        return $matches;
    }
1048486
public function getLanguages()
    {
        if ($this->_languages === null) {
            $this->_languages = Lang::getQuery();
        }
    
        return $this->_languages;
    }
1192184
public function getAvailable(): array
    {
        $result = [];

        $dbLanguages = $this->find('list', ['keyField' => 'code', 'valueField' => 'name'])
                            ->where(['trashed IS' => null])
                            ->toArray();
        $supportedLanguages = $this->getSupported();
        $result = array_diff_assoc($supportedLanguages, $dbLanguages);

        return $result;
    }
168360
public function getLanguages()
    {
        if (!isset($this->languages))
        {
            $this->_languages = array();

            if($this->_headers->has('Accept-Language'))
            {
                $accept    = $this->_headers->get('Accept-Language');
                $languages = $this->__parseAccept($accept);

                foreach (array_keys($languages) as $lang)
                {
                    if (strstr($lang, '-'))
                    {
                        $codes = explode('-', $lang);
                        if ($codes[0] == 'i')
                        {
                            // Language not listed in ISO 639 that are not variants
                            // of any listed language, which can be registered with the
                            // i-prefix, such as i-cherokee
                            if (count($codes) > 1) {
                                $lang = $codes[1];
                            }
                        }
                        else
                        {
                            for ($i = 0, $max = count($codes); $i < $max; $i++)
                            {
                                if ($i == 0) {
                                    $lang = strtolower($codes[0]);
                                } else {
                                    $lang .= '_'.strtoupper($codes[$i]);
                                }
                            }
                        }
                    }

                    $this->_languages[] = $lang;
                }
            }
        }

        return $this->_languages;
    }
1193857
public function availableLanguages()
    {
        $languages = array();
        $languageObjects = $this->languages();

        foreach ( $languageObjects as $languageObject )
        {
            $languages[] = $languageObject->attribute( 'locale' );
        }

        return $languages;
    }
1060953
private function getContaoLanguages(): array
    {
        $languages = [];
        foreach ($this->connection->createQueryBuilder()
                     ->select('language', 'id', 'fallback')
                     ->from('tl_page')
                     ->where('type=:type')
                     ->setParameter('type', 'root')
                     ->orderBy('fallback')
                     ->addOrderBy('sorting')
                     ->execute()->fetchAll(\PDO::FETCH_ASSOC) as $root) {
            $language = $root['language'];

            $languages[] = $language;
        }

        return $languages;
    }