ZF-4821: Error parsing ini files in SVN working copy
Description
Lang structure:
/language
/pl
/main
loginForm.ini
/en
/main
loginForm.ini
In application:
$translate = new Zend_Translate('ini',
'/language',
null,
array('scan' =>
Zend_Translate::LOCALE_DIRECTORY));
And i have:
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:
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:
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