Issues

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

Description

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

Comments

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

Cheers, Thomas Gelf

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

Not a bug but a feature request

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

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.

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

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.

That's great, thanks a lot!

Updating for the 1.6.0 release.