ZF-6671: Different results between 1.7.4 and 1.8.1
Description
We are running an application on ZF 1.7.4 and I updated the version on our test environment to 1.8.1. I found a difference between these two versions in overwriting translations.
<?php
require_once 'Zend/Translate.php';
$translate = new Zend_Translate('Gettext', 'application/lang/de.mo', 'de');
echo $translate->_('hello'); // hallo welt
$translate->addTranslation('module/dummy/lang/de.mo', 'de');
echo $translate->_('hello'); // hallo
<?php
require_once 'Zend/Translate.php';
$translate = new Zend_Translate('Gettext', 'application/lang/de.mo', 'de');
echo $translate->_('hello'); // hallo welt
$translate->addTranslation('module/dummy/lang/de.mo', 'de');
echo $translate->_('hello'); // hallo welt
Comments
Posted by Thomas Weidner (thomas) on 2009-05-15T04:18:12.000+0000
Using the same messageId within several files, and loading them at once leads always to unexpected behaviour. What you will get returned depends on the set cache, the search order and several other informations.
Posted by Jan Pieper (jpieper) on 2009-05-15T04:45:59.000+0000
So it won't be able anymore?
Posted by Thomas Weidner (thomas) on 2009-05-15T05:16:30.000+0000
I didn't say such.
The main reason for this behaviour is that before 1.8 the adapter was responsible for loading the data, adding the entries in the cache. But this introduced problems as adapters didn't behave 100% same and made also problems with caching multi-locale files.
So we unified this. Now all work is done in the abstract class and therefor is unified for all adapters.
For now you won't be able to change this. For future I could imagine to add a option which switches between "don't overwrite duplicate messageIds" and "overwrite duplicate messageIds".
Posted by Jan Pieper (jpieper) on 2009-05-15T11:47:11.000+0000
Posted by Thomas Weidner (thomas) on 2009-06-27T10:19:54.000+0000
In Incubator since r16321, waiting for code review of r16247
Posted by Thomas Weidner (thomas) on 2009-07-20T12:11:54.000+0000
Accepted and integrated into core with r16883.