views:

238

answers:

2
+1  Q: 

Recusive xgettext?

How can I compile a .po file using xgettext with PHP files with a single command recursively?

My PHP files exist in a hierarchy, and the straight xgettext command doesn't seem to dig down recursively.

+1  A: 

Got it:

find . -iname "*.php" | xargs xgettext

I was trying to use -exec before, but that would only run one file at a time. This runs them on the bunch.

Yay Google!

neezer
A: 

Here's a solution for Windows. At first, install gettext and find from the GnuWin32 tools collection.

You can run the following command afterwards:

find /source/directory -iname "*.php" -exec xgettext -j -o /output/directory/messages.pot {} ;

The output file has to exist prior to running the command, so the new definitions can be merged with it.

Unambiguous
Perhaps installing and using Cygwin? I know it's not a native solution, but should get you the same result.
neezer