ZF-9591: Two notices from Zend_Translate_Adapter

Description

Two notices from Zend_Translate_Adapter, which don't exist on 1.10.2:

Notice: Undefined index: content in /home/_library_unstable/Zend/Translate/Adapter.php on line 204

Notice: Undefined index: locale in /home/_library_unstable/Zend/Translate/Adapter.php on line 205

Rows 203-210 from the file:

try { if (!($options['content'] instanceof Zend_Translate) && !($options['content'] instanceof Zend_Translate_Adapter)) { $options['locale'] = Zend_Locale::findLocale($options['locale']); } } catch (Zend_Locale_Exception $e) { require_once 'Zend/Translate/Exception.php'; throw new Zend_Translate_Exception("The given Language '{$options['locale']}' does not exist", 0, $e); }

Comments

How do you call Zend_Translate ? We need some information for a reproduction.

I use ini file with Zend_Application, so it uses Translation resource:

here's my translate from ini file: resources.translate.adapter = array resources.translate.locale = fi_FI resources.translate.data = APPLICATION_PATH "/translations" resources.translate.options.scan = directory resources.translate.options.logUntranslated = false

additionally, I load module specific translations in my Bootstrap:

public function _initTranslateModuleLoader() { $this->bootstrap(array("locale", "translate"));

    $translate = $this->getResource("translate");
    $locale = $this->getResource("locale");

    foreach ($this->modules as $module => $directory)
    {
        $translation_file = dirname($directory) ."/translations/{$locale->toString()}.php";

        if (file_exists($translation_file))
        {
            require_once($translation_file);

            if (isset($translations) && is_array($translations))
            {
                $translate->addTranslation($translations);

                unset($translations);
            }
        }
    }
}

Fixed with r21770.

Note that the problem is related to Zend_Application_Ressource_Translate which you are using and not within Zend_Translate.

I use the following configuration:


resources.translate.adapter = csv
resources.translate.data = APPLICATION_PATH "/languages/nl.csv"
resources.translate.locale = "nl"

This results in (with and without the changes in r21770): {color:red} Fatal error: Uncaught exception 'Zend_Translate_Exception' with message 'Error opening translation file 'Array' {color}

I don't understand what this has to do with this issue. Here is a problem described with raised notices.

You mention a problem where Zend_Translate returns that a file can not be opened. And you are using a different configuration as the reporter of this issue.

Please note that different issues should not be thrown together into one.

For default problems like described by you, please ask within our mailinglist or within our IRC channel.

After reading this issue I thought r21770 was supposed to fix problems between the improved Zend_Translate and Zend_Application_Resource_Translate.

I'm currently running a site on ZF 1.10.2 with the configuration I mentioned and without any problems. After upgrading to ZF 1.10.3 I got the Fatal error. I thought it had something to do with this issue.

I then applied the changes in r21770 but that didn't solve anything. So I assumed the changes you made weren't sufficient. That was a wrong assumption. Sorry for that.

Today I tried upgrading again and now the errors don't appear. So I probably made a mistake yesterday while doing the upgrade.

You're probably right that it would have been better to create a new issue. But next time I'll first make sure it's not me being stupid ;)