Skip to content

Commit

Permalink
MINOR Added array fallback support to i18nSSLegacyAdapter
Browse files Browse the repository at this point in the history
  • Loading branch information
chillu committed Apr 15, 2012
1 parent 0e0e5dd commit 326ff4a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions i18n/i18nSSLegacyAdapter.php
Expand Up @@ -19,21 +19,23 @@ public function __construct($options = array()) {
parent::__construct($options);
}

protected function _loadTranslationData($filename, $locale, array $options = array()) {
protected function _loadTranslationData($data, $locale, array $options = array()) {
$options = array_merge($this->_options, $options);

if ($options['clear'] || !isset($this->_translate[$locale])) {
$this->_translate[$locale] = array();
}

$this->_filename = $filename;
if(is_array($data)) return array($locale => $data);

$this->_filename = $data;

// Ignore files with other extensions
if(pathinfo($this->_filename, PATHINFO_EXTENSION) != 'php') return;

if (!is_readable($this->_filename)) {
require_once 'Zend/Translate/Exception.php';
throw new Zend_Translate_Exception('Error opening translation file \'' . $filename . '\'.');
throw new Zend_Translate_Exception('Error opening translation file \'' . $this->_filename . '\'.');
}

global $lang;
Expand Down

0 comments on commit 326ff4a

Please sign in to comment.