/** * Load translation data (TMX file reader) * * @param string $filename TMX file to add, full path must be given for access * @param string $locale Locale has no effect for TMX because TMX defines all languages within * the source file * @param boolean $option Clears the complete translation, because TMX defines all languages in one file * @throws Zend_Translation_Exception */ protected function _loadTranslationData($filename, $locale, $option = null) { if ($option) { $this->_translate = array(); } if (!is_readable($filename)) { throw new Zend_Translate_Exception('Translation file \'' . $filename . '\' is not readable.'); } $this->_file = xml_parser_create(); xml_set_object($this->_file, $this); xml_parser_set_option($this->_file, XML_OPTION_CASE_FOLDING, 0); xml_set_element_handler($this->_file, "_startElement", "_endElement"); xml_set_character_data_handler($this->_file, "_contentElement"); if (!xml_parse($this->_file, file_get_contents($filename))) { throw new Zend_Translate_Exception(sprintr('XML error: %s at line %d', xml_error_string(xml_get_error_code($this->_file)), xml_get_current_line_number($this->_file))); xml_parser_free($this->_file); } }
<?php include "../src/helpers.php"; $result = sprintr("Hello {0} {1}! The {0} is wonderful.", "World", "!"); var_dump($result);