Index: Adapter.php =================================================================== --- Adapter.php (revision 6821) +++ Adapter.php (working copy) @@ -59,7 +59,7 @@ */ protected $_options = array( 'clear' => false, // clear previous loaded translation data - 'scan' => null // where to find the locale + 'scan' => self::LOCALE_DIRECTORY, // where to find the locale ); /** @@ -79,14 +79,14 @@ * @param string|array $options Options for the adaptor * @throws Zend_Translate_Exception */ - public function __construct($data, $locale = null, array $options = array()) + public function __construct($data, $defaultLocale = null, array $options = array()) { - if ($locale === null) { - $locale = new Zend_Locale(); + if ($defaultLocale === null) { + $defaultLocale = new Zend_Locale(); } - if ($locale instanceof Zend_Locale) { - $locale = $locale->toString(); - } + if ($defaultLocale instanceof Zend_Locale) { + $defaultLocale = $defaultLocale->toString(); + } $options = array_merge($this->_options, $options); if (is_string($data) and is_dir($data)) { @@ -96,7 +96,7 @@ if ($info->isDir()) { $directory = $info->getPath(); - // pathname as locale + // pathname as localeself::LOCALE_DIRECTORY if (($options['scan'] === self::LOCALE_DIRECTORY) and (Zend_Locale::isLocale((string) $info))) { $locale = (string) $info; } @@ -126,8 +126,8 @@ } try { $this->addTranslation((string) $info->getPathname(), $locale, $options); - if ((array_key_exists($locale, $this->_translate)) and (count($this->_translate[$locale]) > 0)) { - $this->setLocale($locale); + if ((array_key_exists($defaultLocale, $this->_translate)) and (count($this->_translate[$defaultLocale]) > 0)) { + $this->setLocale($defaultLocale); } } catch (Zend_Translate_Exception $e) { // ignore failed sources while scanning @@ -135,9 +135,9 @@ } } } else { - $this->addTranslation($data, $locale, $options); - if ((array_key_exists($locale, $this->_translate)) and (count($this->_translate[$locale]) > 0)) { - $this->setLocale($locale); + $this->addTranslation($data, $defaultLocale, $options); + if ((array_key_exists($defaultLocale, $this->_translate)) and (count($this->_translate[$defaultLocale]) > 0)) { + $this->setLocale($defaultLocale); } } $this->_automatic = true;