Returns all language codes the transifex project is available for

@return array
@throws AuthenticationFailedException
@throws Exception
482626
public function getAvailableLanguageCodes()
    {
        $cache = Cache::getTransientCache();
        $cacheId = 'transifex_languagescodes_' . $this->projectSlug;
        $languageCodes = $cache->fetch($cacheId);

        if (empty($languageCodes)) {
            $apiData = $this->getApiResults('project/' . $this->projectSlug . '/languages');
            foreach ($apiData as $languageData) {
                $languageCodes[] = $languageData->language_code;
            }
            $cache->save($cacheId, $languageCodes);
        }
        return $languageCodes;
    }
1041628
public function get_list_of_translations($returnall = false) {
        global $CFG;

        $languages = array();

        $cachekey = 'list_'.$this->get_key_suffix();
        $cachedlist = $this->menucache->get($cachekey);
        if ($cachedlist !== false) {
            // The cache content is invalid.
            if ($returnall or empty($this->translist)) {
                return $cachedlist;
            }
            // Return only enabled translations.
            foreach ($cachedlist as $langcode => $langname) {
                if (array_key_exists($langcode, $this->translist)) {
                    $languages[$langcode] = !empty($this->transaliases[$langcode]) ? $this->transaliases[$langcode] : $langname;
                }
            }
            return $languages;
        }

        // Get all languages available in system.
        $langdirs = get_list_of_plugins('', 'en', $this->otherroot);
        $langdirs["$CFG->dirroot/lang/en"] = 'en';

        // We use left to right mark to demark the shortcodes contained in LTR brackets, but we need to do
        // this hacky thing to have the utf8 char until we go php7 minimum and can simply put \u200E in
        // a double quoted string.
        $lrm = json_decode('"\u200E"');

        // Loop through all langs and get info.
        foreach ($langdirs as $lang) {
            if (strrpos($lang, '_local') !== false) {
                // Just a local tweak of some other lang pack.
                continue;
            }
            if (strrpos($lang, '_utf8') !== false) {
                // Legacy 1.x lang pack.
                continue;
            }
            if ($lang !== clean_param($lang, PARAM_SAFEDIR)) {
                // Invalid lang pack name!
                continue;
            }
            $string = $this->load_component_strings('langconfig', $lang);
            if (!empty($string['thislanguage'])) {
                $languages[$lang] = $string['thislanguage'].' '.$lrm.'('. $lang .')'.$lrm;
            }
        }

        core_collator::asort($languages);

        // Cache the list so that it can be used next time.
        $this->menucache->set($cachekey, $languages);

        if ($returnall or empty($this->translist)) {
            return $languages;
        }

        $cachedlist = $languages;

        // Return only enabled translations.
        $languages = array();
        foreach ($cachedlist as $langcode => $langname) {
            if (isset($this->translist[$langcode])) {
                $languages[$langcode] = !empty($this->transaliases[$langcode]) ? $this->transaliases[$langcode] : $langname;
            }
        }

        return $languages;
    }
1067868
public static function getLanguages() {
    if(null === self::$languages) {
      // The pattern to match languages.
      $pattern = '/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i';

      // Get a list of languages.
      $languages = explode(',', @trim($_SERVER['HTTP_USER_AGENT']));

      // Any matches?
      $matches = array();
      if(preg_match($pattern, $languages, $matches) && 0 < count($matches[1])) {
        self::$languages = array_combine($matches[1], $matches[4]);
      } else {
        self::$languages = [];
      }
    }
    return self::$languages;
  }
97819
protected function getCredentials()
    {
        if (empty($this->username) || empty($this->password)) {
            throw new \Exception('Basic authentication requires a $username & $password property.');
        }

        return [$this->username, $this->password];
    }
841203
protected function get_messages()
    {
        $lang_file = __DIR__.DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$this->lang.'.php';
        $messages = require $lang_file;

        if ($validation_methods_errors = self::$validation_methods_errors) {
            $messages = array_merge($messages, $validation_methods_errors);
        }
        return $messages;
    }
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;
    }
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;
    }
66832
public function getAvailableInLangs()
    {
        $languages = \OxidEsales\Eshop\Core\Registry::getLang()->getLanguageNames();

        $objFields = $this->_getTableFields(
            getViewName($this->_sCoreTable, -1, -1),
            true
        );
        $multiLangFields = [];

        //selecting all object multilang fields
        foreach ($objFields as $key => $value) {
            //skipping oxactive field
            if (preg_match('/^oxactive(_(\d{1,2}))?$/', $key)) {
                continue;
            }

            $fieldLang = $this->_getFieldLang($key);

            //checking, if field is multilanguage
            if ($this->isMultilingualField($key) || $fieldLang > 0) {
                $newKey = preg_replace('/_(\d{1,2})$/', '', $key);
                $multiLangFields[$newKey][] = (int) $fieldLang;
            }
        }

        // if no multilanguage fields, return default languages array
        if (count($multiLangFields) < 1) {
            return $languages;
        }

        // select from non-multilanguage core view (all ml tables joined to one)
        $db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
        $query = "select * from " . getViewName($this->_sCoreTable, -1, -1) . " where oxid = " . $db->quote($this->getId());
        $rs = $db->getAll($query);

        $notInLang = $languages;

        // checks if object field data is not empty in all available languages
        // and formats not available in languages array
        if (isset($rs[0]) && is_array($rs[0]) && count($rs[0])) {
            foreach ($multiLangFields as $fieldId => $multiLangIds) {
                foreach ($multiLangIds as $multiLangId) {
                    $fieldName = ($multiLangId == 0) ? $fieldId : $fieldId . '_' . $multiLangId;
                    if ($rs[0][strtoupper($fieldName)]) {
                        unset($notInLang[$multiLangId]);
                        continue;
                    }
                }
            }
        }

        return array_diff($languages, $notInLang);
    }
