final public function parseDirectory($rootDirectory, $relativePath, $translations = null, $subParsersFilter = false, $exclude3rdParty = true)
    {
        if (!is_object($translations)) {
            $translations = new \Gettext\Translations();
        }
        $dir = (string) $rootDirectory;
        if ($dir !== '') {
            $dir = @realpath($rootDirectory);
            if (($dir === false) || (!is_dir($dir))) {
                $dir = '';
            } else {
                $dir = rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $dir), '/');
            }
        }
        if ($dir === '') {
            throw new \Exception("Unable to find the directory $rootDirectory");
        }
        if (!@is_readable($dir)) {
            throw new \Exception("Directory not readable: $dir");
        }
        $dirRel = is_string($relativePath) ? trim(str_replace(DIRECTORY_SEPARATOR, '/', $relativePath), '/') : '';
        $this->parseDirectoryDo($translations, $dir, $dirRel, $subParsersFilter, $exclude3rdParty);

        return $translations;
    }
final public function parseDirectory($rootDirectory, $relativePath, $translations = null, $subParsersFilter = false, $exclude3rdParty = true)
    {
        if (!is_object($translations)) {
            $translations = new \Gettext\Translations();
        }
        $dir = (string) $rootDirectory;
        if ($dir !== '') {
            $dir = @realpath($rootDirectory);
            if (($dir === false) || (!is_dir($dir))) {
                $dir = '';
            } else {
                $dir = rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $dir), '/');
            }
        }
        if ($dir === '') {
            throw new \Exception("Unable to find the directory $rootDirectory");
        }
        if (!@is_readable($dir)) {
            throw new \Exception("Directory not readable: $dir");
        }
        $dirRel = is_string($relativePath) ? trim(str_replace(DIRECTORY_SEPARATOR, '/', $relativePath), '/') : '';
        $this->parseDirectoryDo($translations, $dir, $dirRel, $subParsersFilter, $exclude3rdParty);

        return $translations;
    }
final public function parseDirectory ( $ rootDirectory , $ relativePath , $ translations = null , $ subParsersFilter = false , $ exclude3rdParty = true ) { if ( ! is_object ( $ translations ) ) { $ translations = new \ Gettext \ Translations ( ) ; } $ dir = ( string ) $ rootDirectory ; if ( $ dir !== '' ) { $ dir = @ realpath ( $ rootDirectory ) ; if ( ( $ dir === false ) || ( ! is_dir ( $ dir ) ) ) { $ dir = '' ; } else { $ dir = rtrim ( str_replace ( DIRECTORY_SEPARATOR , '/' , $ dir ) , '/' ) ; } } if ( $ dir === '' ) { throw new \ Exception ( "Unable to find the directory $rootDirectory" ) ; } if ( ! @ is_readable ( $ dir ) ) { throw new \ Exception ( "Directory not readable: $dir" ) ; } $ dirRel = is_string ( $ relativePath ) ? trim ( str_replace ( DIRECTORY_SEPARATOR , '/' , $ relativePath ) , '/' ) : '' ; $ this -> parseDirectoryDo ( $ translations , $ dir , $ dirRel , $ subParsersFilter , $ exclude3rdParty ) ; return $ translations ; }
Extracts translations from a directory.

@param string                          $rootDirectory    The base directory where we start looking translations from
@param string                          $relativePath     The relative path (translations references will be prepended with this path)
@param \Gettext\Translations|null=null $translations     The translations object where the translatable strings will be added (if null we'll create a new Translations instance)
@param array|false                     $subParsersFilter A list of sub-parsers handles (set to false to use all the sub-parsers)
@param bool                            $exclude3rdParty  Exclude concrete5 3rd party directories (namely directories called 'vendor' and '3rdparty')

@throws \Exception Throws an \Exception in case of errors

@return \Gettext\Translations

@example If you want to parse the concrete5 core directory, you should call `parseDirectory('PathToTheWebroot/concrete', 'concrete')`
@example If you want to parse a concrete5 package, you should call `parseDirectory('PathToThePackageFolder', 'packages/YourPackageHandle')`
Extracts translations from a directory .