Issues

ZF-4821: Error parsing ini files in SVN working copy

Issue Type: Bug Created: 2008-11-06T05:08:28.000+0000 Last Updated: 2008-11-06T06:57:44.000+0000 Status: Resolved Fix version(s): - 1.6.1 (15/Sep/08)

Reporter: Grzegorz Nowicki (gnowicki) Assignee: Thomas Weidner (thomas) Tags: - Zend_Translate

Related issues: Attachments:

Description

Lang structure:

<pre class="literal">
/language
   /pl
      /main
         loginForm.ini
   /en
      /main
         loginForm.ini

In application:

<pre class="highlight">
$translate = new Zend_Translate('ini',
                                '/language',
                                null,
                                array('scan' =>
                                      Zend_Translate::LOCALE_DIRECTORY));

And i have:

<pre class="literal">
Warning: Error parsing /var/www/ (...) /language/.svn/text-base/pl.mo.svn-base on line 1 in /var/www/ (...)  /library/Zend/Translate/Adapter/Ini.php on line 63

To avoid errors in the working copy suggesting changes in Zend_Translate_Adapter_Ini:

<pre class="literal">
Index: Ini.php
===================================================================
--- Ini.php (revision 1452)
+++ Ini.php (working copy)
@@ -60,7 +60,7 @@
             require_once 'Zend/Translate/Exception.php';
             throw new Zend_Translate_Exception("Ini file '".$data."' not found");
         }
-        $inidata = parse_ini_file($data, false);
+        $inidata = @parse_ini_file($data, false);
 
         $options = array_merge($this->_options, $options);
         if (($options['clear'] == true) ||  !isset($this->_translate[$locale])) {

In this case, all files that are not ini will be ignored.

Comments

Posted by Thomas Weidner (thomas) on 2008-11-06T05:15:06.000+0000

Don't parse gettext files with the ini adapter, and it will work.

Additionally using the ignore option prevents the scanning for svn directories like in your case. It is set to '.' per default. Suppressing an error is not allowed in ZF.

And always seperate your translations from other files.

Posted by Thomas Weidner (thomas) on 2008-11-06T05:16:06.000+0000

Duplication of an several months old already solved and released issue.

Posted by Grzegorz Nowicki (gnowicki) on 2008-11-06T06:21:42.000+0000

"Don't parse gettext files with the ini adapter, and it will work. " - i don't

Zend Framework 1.6.2 Full, Zend_Translate_Adapter:

<pre class="literal">
lines 62 - 73:
    /**
     * Array with all options, each adapter can have own additional options
     *       'clear'  => clears already loaded data when adding new files
     *       'scan'   => searches for translation files using the LOCALE constants
     *       'locale' => the actual set locale to use
     * @var array
     */
    protected $_options = array(
        'clear'  => false,
        'scan'   => null,
        'locale' => 'auto' 
    );

"ignore option" don't exists in 1.6.2 (1.6.1 too)

"And always seperate your translations from other files" - It is not possible in the working copy

regards

Posted by Thomas Weidner (thomas) on 2008-11-06T06:57:44.000+0000

http://framework.zend.com/issues/browse/ZF-4067

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