Issues

ZF-9591: Two notices from Zend_Translate_Adapter

Issue Type: Bug Created: 2010-04-01T23:11:51.000+0000 Last Updated: 2010-04-10T04:06:09.000+0000 Status: Resolved Fix version(s): - 1.10.4 (28/Apr/10)

Reporter: Marko Korhonen (back-2-95) Assignee: Thomas Weidner (thomas) Tags: - Zend_Application_Resource

Related issues: Attachments:

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

Posted by Thomas Weidner (thomas) on 2010-04-02T05:49:03.000+0000

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

Posted by Marko Korhonen (back-2-95) on 2010-04-04T03:29:15.000+0000

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);
            }
        }
    }
}

Posted by Thomas Weidner (thomas) on 2010-04-05T13:17:35.000+0000

Fixed with r21770.

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

Posted by Hendri Smit (hendri.smit) on 2010-04-09T06:50:53.000+0000

I use the following configuration:

<pre class="highlight">
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}

Posted by Thomas Weidner (thomas) on 2010-04-09T08:08:25.000+0000

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.

Posted by Hendri Smit (hendri.smit) on 2010-04-10T04:06:08.000+0000

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 ;)

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts