Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions
Zend_Translate_Adapter_XmlTm Class Reference
Inheritance diagram for Zend_Translate_Adapter_XmlTm:
Zend_Translate_Adapter

Public Member Functions

 toString ()
 
- Public Member Functions inherited from Zend_Translate_Adapter
 __construct ($options=array())
 
 addTranslation ($options=array())
 
 setOptions (array $options=array())
 
 getOptions ($optionKey=null)
 
 getLocale ()
 
 setLocale ($locale)
 
 getList ()
 
 getMessageId ($message, $locale=null)
 
 getMessageIds ($locale=null)
 
 getMessages ($locale=null)
 
 isAvailable ($locale)
 
 translate ($messageId, $locale=null)
 
 plural ($singular, $plural, $number, $locale=null)
 
 _ ($messageId, $locale=null)
 
 isTranslated ($messageId, $original=false, $locale=null)
 
 toString ()
 

Protected Member Functions

 _loadTranslationData ($filename, $locale, array $options=array())
 
- Protected Member Functions inherited from Zend_Translate_Adapter
 _loadTranslationData ($data, $locale, array $options=array())
 
 _log ($message, $locale)
 

Additional Inherited Members

- Static Public Member Functions inherited from Zend_Translate_Adapter
static getCache ()
 
static setCache (Zend_Cache_Core $cache)
 
static hasCache ()
 
static removeCache ()
 
static clearCache ($tag=null)
 
- Data Fields inherited from Zend_Translate_Adapter
const LOCALE_DIRECTORY = 'directory'
 
const LOCALE_FILENAME = 'filename'
 
- Protected Attributes inherited from Zend_Translate_Adapter
 $_options
 
 $_translate = array()
 
- Static Protected Attributes inherited from Zend_Translate_Adapter
static $_cache = null
 

Detailed Description

Definition at line 41 of file XmlTm.php.

Member Function Documentation

◆ _loadTranslationData()

_loadTranslationData (   $filename,
  $locale,
array  $options = array() 
)
protected

Load translation data (XMLTM file reader)

Parameters
string$localeLocale/Language to add data for, identical with locale identifier, see Zend_Locale for more information
string$filenameXMLTM file to add, full path must be given for access
array$optionOPTIONAL Options to use
Exceptions
Zend_Translation_Exception
Returns
array

Definition at line 60 of file XmlTm.php.

61  {
62  $this->_data = array();
63  $this->_lang = $locale;
64  if (!is_readable($filename)) {
65  #require_once 'Zend/Translate/Exception.php';
66  throw new Zend_Translate_Exception('Translation file \'' . $filename . '\' is not readable.');
67  }
68 
69  $encoding = $this->_findEncoding($filename);
70  $this->_file = xml_parser_create($encoding);
71  xml_set_object($this->_file, $this);
72  xml_parser_set_option($this->_file, XML_OPTION_CASE_FOLDING, 0);
73  xml_set_element_handler($this->_file, "_startElement", "_endElement");
74  xml_set_character_data_handler($this->_file, "_contentElement");
75 
76  try {
77  Zend_Xml_Security::scanFile($filename);
78  } catch (Zend_Xml_Exception $e) {
79  #require_once 'Zend/Translate/Exception.php';
80  throw new Zend_Translate_Exception(
81  $e->getMessage()
82  );
83  }
84 
85  if (!xml_parse($this->_file, file_get_contents($filename))) {
86  $ex = sprintf('XML error: %s at line %d of file %s',
87  xml_error_string(xml_get_error_code($this->_file)),
88  xml_get_current_line_number($this->_file),
89  $filename);
90  xml_parser_free($this->_file);
91  #require_once 'Zend/Translate/Exception.php';
92  throw new Zend_Translate_Exception($ex);
93  }
94 
95  return $this->_data;
96  }

◆ toString()

toString ( )

Returns the adapter name

Returns
string

Definition at line 150 of file XmlTm.php.

151  {
152  return "XmlTm";
153  }

The documentation for this class was generated from the following file: