In an iOS Project with folders containing *.m files, similar to packages, one will have to run genstrings -o en.lproj *.m for each folder and match the relative en.lproj path. Is there a command that will do the drill down from the root folder?

有帮助吗?

解决方案

You can concatenate all of the *.m files into one file and then call the genstrings on that.

I.E:

find . -name "*.m" -exec cat {} >> all.txt \;

其他提示

In Greenwich we use find piped to xargs. You can see how that's done here, but it's basically:

find "path/to/directory" -name "*.m" -print0 |
  xargs -0 genstrings -s NSLocalizedString -o "path/to/output.strings"

I'd also recommend taking a look at Greenwich as it makes the whole process of localization much easier.

if you have a simple folder struct you probably get away with a simple

genstrings -ao <destination> <root>/*/*.m

using one * for each level of subfolder.

Alternatively and if the folders have different nesting levels you are better off using:

  find <root>/* -iname "*.m"  -type f -print0 | xargs -0 genstrings -ao <destination>

For me, this line just solved all problems. You even don't need to copy all m-Files to one document, before running the line in the shell. Just step into your project folder and run it, and all even the subfolders will be checked:

find . -name \*.m | xargs genstrings -o "directory/"

just create the directory before running it, otherwise you get an exception.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top