import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
@ -36,6 +36,7 @@ class Zend_Translate_Adapter_Gettext extends Zend_Translate_Adapter {
|
||||
private $_bigEndian = false;
|
||||
private $_file = false;
|
||||
private $_adapterInfo = array();
|
||||
private $_data = array();
|
||||
|
||||
/**
|
||||
* Generates the adapter
|
||||
@ -72,17 +73,13 @@ class Zend_Translate_Adapter_Gettext extends Zend_Translate_Adapter {
|
||||
* see Zend_Locale for more information
|
||||
* @param array $option OPTIONAL Options to use
|
||||
* @throws Zend_Translation_Exception
|
||||
* @return array
|
||||
*/
|
||||
protected function _loadTranslationData($filename, $locale, array $options = array())
|
||||
{
|
||||
$this->_data = array();
|
||||
$this->_bigEndian = false;
|
||||
$options = $options + $this->_options;
|
||||
|
||||
if ($options['clear'] || !isset($this->_translate[$locale])) {
|
||||
$this->_translate[$locale] = array();
|
||||
}
|
||||
|
||||
$this->_file = @fopen($filename, 'rb');
|
||||
$this->_file = @fopen($filename, 'rb');
|
||||
if (!$this->_file) {
|
||||
require_once 'Zend/Translate/Exception.php';
|
||||
throw new Zend_Translate_Exception('Error opening translation file \'' . $filename . '\'.');
|
||||
@ -133,18 +130,19 @@ class Zend_Translate_Adapter_Gettext extends Zend_Translate_Adapter {
|
||||
|
||||
if ($transtemp[$count * 2 + 1] != 0) {
|
||||
fseek($this->_file, $transtemp[$count * 2 + 2]);
|
||||
$this->_translate[$locale][$original] = fread($this->_file, $transtemp[$count * 2 + 1]);
|
||||
$this->_data[$locale][$original] = fread($this->_file, $transtemp[$count * 2 + 1]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->_translate[$locale][''] = trim($this->_translate[$locale]['']);
|
||||
if (empty($this->_translate[$locale][''])) {
|
||||
$this->_data[$locale][''] = trim($this->_data[$locale]['']);
|
||||
if (empty($this->_data[$locale][''])) {
|
||||
$this->_adapterInfo[$filename] = 'No adapter information available';
|
||||
} else {
|
||||
$this->_adapterInfo[$filename] = $this->_translate[$locale][''];
|
||||
$this->_adapterInfo[$filename] = $this->_data[$locale][''];
|
||||
}
|
||||
|
||||
unset($this->_translate[$locale]['']);
|
||||
unset($this->_data[$locale]['']);
|
||||
return $this->_data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user