536624
public function getAcceptableLanguages()
    {
        if ($this->_languages === null) {
            if ($this->hasHeader('Accept-Language')) {
                $this->_languages = array_keys($this->parseAcceptHeader($this->getHeaderLine('Accept-Language')));
            } else {
                $this->_languages = [];
            }
        }

        return $this->_languages;
    }
308087
public function getAllEnabledFlat()
    {
        $aOut       = [];
        $aLanguages = $this->getAllEnabled();

        foreach ($aLanguages as $oLanguage) {
            $aOut[$oLanguage->code] = $oLanguage->label;
        }

        return $aOut;
    }
623032
public static function getAll()
    {
        $result = [];
        foreach (\array_keys(CldrData::getLanguageNames()) as $cldrLanguageId) {
            $result[] = new Language(CldrData::getLanguageInfo($cldrLanguageId));
        }

        return $result;
    }
666997
public function getSupportedLanguages(): array
    {
        if (null === $this->supportedLanguages) {
            $process = $this->createProcess('-D');
            $process->run();
            if (!$process->isSuccessful()) {
                throw new ExternalProgramFailedException(
                    $process->getCommandLine(),
                    $process->getErrorOutput(),
                    $process->getExitCode()
                );
            }

            $languages = [];

            $output = explode(PHP_EOL, $process->getErrorOutput());
            $is_win = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
            foreach ($output as $line) {
                $line = trim($line);
                if ('' === $line // Skip empty lines
                    || substr($line, -1) === ':' // Skip headers
                    || strpos($line, $is_win ? ';' : ':') !== false // Skip search path
                ) {
                    continue;
                }
                $name = basename($line);
                if (strpos($name, 'hyph_') === 0) {
                    // Skip MySpell hyphen files
                    continue;
                }
                $name = preg_replace('/\.(aff|dic)$/', '', $name);
                $languages[$name] = true;
            }

            $languages = array_keys($languages);
            sort($languages);
            $this->supportedLanguages = $languages;
        }

        return $this->supportedLanguages;
    }
1161034
public function listLanguages(): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/languages', $this->getOwner(),
            $this->getRepo()));
    }
215025
public function getLanguage()
    {
        if (!$this->language) {
            $langs = $this->getBrowserLanguage();
            // creating output list
            $accepted = array();
            foreach ($langs as $lang) {
                $accepted[] = $this->extractDataOfLanguage($lang);
            }
            // sorting the list by coefficient desc
            krsort($accepted);
            if (isset($accepted[0])) {
                $this->language = $accepted[0]['code'];
            }
        }

        return $this->language;
    }
823347
protected function resolveLanguages()
    {
        if (!$this->get('accept_language')) {
            return [];
        }

        $codes = $this->extractHeaders();

        $languages = array();
        foreach ($codes as $lang) {
            if (strpos($lang, '-') !== false) {
                $codes = explode('-', $lang);
                $lang = strtolower($codes[0]);
            }

            if (in_array($lang, $languages)) {
                continue;
            }

            $languages[] = $lang;
        }

        return $languages;
    }
619438
protected function getCountries()
    {
        $loadedLanguage = $this->getMetaModel()->getActiveLanguage();
        if (isset($this->countryCache[$loadedLanguage])) {
            return $this->countryCache[$loadedLanguage];
        }

        $languageValues = $this->getCountryNames($loadedLanguage);
        $countries      = $this->getRealCountries();
        $keys           = \array_keys($countries);
        $aux            = [];
        $real           = [];

        // Fetch real language values.
        foreach ($keys as $key) {
            if (isset($languageValues[$key])) {
                $aux[$key]  = Utf8::toAscii($languageValues[$key]);
                $real[$key] = $languageValues[$key];
            }
        }

        // Add needed fallback values.
        $keys = \array_diff($keys, \array_keys($aux));
        if ($keys) {
            $loadedLanguage = $this->getMetaModel()->getFallbackLanguage();
            $fallbackValues = $this->getCountryNames($loadedLanguage);
            foreach ($keys as $key) {
                if (isset($fallbackValues[$key])) {
                    $aux[$key]  = Utf8::toAscii($fallbackValues[$key]);
                    $real[$key] = $fallbackValues[$key];
                }
            }
        }

        $keys = \array_diff($keys, \array_keys($aux));
        if ($keys) {
            foreach ($keys as $key) {
                $aux[$key]  = $countries[$key];
                $real[$key] = $countries[$key];
            }
        }

        \asort($aux);
        $return = [];
        foreach (\array_keys($aux) as $key) {
            $return[$key] = $real[$key];
        }

        $this->restoreLanguage();

        $this->countryCache[$loadedLanguage] = $return;

        return $return;
    }
995708
public function getFallbackLanguages()
    {
        if (empty($this->fallback_languages)) {
            if ($this->enabled()) {
                $fallback_languages = $this->languages;

                if ($this->active) {
                    $active_extension = $this->active;
                    $key = \array_search($active_extension, $fallback_languages, true);
                    unset($fallback_languages[$key]);
                    array_unshift($fallback_languages, $active_extension);
                }
                $this->fallback_languages = $fallback_languages;
            }
            // always add english in case a translation doesn't exist
            $this->fallback_languages[] = 'en';
        }

        return $this->fallback_languages;
    }