Gets a list of the available site interface languages. Returns an array
that where each item is a locale in format xx_XX.

@return array
185857
public static function getAvailableInterfaceLanguages()
    {
        $languages = [];
        $fh = Core::make('helper/file');

        if (file_exists(DIR_LANGUAGES)) {
            $contents = $fh->getDirectoryContents(DIR_LANGUAGES);
            foreach ($contents as $con) {
                if (is_dir(DIR_LANGUAGES . '/' . $con) && file_exists(DIR_LANGUAGES . '/' . $con . '/LC_MESSAGES/messages.mo')) {
                    $languages[] = $con;
                }
            }
        }
        if (file_exists(DIR_LANGUAGES_CORE)) {
            $contents = $fh->getDirectoryContents(DIR_LANGUAGES_CORE);
            foreach ($contents as $con) {
                if (is_dir(DIR_LANGUAGES_CORE . '/' . $con) && file_exists(DIR_LANGUAGES_CORE . '/' . $con . '/LC_MESSAGES/messages.mo') && (!in_array($con, $languages))) {
                    $languages[] = $con;
                }
            }
        }

        return $languages;
    }
73838
private function getLanguages($options)
    {
        if (!empty($options['lang'])) {
            return Text::getArrayFromString($options['lang']);
        }

        return $this->siteAccessHelper->getLanguages($options['mandatorId'], $options['siteaccess']);
    }
367217
public function getLanguages()
    {
        // Cache by locale
        $locale = i18n::get_locale();
        if (!empty(static::$cache_languages[$locale])) {
            return static::$cache_languages[$locale];
        }

        // Localise all languages
        $languages = $this->config()->get('languages');
        $localised = [];
        foreach ($languages as $code => $default) {
            $localised[$code] = $this->languageName($code);
        }

        // Save cache
        static::$cache_languages[$locale] = $localised;
        return $localised;
    }
121506
public static function activeLocales(): array
    {
        $locales = app(ModuleService::class)
            ->findByInterface(ModuleLanguageInterface::class, false, true)
            ->map(static function (ModuleLanguageInterface $module): LocaleInterface {
                return $module->locale();
            });

        if ($locales->isEmpty()) {
            return [new LocaleEnUs()];
        }

        return $locales->all();
    }
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);
    }
1050063
public function getAvailableLocales()
    {
        $availableLocales = [];
        $translations = $this->getTranslations();
        foreach ($translations as $translation) {
            $availableLocales[] = $translation->getLocale();
        }

        return $availableLocales;
    }
1258637
public function languages()
    {
        $currentLocale = $this->translator()->getLocale();
        $languages = [];
        foreach ($this->translator()->locales() as $locale => $localeStruct) {
            /**
             * @see \Charcoal\Admin\Widget\FormSidebarWidget::languages()
             * @see \Charcoal\Property\LangProperty::localeChoices()
             */
            if (isset($localeStruct['name'])) {
                $label = $this->translator()->translation($localeStruct['name']);
            } else {
                $trans = 'locale.'.$locale;
                if ($trans === $this->translator()->translate($trans)) {
                    $label = strtoupper($locale);
                } else {
                    $label = $this->translator()->translation($trans);
                }
            }

            $languages[] = [
                'ident'   => $locale,
                'name'    => $this->translator()->translation($label),
                'current' => ($locale === $currentLocale)
            ];
        }

        return $languages;
    }
645798
protected function _getPossibleLocales() {
        $bootstrap = $this->getBootstrap();
        $bootstrap->bootstrap('FrontController');
        $frontController = $bootstrap->getContainer()->frontcontroller;
        $locales = $frontController->getParam('locales');
        return $locales;
    }
282750
protected function getLangFiles()
    {
        if (static::$cache_lang_files) {
            return static::$cache_lang_files;
        }

        $locales = [];
        foreach ($this->getLangDirs() as $langPath) {
            $langFiles = scandir($langPath);
            foreach ($langFiles as $langFile) {
                $locale = pathinfo($langFile, PATHINFO_FILENAME);
                $ext = pathinfo($langFile, PATHINFO_EXTENSION);
                if ($locale && $ext === 'yml') {
                    $locales[$locale] = $locale;
                }
            }
        }
        ksort($locales);
        static::$cache_lang_files = $locales;
        return $locales;
    }
444864
public function toArray()
	{
		$list = parent::toArray();

		$list['locale.site.siteid'] = $this->getSiteId();
		$list['locale.site.code'] = $this->getCode();
		$list['locale.site.label'] = $this->getLabel();
		$list['locale.site.config'] = $this->getConfig();
		$list['locale.site.status'] = $this->getStatus();

		return $list;
	}
188840
public function getAvailableLanguages()
    {
        if (!empty($this->owner->{$this->translationsAttribute})) {
            return array_keys($this->owner->{$this->translationsAttribute});
        }
        return null;
    }
556887
public static function getLocales()
    {
        $localeDir     = __DIR__.'/../locales';
        $languageFiles = scandir($localeDir);
        $locales       = [];
        foreach ($languageFiles as $languageFile) {
            if (in_array($languageFile, ['.', '..'])) {
                continue;
            }
            $extensionPos = strpos($languageFile, '.yml');
            if ($extensionPos !== false) {
                $locale    = substr($languageFile, 0, $extensionPos);
                $locales[] = $locale;
            }
        }
        sort($locales);
        return $locales;
    }
1047560
public function getLanguages()
    {
        $url = $this->getGetLanguagesUrl();
        $response = $this->sendRequest(
            'GET',
            $url,
            [
                'version' => $this->serviceProtocolVersion
            ]
        );
        if ($response->getStatusCode() === 200) {
            $languages = $this->parseGetLanguagesResponse($response);
            return $languages;
        }
        return false;
    }
732496
public function get_remote_list_of_languages() {
        $source = 'https://download.moodle.org/langpack/' . $this->version . '/languages.md5';
        $availablelangs = array();

        if ($content = download_file_content($source)) {
            $alllines = explode("\n", $content);
            foreach($alllines as $line) {
                if (!empty($line)){
                    $availablelangs[] = explode(',', $line);
                }
            }
            return $availablelangs;

        } else {
            return false;
        }
    }
39188
public function getServerLocales() {
        if(!isset($this->serverLocales)) {
            $this->serverLocales = new LocaleCollection();
            foreach($this->supportedLocaleStrings as $server) {
                try {
                    $locale = new Locale($server);
                    $this->serverLocales->addLocale( $locale );
                } catch(\Exception $e) {
                    trigger_error($e->getMessage(), E_USER_NOTICE);
                }
            }
        }
        return $this->serverLocales->getLocales();
    }
849587
private List<CmsSelectWidgetOption> getLanguages() {

        List<CmsSelectWidgetOption> locales = new ArrayList<CmsSelectWidgetOption>();

        Locale defLocale = null;
        if ((m_user != null) && CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_user.getName())) {
            defLocale = new CmsUserSettings(m_user).getLocale();
        }
        if (defLocale == null) {
            defLocale = getCms().getRequestContext().getLocale();
        }

        Iterator<Locale> itLocales = OpenCms.getLocaleManager().getAvailableLocales().iterator();
        while (itLocales.hasNext()) {
            Locale locale = itLocales.next();
            boolean selected = locale.equals(defLocale);
            locales.add(
                new CmsSelectWidgetOption(locale.toString(), selected, locale.getDisplayName(getLocale()), null));
        }
        return locales;
    }
694937
public function getUsedLocales()
    {
        $queryBuilder = $this->createQueryBuilder('blog')
            ->select('DISTINCT(b_translation.locale) AS locale')
            ->join('blog.translations', 'b_translation');

        $locales = [];
        foreach ($queryBuilder->getQuery()->getResult() as $locale) {
            $locales[] = $locale['locale'];
        }

        return $locales;
    }