ZF-4067: addTranslation is recursively adding version control folders to current translations

Issue Type: Improvement Created: 2008-08-26T01:43:48.000+0000 Last Updated: 2008-09-02T10:39:08.000+0000 Status: Resolved Fix version(s): - 1.6.0 (02/Sep/08)

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

Related issues: Attachments: - Zend_Translate_Adapter.ignore-vcs.patch


The function addTranslation() in Zend_Translate_Adapter recursively walks through all files (and folders) in the given folder. Immagine a structure like:

translation/lang_de.csv translation/lang_it.csv translation/.svn/text-base/lang_de.csv.svn-base translation/.svn/text-base/lang_it.csv.svn-base

You will keep struggling with your translation without realizing that the problem is not the code / translation you are working on. Happened to one of our developers, drove him crazy ;-)

IMO Zend_Translate should either ignore well-known version management folders (like .svn) - or at least allow to pass some kind of regex for custom filters.

Kind regards, Thomas Gelf


Posted by Thomas Gelf (tgelf) on 2008-08-26T01:47:10.000+0000

This is how I fixed it on our projects - should be extended to look also for other version control system folders...

Cheers, Thomas Gelf

Posted by Thomas Gelf (tgelf) on 2008-08-26T01:50:59.000+0000

NB: Adding a filter to ignore directories starting with "." (dot) would also be a solution.

Posted by Thomas Weidner (thomas) on 2008-08-26T08:04:29.000+0000

Not a bug but a feature request

Posted by Thomas Gelf (tgelf) on 2008-08-26T23:45:06.000+0000

Ack. However, even if it is not really a bug: it's a mess for who is using SVN or any similar VCS. And as every developer should do so...

...I consider it at least a misbehaviour :-p

Posted by Thomas Weidner (thomas) on 2008-08-26T23:58:40.000+0000

Also not really a misbehaviour. All found files are integrated... if you are using SVN at your customer (never heard of such) you should simply not use directory search.

You could add the wished files manually. And you could also add svn ignore to the translation files so they will not be svned and store the original ones in another location.

Btw: Making Zend_Translate dependent of preg* is really bad behaviour.

Posted by Thomas Gelf (tgelf) on 2008-08-27T00:36:15.000+0000

Using SVN (= Subversion) at my customer: I don't get the point?! Our developers have these issues on their development servers. There are no .svn folders on our productional systems.

And: they are developers doing their job, writing code as ZF's manual is showing them. They don't care about such issues. The only thing they are aware of is that it "sometimes" occurs that new translations / changes of character encodings etc are not visible... And they are unable to understand, WHY this is happening.

Adding wished files manually: I know. And I'm doing so. And I'm using nothing but gettext for my translations. I care about performance, I try to avoid useless stat()-calls etc. Unfortunately most PHP developers are NOT doing so. But feel free to teach every coder out there it's job, instead of adding a smart quick fix. It will surely be a better world thereafter!

Zend_Translate dependent of preg_*: great point. We should also fix Zend_Locale, Zend_Data, Zend_Db and many others to avoid this seldom-used bad function. But your're right, feel free to use substr() - it's also faster. Ignoring hidden files / folders (^.) shouldn't break anything and would resolve this issue.

Best regards, Thomas

Posted by Thomas Weidner (thomas) on 2008-08-27T11:31:21.000+0000

New option "ignore" can be used to fix this behaviour. Default it ignores files/directories beginning with '.'

Can be used to ignore other types like 'tmp' etc.

Posted by Thomas Gelf (tgelf) on 2008-08-28T01:15:13.000+0000

That's great, thanks a lot!

Posted by Wil Sinclair (wil) on 2008-09-02T10:39:08.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.