Definition at line 34 of file Gettext.php.
◆ _loadTranslationData()
_loadTranslationData |
( |
|
$filename, |
|
|
|
$locale, |
|
|
array |
$options = array() |
|
) |
| |
|
protected |
Load translation data (MO file reader)
- Parameters
-
string | $filename | MO file to add, full path must be given for access |
string | $locale | New Locale/Language to set, identical with locale identifier, see Zend_Locale for more information |
array | $option | OPTIONAL Options to use |
- Exceptions
-
Zend_Translation_Exception | |
- Returns
- array
Definition at line 65 of file Gettext.php.
67 $this->_data = array();
68 $this->_bigEndian =
false;
69 $this->_file = @
fopen($filename,
'rb');
71 #require_once 'Zend/Translate/Exception.php'; 74 if (@filesize($filename) < 10) { 75 @fclose($this->_file); 76 #require_once 'Zend/Translate/Exception.php
'; 77 throw new Zend_Translate_Exception('\
'' . $filename .
'\' is not a gettext file
'); 81 $input = $this->_readMOData(1); 82 if (strtolower(substr(dechex($input[1]), -8)) == "950412de") { 83 $this->_bigEndian = false; 84 } else if (strtolower(substr(dechex($input[1]), -8)) == "de120495") { 85 $this->_bigEndian = true; 87 @fclose($this->_file); 88 #require_once 'Zend/Translate/Exception.php
'; 89 throw new Zend_Translate_Exception('\
'' . $filename .
'\' is not a gettext file
'); 91 // read revision - not supported for now 92 $input = $this->_readMOData(1); 95 $input = $this->_readMOData(1); 98 // number of original strings 99 $input = $this->_readMOData(1); 100 $OOffset = $input[1]; 102 // number of translation strings 103 $input = $this->_readMOData(1); 104 $TOffset = $input[1]; 106 // fill the original table 107 fseek($this->_file, $OOffset); 108 $origtemp = $this->_readMOData(2 * $total); 109 fseek($this->_file, $TOffset); 110 $transtemp = $this->_readMOData(2 * $total); 112 for($count = 0; $count < $total; ++$count) { 113 if ($origtemp[$count * 2 + 1] != 0) { 114 fseek($this->_file, $origtemp[$count * 2 + 2]); 115 $original = @fread($this->_file, $origtemp[$count * 2 + 1]); 116 $original = explode("\0", $original); 121 if ($transtemp[$count * 2 + 1] != 0) { 122 fseek($this->_file, $transtemp[$count * 2 + 2]); 123 $translate = fread($this->_file, $transtemp[$count * 2 + 1]); 124 $translate = explode("\0", $translate); 125 if ((count($original) > 1)) { 126 $this->_data[$locale][$original[0]] = $translate; 127 array_shift($original); 128 foreach ($original as $orig) { 129 $this->_data[$locale][$orig] = ''; 132 $this->_data[$locale][$original[0]] = $translate[0]; 137 @fclose($this->_file); 139 $this->_data[$locale][''] = trim($this->_data[$locale]['']); 140 if (empty($this->_data[$locale][''])) { 141 $this->_adapterInfo[$filename] = 'No adapter information available
'; 143 $this->_adapterInfo[$filename] = $this->_data[$locale]['']; 146 unset($this->_data[$locale]['']);
◆ getAdapterInfo()
Returns the adapter informations
- Returns
- array Each loaded adapter information as array value
Definition at line 155 of file Gettext.php.
157 return $this->_adapterInfo;
◆ toString()
Returns the adapter name
- Returns
- string
Definition at line 165 of file Gettext.php.
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Translate/Adapter/Gettext.php