Returns localised list of installed translations
@param bool $returnall return all or just enabled
@return array moodle translation code => localised translation name
175423
public function get_list_of_translations($returnall = false) {
        // Return all is ignored here - we need to know all langs in installer.
        $languages = array();
        // Get raw list of lang directories.
        $langdirs = get_list_of_plugins('install/lang');
        asort($langdirs);
        // Get some info from each lang.
        foreach ($langdirs as $lang) {
            if (file_exists($this->installroot . '/' . $lang . '/langconfig.php')) {
                $string = array();
                include($this->installroot . '/' . $lang . '/langconfig.php');
                if (!empty($string['thislanguage'])) {
                    $languages[$lang] = $string['thislanguage'] . ' (' . $lang . ')';
                }
            }
        }
        // Return array.
        return $languages;
    }
460683
private function getLocallyStoredImages($imageSrcs, bool $returnAll = false): array {
        return ImageUtils::storeImagesToLocalFile($imageSrcs, $returnAll, $this->config());
    }
225607
public function getImplementedLocales($path = '/../Resources/translations/')
    {
        $locales = [];
        $finder = $this->finder->files()->in(__DIR__.$path)->name('/platform\.[^.]*\.json/');

        foreach ($finder as $file) {
            $locale = str_replace(['platform.', '.json'], '', $file->getRelativePathname());
            $locales[$locale] = $locale;
        }

        return $locales;
    }
593996
public static function get_content_languages()
    {
        $table = Versioned::current_stage() == 'Live' ? 'SiteTree_Live' : 'SiteTree';

        if (class_exists('SQLSelect')) {
            $query = new SQLSelect("Distinct \"Locale\"", "\"$table\"");
        } else {
            // SS 3.1 compat
            $query = new SQLQuery("Distinct \"Locale\"", array("\"$table\""));
        }

        $query = $query->setGroupBy('"Locale"');
        $dbLangs = $query->execute()->column();

        $langlist = array_merge((array)Translatable::default_locale(), (array)$dbLangs);
        $returnMap = array();
        $allCodes = array_merge(
            Config::inst()->get('i18n', 'all_locales'),
            Config::inst()->get('i18n', 'common_locales')
        );
        foreach ($langlist as $langCode) {
            if ($langCode && isset($allCodes[$langCode])) {
                if (is_array($allCodes[$langCode])) {
                    $returnMap[$langCode] = $allCodes[$langCode]['name'];
                } else {
                    $returnMap[$langCode] = $allCodes[$langCode];
                }
            }
        }
        return $returnMap;
    }
950553
protected function getActiveLangList()
    {
        if (self::$arActiveLangList !== null || !PluginManager::instance()->hasPlugin('RainLab.Translate')) {
            return self::$arActiveLangList;
        }

        self::$arActiveLangList = \RainLab\Translate\Models\Locale::isEnabled()->lists('code');
        if (empty(self::$arActiveLangList)) {
            return self::$arActiveLangList;
        }

        //Remove default lang from list
        foreach (self::$arActiveLangList as $iKey => $sLangCode) {
            if ($sLangCode == self::$sDefaultLang) {
                unset(self::$arActiveLangList[$iKey]);
                break;
            }
        }

        return self::$arActiveLangList;
    }
692798
function languageNameListFromLocaleList( $localeList )
    {
        $languageList = array();
        foreach( $localeList as $locale )
            $languageList[] = $this->languageNameFromLocale( $locale );

        return $languageList;
    }
801469
public function getTranslations(): array
    {
        // Get english name
        $name = [
            'eng' => [
                'common' => $this->getName(),
                'official' => $this->getOfficialName(),
            ],
        ];

        // Get native names
        $natives = $this->getNativeNames() ?: [];

        // Get other translations
        $file = __DIR__.'/../resources/translations/'.mb_strtolower($this->getIsoAlpha2()).'.json';
        $translations = file_exists($file) ? json_decode(file_get_contents($file), true) : [];

        // Merge all names together
        $result = array_merge($translations, $natives, $name);

        // Sort alphabetically
        ksort($result);

        return $result;
    }
453517
public function getAvailableLanguages()
    {
        $languages = [];

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

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

        return $languages;
    }
