Prado\I18N\core\MessageSource_gettext::getCatalogues PHP Method

getCatalogues() protected method

E.g. array('messages','en_AU')
protected getCatalogues ( $dir = null, $variant = null ) : array
return array list of catalogues
    protected function getCatalogues($dir = null, $variant = null)
    {
        $dir = $dir ? $dir : $this->source;
        $files = scandir($dir);
        $catalogue = array();
        foreach ($files as $file) {
            if (is_dir($dir . '/' . $file) && preg_match('/^[a-z]{2}(_[A-Z]{2,3})?$/', $file)) {
                $catalogue = array_merge($catalogue, $this->getCatalogues($dir . '/' . $file, $file));
            }
            $pos = strpos($file, $this->dataExt);
            if ($pos > 0 && substr($file, -1 * strlen($this->dataExt)) == $this->dataExt) {
                $name = substr($file, 0, $pos);
                $dot = strrpos($name, $this->dataSeparator);
                $culture = $variant;
                $cat = $name;
                if (is_int($dot)) {
                    $culture = substr($name, $dot + 1, strlen($name));
                    $cat = substr($name, 0, $dot);
                }
                $details[0] = $cat;
                $details[1] = $culture;
                $catalogue[] = $details;
            }
        }
        sort($catalogue);
        return $catalogue;
    }