Index: library/Zend/Application/Resource/Translate.php =================================================================== --- library/Zend/Application/Resource/Translate.php (revision 22471) +++ library/Zend/Application/Resource/Translate.php (working copy) @@ -87,6 +87,21 @@ } } + if (!empty($options['cache']) AND is_string($options['cache'])) { + $bootstrap = $this->getBootstrap(); + if ($bootstrap instanceof Zend_Application_Bootstrap_ResourceBootstrapper + AND $bootstrap->hasPluginResource('CacheManager') + ) { + $cacheManager = $bootstrap->bootstrap('CacheManager') + ->getResource('CacheManager'); + if (null !== $cacheManager + AND $cacheManager->hasCache($options['cache']) + ) { + $options['cache'] = $cacheManager->getCache($options['cache']); + } + } + } + $key = (isset($options['registry_key']) && !is_numeric($options['registry_key'])) ? $options['registry_key'] : self::DEFAULT_REGISTRY_KEY; Index: tests/Zend/Application/Resource/TranslateTest.php =================================================================== --- tests/Zend/Application/Resource/TranslateTest.php (revision 22471) +++ tests/Zend/Application/Resource/TranslateTest.php (working copy) @@ -148,6 +148,37 @@ $this->assertEquals('bericht4', $translate->translate('message4')); $this->assertEquals('shouldNotExist', $translate->translate('shouldNotExist')); } + + /** + * @group ZF-10034 + */ + public function testSetCacheFromCacheManager() + { + $configCache = array( + 'translate' => array( + 'frontend' => array( + 'name' => 'Core', + 'options' => array( + 'lifetime' => 120, + 'automatic_serialization' => true + ) + ), + 'backend' => array( + 'name' => 'Black Hole' + ) + ) + ); + $this->bootstrap->registerPluginResource('cachemanager', $configCache); + + $options = $this->_translationOptions; + $options['cache'] = 'translate'; + $resource = new Zend_Application_Resource_Translate($options); + $resource->setBootstrap($this->bootstrap); + $resource->init(); + + $this->assertType('Zend_Cache_Core', Zend_Translate::getCache()); + Zend_Translate::clearCache(); + } } if (PHPUnit_MAIN_METHOD == 'Zend_Application_Resource_TranslateTest::main') {