protected function populate_parent_languages($lang, array $stack = array()) {

        // English does not have a parent language.
        if ($lang === 'en') {
            return $stack;
        }

        // Prevent circular dependency (and thence the infinitive recursion loop).
        if (in_array($lang, $stack)) {
            return $stack;
        }

        // Load language configuration and look for the explicit parent language.
        if (!file_exists("$this->otherroot/$lang/langconfig.php")) {
            return $stack;
        }
        $string = array();
        include("$this->otherroot/$lang/langconfig.php");

        if (empty($string['parentlanguage']) or $string['parentlanguage'] === 'en') {
            return array_merge(array($lang), $stack);

        }

        $parentlang = $string['parentlanguage'];
        return $this->populate_parent_languages($parentlang, array_merge(array($lang), $stack));
    }
protected function populate_parent_languages($lang, array $stack = array()) {

        // English does not have a parent language.
        if ($lang === 'en') {
            return $stack;
        }

        // Prevent circular dependency (and thence the infinitive recursion loop).
        if (in_array($lang, $stack)) {
            return $stack;
        }

        // Load language configuration and look for the explicit parent language.
        if (!file_exists("$this->otherroot/$lang/langconfig.php")) {
            return $stack;
        }
        $string = array();
        include("$this->otherroot/$lang/langconfig.php");

        if (empty($string['parentlanguage']) or $string['parentlanguage'] === 'en') {
            return array_merge(array($lang), $stack);

        }

        $parentlang = $string['parentlanguage'];
        return $this->populate_parent_languages($parentlang, array_merge(array($lang), $stack));
    }
protected function populate_parent_languages ( $ lang , array $ stack = array ( ) ) { // English does not have a parent language. if ( $ lang === 'en' ) { return $ stack ; } // Prevent circular dependency (and thence the infinitive recursion loop). if ( in_array ( $ lang , $ stack ) ) { return $ stack ; } // Load language configuration and look for the explicit parent language. if ( ! file_exists ( "$this->otherroot/$lang/langconfig.php" ) ) { return $ stack ; } $ string = array ( ) ; include ( "$this->otherroot/$lang/langconfig.php" ) ; if ( empty ( $ string [ 'parentlanguage' ] ) or $ string [ 'parentlanguage' ] === 'en' ) { return array_merge ( array ( $ lang ) , $ stack ) ; } $ parentlang = $ string [ 'parentlanguage' ] ; return $ this -> populate_parent_languages ( $ parentlang , array_merge ( array ( $ lang ) , $ stack ) ) ; }
Helper method that recursively loads all parents of the given language.

@see self::get_language_dependencies()
@param string $lang language code
@param array $stack list of parent languages already populated in previous recursive calls
@return array list of all parents of the given language with the $lang itself added as the last element
Helper method that recursively loads all parents of the given language .