Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions
Zend_Translate_Adapter_Xliff Class Reference
Inheritance diagram for Zend_Translate_Adapter_Xliff:
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 Xliff.php.

Member Function Documentation

◆ _loadTranslationData()

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

Load translation data (XLIFF file reader)

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

Definition at line 66 of file Xliff.php.

67  {
68  $this->_data = array();
69  if (!is_readable($filename)) {
70  #require_once 'Zend/Translate/Exception.php';
71  throw new Zend_Translate_Exception('Translation file \'' . $filename . '\' is not readable.');
72  }
73 
74  if (empty($options['useId'])) {
75  $this->_useId = false;
76  } else {
77  $this->_useId = true;
78  }
79 
80  $encoding = $this->_findEncoding($filename);
81  $this->_target = $locale;
82  $this->_file = xml_parser_create($encoding);
83  xml_set_object($this->_file, $this);
84  xml_parser_set_option($this->_file, XML_OPTION_CASE_FOLDING, 0);
85  xml_set_element_handler($this->_file, "_startElement", "_endElement");
86  xml_set_character_data_handler($this->_file, "_contentElement");
87 
88  try {
89  Zend_Xml_Security::scanFile($filename);
90  } catch (Zend_Xml_Exception $e) {
91  #require_once 'Zend/Translate/Exception.php';
92  throw new Zend_Translate_Exception(
93  $e->getMessage()
94  );
95  }
96 
97  if (!xml_parse($this->_file, file_get_contents($filename))) {
98  $ex = sprintf('XML error: %s at line %d of file %s',
99  xml_error_string(xml_get_error_code($this->_file)),
100  xml_get_current_line_number($this->_file),
101  $filename);
102  xml_parser_free($this->_file);
103  #require_once 'Zend/Translate/Exception.php';
104  throw new Zend_Translate_Exception($ex);
105  }
106 
107  return $this->_data;
108  }

◆ toString()

toString ( )

Returns the adapter name

Returns
string

Definition at line 240 of file Xliff.php.

241  {
242  return "Xliff";
243  }

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