Builds a list of the system languages which can be used in a select option

@param   string  $selected  Client key for the area
@param   string  $basePath  Base path to use

@return  array  List of system languages

@since   1.0
18640
protected function createLanguageList($selected, $basePath = JPATH_ROOT)
	{
		$list = array();

		// Cache activation
		$langs = Language::getKnownLanguages($basePath);

		foreach ($langs as $lang => $metadata)
		{
			$option = array();

			$option['text'] = $metadata['name'];
			$option['value'] = $lang;

			if ($lang == $selected)
			{
				$option['selected'] = 'selected="selected"';
			}

			$list[] = $option;
		}

		return $list;
	}
704882
public function load($baseName) 
    {     
        $langFile = "{$this->dir}/{$this->locale}/{$baseName}.php";

        if (!is_file($langFile)) {
            return $this->langs;
        }
        
        $langs = include_once $langFile;
        if ($langs && is_array($langs)) {
            $this->langs = array_merge_recursive($this->langs, $langs);
        }
        
        return $this->langs;
    }
1348151
public function getLanguages($refresh = false)
    {
        if (empty($this->detection['acceptLanguage']) || $refresh) {
            $this->detectLanguage($this->acceptLanguage);
        }

        return $this->languages;
    }
155270
public function loadLanguage($extension = '', $basePath = PATH_APP)
	{
		if (empty($extension))
		{
			$extension = 'plg_' . $this->_type . '_' . $this->_name;
		}

		$lang = \App::get('language');
		return $lang->load(strtolower($extension), $basePath, null, false, true)
			|| $lang->load(strtolower($extension), PATH_APP . DS . 'plugins' . DS . $this->_type . DS . $this->_name, null, false, true)
			|| $lang->load(strtolower($extension), PATH_CORE . DS . 'plugins' . DS . $this->_type . DS . $this->_name, null, false, true);
	}
704620
private function getLanguages()
    {
        $directories = glob($this->basePath.'/*', GLOB_ONLYDIR);

        $languages = array_map(function ($dir) {
            $name = basename($dir);

            return in_array($name, $this->excluded, true) ? null : $name;
        }, $directories);

        return array_filter($languages);
    }
1210099
public function load($basePath)
    {
        $this->basePath = $basePath;
        $this->renderer = new Renderer($this->getViewsPath());

        return
            $this
                ->loadCustomTables()
                ->loadPostTypes()
                ->loadFieldGroups()
                ->loadAcfJson()
                ->loadActions()
                ->loadShortCodes()
                ->loadOptionScreens()
                ->loadCliCommands();
    }
951220
public static function getKnownLanguages($basePath = PATH_APP)
	{
		$dir = self::getLanguagePath($basePath);
		$knownLanguages = self::parseLanguageFiles($dir);

		return $knownLanguages;
	}
1070856
static function languageInfoFromPackageList( $packageNameList, $withLanguageNames = false )
    {
        $languageInfo = array();
        foreach( $packageNameList as $packageName )
        {
            $package = eZPackage::fetch( $packageName, false, false, false );
            if( is_object( $package ) )
            {
                $packageLanguageInfo = $package->languageInfo( $withLanguageNames );
                // merge arrays
                if( $withLanguageNames )
                {
                    // we have array like 'locale' => 'name'. can use array_merge
                    $languageInfo = array_merge( $languageInfo, $packageLanguageInfo );
                }
                else
                {
                    foreach( $packageLanguageInfo as $languageLocale )
                    {
                        if( !in_array( $languageLocale, $languageInfo ) )
                        {
                            $languageInfo[] = $languageLocale;
                        }
                    }
                }
            }
            else
            {
                eZDebug::writeWarning( "Unable to fetch package '$packageName'", __METHOD__ );
            }
        }

        return $languageInfo;
    }
901318
public function getValidComposerInstallPaths($base_path = null)
    {
        $filepaths = [];

        /** @var ComposerConfig $composer */
        $composer = $this->getComposer();
        $composer_extra = $composer->getExtra();

        $base_path = isset($base_path) && file_exists($base_path)
            ? $base_path
            : ProjectX::projectRoot();

        $installed_paths = isset($composer_extra['installer-paths'])
            ? array_keys($composer_extra['installer-paths'])
            : [];

        $installed_directory = substr(static::getInstallPath(), strrpos(static::getInstallPath(), '/'));

        foreach ($installed_paths as $installed_path) {
            $path_info = pathinfo($installed_path);
            $directory = "/{$path_info['dirname']}";
            if (strpos($directory, $installed_directory) === false) {
                continue;
            }
            $filename = $path_info['filename'] !== '{$name}'
                ? "/{$path_info['filename']}"
                : null;
            $filepath = $base_path . $directory . $filename;

            if (!file_exists($filepath)) {
                continue;
            }

            $filepaths[] = $filepath;
        }

        return $filepaths;
    }
1013167
private function getSelectOptions($options, $selected)
    {
        $select = '';

        foreach ($options as $key => $value) {
            $isSelected = ($selected == $key) ? 'selected="selected"' : '';
            $select .= "<option $isSelected value='".$key."'>".$value.'</option>'.PHP_EOL;
        }

        return $select;
    }
109964
public function listGlobalURLAliases($languageCode = null, $offset = 0, $limit = -1)
    {
        $data = $this->gateway->listGlobalEntries($languageCode, $offset, $limit);
        foreach ($data as &$entry) {
            $entry['raw_path_data'] = $this->gateway->loadPathData($entry['id']);
        }

        return $this->mapper->extractUrlAliasListFromData($data);
    }
507957
protected static function getListenerEvents($listeners, $basePath)
    {
        $listenerEvents = [];

        foreach ($listeners as $listener) {
            $listener = new ReflectionClass(
                static::classFromFile($listener, $basePath)
            );

            foreach ($listener->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
                if (! Str::is('handle*', $method->name) ||
                    ! isset($method->getParameters()[0])) {
                    continue;
                }

                $listenerEvents[$listener->name.'@'.$method->name] =
                                optional($method->getParameters()[0]->getClass())->name;
            }
        }

        return array_filter($listenerEvents);
    }
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;
        }
    }
141587
public static Collection<String> getBasePaths(String basePath) {
        return Collections2.transform(Lists.newArrayList(basePath.split(",")),
                s -> s.startsWith("/") ? s.substring(1) : s);
    }
470004
public function select(
        $name,
        $list = [],
        $selected = null,
        array $selectAttributes = [],
        array $optionsAttributes = [],
        array $optgroupsAttributes = []
    ) {
        $selectAttributes = $this->appendClassToOptions(Config::get('form-builder.control-class'), $selectAttributes);

        return parent::select($name, $list, $selected, $selectAttributes, $optionsAttributes);
    }
495022
private function getBaseSelect()
    {
        $select = $this->getConnection()->select();
        $select->from(['main_table' => $this->getMainTable()], []);

        return $select;
    }
390343
public function translatedLanguages($onlyPublished = false)
    {
        $filename = substr($this->name, 0, -(strlen($this->extension())));
        $config = Grav::instance()['config'];
        $languages = $config->get('system.languages.supported', []);
        $translatedLanguages = [];

        foreach ($languages as $language) {
            $path = $this->path . DS . $this->folder . DS . $filename . '.' . $language . '.md';
            if (file_exists($path)) {
                $aPage = new Page();
                $aPage->init(new \SplFileInfo($path), $language . '.md');

                $route = $aPage->header()->routes['default'] ?? $aPage->rawRoute();
                if (!$route) {
                    $route = $aPage->route();
                }

                if ($onlyPublished && !$aPage->published()) {
                    continue;
                }

                $translatedLanguages[$language] = $route;
            }
        }

        return $translatedLanguages;
    }