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));
    }