150370
public static function getAll():array
    {
        $arr = [];
        if (false === self::isEnabled()) {
            throw new Server500(new \ArrayObject(
                array("explain" => "Cannot get locale from  : Global locale mode is not enabled.",
                    "solution" => "Please enable the locale mode in framework.config.json to use it from your apps")
            ));
        }
        $fileapp = JsonListener::open(FEnv::get("framework.config.core.apps.file"));
        foreach ($fileapp as $one) {
            if (true === JsonListener::exists(FEnv::get("framework.root")."apps/".
                    $one->{"name"}."/config.json")) {
                $file = JsonListener::open(FEnv::get("framework.root")."apps/".
                    $one->{"name"}."/config.json");
                if (true === property_exists($file, "locale_enabled") &&
                     true === $file->locale_enabled &&
                     true === property_exists($file, "trans_type") &&
                     true === property_exists($file, "locale_values") &&
                     true === property_exists($file, "prefer_locale")) {
                    $vals = $file->locale_values;
                    $enabled = $file->locale_enabled;
                    $transtype = $file->trans_type;
                    $preferlocale = $file->prefer_locale;
                    $applocale = new AppLocale();
                    $applocale->setEnabled($enabled);
                    $applocale->setTranstype($transtype);
                    $applocale->setValues((array) $vals);
                    $applocale->setAppname($one->{"name"});
                    $applocale->setPrefer($preferlocale);
                    $arr[$one->{"name"}] = $applocale;
                } else {
                    $arr[$one->{"name"}] = null;
                }
            } else {
                $arr[$one->{"name"}] = null;
            }
        }
        
        return ($arr);
    }
1050063
public function getAvailableLocales()
    {
        $availableLocales = [];
        $translations = $this->getTranslations();
        foreach ($translations as $translation) {
            $availableLocales[] = $translation->getLocale();
        }

        return $availableLocales;
    }
8452
public function getFallbackLocales()
    {
        if ($this->translator instanceof Translator || method_exists($this->translator, 'getFallbackLocales')) {
            return $this->translator->getFallbackLocales();
        }

        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;
    }
1114530
public function getImportersForContext($all = false)
    {
        $importers = [];
        foreach ($this->configuration->getImporters($all) as $key => $importer) {
            if ($importer->supports($this->configuration)) {
                $importers[] = $importer;
            }
        }
        return $importers;
    }
436150
public function getBackendLocales($host = null)
    {
        $host = $this->getRealHost($host);

        if (isset($this->hosts[$host]['locales'])) {
            return array_values($this->hosts[$host]['locales']);
        }

        return parent::getBackendLocales();
    }
1132392
public function getImporters($all = false)
    {
        $importers = [];
        foreach ($this->importers as $importer) {
            if ($importer->isEnabled() || true === $all) {
                $importers[$importer->getKey()] = $importer;
            }
        }
        return $importers;
    }
835718
private function getTranslationsFromFiles()
    {
        /*
         * This pattern is derived from Barryvdh\TranslationManager by Barry vd. Heuvel <barryvdh@gmail.com>
         *
         * https://github.com/barryvdh/laravel-translation-manager/blob/master/src/Manager.php
         */
        $functions = config('langmanGUI.localization_methods', ['__']);

        $pattern =
            // See https://regex101.com/r/jS5fX0/5
            '[^\w]'. // Must not start with any alphanum or _
            '(?<!->)'. // Must not start with ->
            '('.implode('|', $functions).')'.// Must start with one of the functions
            "\(".// Match opening parentheses
            "[\'\"]".// Match " or '
            '('.// Start a new group to match:
            '.+'.// Must start with group
            ')'.// Close group
            "[\'\"]".// Closing quote
            "[\),]"  // Close parentheses or new parameter
        ;

        $allMatches = [];

        foreach ($this->disk->allFiles($this->lookupPaths) as $file) {
            if (preg_match_all("/$pattern/siU", $file->getContents(), $matches)) {
                $allMatches[$file->getRelativePathname()] = $matches[2];
            }
        }

        return $allMatches;
    }
927367
public static function getAllPlugins()
    {
        static $pluginsWithTranslations;

        if (!empty($pluginsWithTranslations)) {
            return $pluginsWithTranslations;
        }

        $pluginsWithTranslations = array();
        foreach (Manager::getPluginsDirectories() as $pluginsDir) {
            $pluginsWithTranslations = array_merge($pluginsWithTranslations, glob(sprintf('%s*/lang/en.json', $pluginsDir)));
        }
        $pluginsWithTranslations = array_map(function ($elem) {
            $replace = Manager::getPluginsDirectories();
            $replace[] = '/lang/en.json';
            return str_replace($replace, '', $elem);
        }, $pluginsWithTranslations);

        return $pluginsWithTranslations;
    }