Gets a list of languages acceptable by the client browser.

@return array Languages ordered in the user browser preferences
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;
    }
453517
public function getAvailableLanguages()
    {
        $languages = [];

        $paths = $this->fileSystem->getDirectories($this->getLanguagesPath());

        foreach ($paths as $path) {
            $languages[] = substr($path, strlen($this->getLanguagesPath()) + 1);
        }

        return $languages;
    }
1098771
public function langs()
    {
        $langs = [];
        $files = $this->getMLFiles();

        foreach( $files as $file )
        {
            $langs[] = $this->removeExtension($file);
        }
    
        return $langs;
    }
1256588
public static function getLangFromRequest()
    {
        if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
            return '';
        }

        $languages = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
        foreach ($languages as $bl) {
            if (preg_match('/^([a-zA-Z]{2,3})(?:[-_]([a-zA-Z]{2,3}))?(;q=[0-9]\\.[0-9])?$/', $bl, $match)) {
                $lang = strtolower($match[1]);

                return $lang;
            }
        }

        return '';
    }
675203
protected function getListLanguage()
    {
        $id = $this->getParam(0);

        if (!isset($id)) {
            $list = $this->language->getList();
            $this->limitArray($list);
            return $list;
        }

        $result = $this->language->get($id);

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        return array($result);
    }
706384
public function getDisplayLocales()
    {
        $locales = array();

        foreach ($this->allowedLocales as $locale) {
            $locales[$locale] = \Locale::getDisplayName($locale);
        }

        return $locales;
    }
635656
public function getBrowserAcceptLanguages(Request $request)
    {
        $browserLanguages = [];

        if (strlen($request->server->get('HTTP_ACCEPT_LANGUAGE')) == 0) {
            return [];
        }

        $languages = $this->splitHttpAcceptHeader(
            $request->server->get('HTTP_ACCEPT_LANGUAGE')
        );
        foreach ($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]);
                        }
                    }
                }
            }

            $browserLanguages[] = $lang;
        }

        return $browserLanguages;
    }
1187204
public function getUsedLanguages() {
		$alllanguages = $this->getAllLanguages();
		
		$usedlanguages = array();
		
		foreach ($alllanguages as $code=>$lang) {
			// check if lang folder and default file exists
			$langfile = $this->localespath.$code.'/default.txt';
			
			if (file_exists($langfile)) {
				$usedlanguages[$code] = $lang;
			}
		}
		
		return $usedlanguages;
	}
859658
public function userLanguages() {
        if (isset($this->serverVariables['HTTP_ACCEPT_LANGUAGE'])) {
            preg_match_all(
                '/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i',
                $this->serverVariables['HTTP_ACCEPT_LANGUAGE'],
                $matches
            );

            if (count($matches[1])) {
                $result = array_combine($matches[1], $matches[4]);

                array_walk($result, function($lang, $amount) {
                    if ($amount === '') {
                        $langs[$lang] = 1;
                    }
                });

                arsort($result, \SORT_NUMERIC);

                return $result;
            }
        }

        return array();
    }
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;
    }
703486
protected function prepareLanguages()
    {
        $options = [];
        foreach ($this->options['languages'] as $language) {
            $options[] = $this->prepareLanguage($language);
        }
        
        return $options;
    }
422069
protected function _getLanguagesList()
    {
        $aLangParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aLanguageParams');
        $aLanguages = \OxidEsales\Eshop\Core\Registry::getLang()->getLanguageArray();
        $sDefaultLang = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sDefaultLang');

        foreach ($aLanguages as $sKey => $sValue) {
            $sOxId = $sValue->oxid;
            $aLanguages[$sKey]->active = (!isset($aLangParams[$sOxId]["active"])) ? 1 : $aLangParams[$sOxId]["active"];
            $aLanguages[$sKey]->default = ($aLangParams[$sOxId]["baseId"] == $sDefaultLang) ? true : false;
            $aLanguages[$sKey]->sort = $aLangParams[$sOxId]["sort"];
        }

        if (is_array($aLangParams)) {
            $aSorting = $this->getListSorting();

            if (is_array($aSorting)) {
                foreach ($aSorting as $aFieldSorting) {
                    foreach ($aFieldSorting as $sField => $sDir) {
                        $this->_sDefSortField = $sField;
                        $this->_sDefSortOrder = $sDir;

                        if ($sField == 'active') {
                            //reverting sort order for field 'active'
                            $this->_sDefSortOrder = 'desc';
                        }
                        break 2;
                    }
                }
            }

            uasort($aLanguages, [$this, '_sortLanguagesCallback']);
        }

        return $aLanguages;
    }
102030
public function getSiteLanguages()
    {
        if (empty($this->currentSiteLanguages)) {
            $this->currentSiteLanguages = $this->getSite()['languages'];
        }

        return $this->currentSiteLanguages;
    }
533898
public function getSupportedLanguages()
    {
        return array(
            self::LANG_SR,
            self::LANG_RU,
            self::LANG_BE,
            self::LANG_MK,
            self::LANG_UK,
            self::LANG_BG,
            self::LANG_EL
        );
    }
918415
public static function optionsActiveLanguages(): array
    {
        $languages = [];
        foreach (I18N::activeLocales() as $locale) {
            $languages[$locale->languageTag()] = $locale->endonym();
        }

        return $languages;
    }
332591
public static function getAvailableLanguages(){
        $languages = array();
        foreach(common_ext_ExtensionsManager::singleton()->getInstalledExtensions() as $extension){
           $localesDir = $extension->getDir() . 'locales/';
           foreach(glob($localesDir . '*') as  $file){
                if(is_dir($file) && file_exists($file . '/messages.po')){
                    $lang = basename($file);
                    if(!in_array($lang, $languages)){
                        $languages[] = $lang;
                    }
                }
           }
        } 
        return $languages;
    }
299628
protected function _getLanguages()
    {
        $aLangData['params'] = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aLanguageParams');
        $aLangData['lang'] = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aLanguages');
        $aLangData['urls'] = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aLanguageURLs');
        $aLangData['sslUrls'] = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aLanguageSSLURLs');

        // empty languages parameters array - creating new one with default values
        if (!is_array($aLangData['params'])) {
            $aLangData['params'] = $this->_assignDefaultLangParams($aLangData['lang']);
        }

        return $aLangData;
    }