public function loadDictionary()
    {
        if (self::$dictionary_loaded) {
            return true;
        }
        
        $xmldoc = new \DOMDocument();
        
        if (!$xmldoc->load($this->localization_path . "texts.xml")) {
            throw new \Exception("Translation file '" . $this->localization_path . "texts.xml" . "' cannot be loaded!");
        }
        
        $xsdpath = new \DOMXPath($xmldoc);
        
        $nodes = $xsdpath->evaluate("/document/interface_languages/language");
        foreach ($nodes as $node) {
            $lang_code = $node->getAttribute("id");
            if (!empty($lang_code)) {
                self::$supported_languages[$lang_code] = $lang_code;
            }
        }
        
        $nodes = $xsdpath->evaluate("/document/languages/language/*");
        foreach ($nodes as $node) {
            $pnode = $node->parentNode;
            
            $lang_code = $node->nodeName;
            $text_id = $pnode->getAttribute("id");
            
            if (!empty($lang_code) && !empty($text_id) && !empty($node->nodeValue)) {
                self::$languages[$lang_code][$text_id] = $node->nodeValue;
            }
        }
        
        $nodes = $xsdpath->evaluate("/document/countries/country/*");
        foreach ($nodes as $node) {
            $pnode = $node->parentNode;
            
            $lang_code = $node->nodeName;
            $text_id = $pnode->getAttribute("id");
            
            if (!empty($lang_code) && !empty($text_id) && !empty($node->nodeValue)) {
                self::$countries[$lang_code][$text_id] = $node->nodeValue;
            }
        }
        
        $nodes = $xsdpath->evaluate("/document/texts/text/*");
        foreach ($nodes as $node) {
            $pnode = $node->parentNode;
            
            $lang_code = $node->nodeName;
            $text_id = $pnode->getAttribute("id");
            
            if (!empty($lang_code) && !empty($text_id) && !empty($node->nodeValue)) {
                self::$texts[$lang_code][$text_id] = $node->nodeValue;
            }
        }
        
        self::$dictionary_loaded = true;
        
        foreach (self::$supported_languages as $lng) {
            self::$current_language = $lng;
            break;
        }
        
        return true;
    }