ZF-3071: Add way to check for cache on basis of files

Issue Type: Improvement Created: 2008-04-08T10:51:35.000+0000 Last Updated: 2008-09-02T10:39:43.000+0000 Status: Resolved Fix version(s): - 1.6.0 (02/Sep/08)

Reporter: Thomas Weidner (thomas) Assignee: Thomas Weidner (thomas) Tags: - Zend_Translate

Related issues: Attachments:


When adding files afterwards they are always added even if they already exist in the cache. The cache should check if the file already exists and return imediatly instead of adding the file once more.

from the mailinglist: Rob,

just use directory or file search. Calling multiple times addTranslation is really depreciated. See into the manual for details.

Related to you request. It is called but not at the place you expected it. The data is written in the cache.

But when you add a new translation to the adapter using the same language as already existing there is no way to detect if the new file which shall be added is the same or another one. So we MUST overwrite existing data. Think of translations which exist in a module based layout. Each module adds new translations for the same language. When there is no way to add a translation because the language already exists, such a model would not work anymore.

Therefor when you do not work with a module based layout you should always work with directory search.

Greetings Thomas Weidner, I18N Team Leader

----- Original Message ----- From: "Rob L" To: Sent: Monday, April 07, 2008 10:45 PM Subject: [fw-general] Zend_Translate doesn't cache when addTranslation is called

I wrote a custom adapter and am trying to load 13 different languages from files. I can't simply read the entire directory because I am using non-standard locale names and need full control. So in my bootstrap I call the Zend_Translate constructor for my first language and then call addTranslation for each of the remaining languages.

All of the languages get cached, but only the Zend_Translate constructor actually checks to see if a language has been cached. If you call addTranslation directly, it always calls the adapter to load the file.

For now as a workaround, I manually check to see if Zend_Cache already has the key 'Zend_Translate_[my adapter here]' cached. But really, Zend should simply check the cache for a hit every time addTranslation is called, right?


View this message in context:… Sent from the Zend Framework mailing list archive at


Posted by Thomas Weidner (thomas) on 2008-08-18T08:13:05.000+0000

Added with r10915

Posted by Wil Sinclair (wil) on 2008-09-02T10:39:43.000+0000

Updating for the 1.6.0 release.

Have you found an issue?

See the Overview section for more details.


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

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