Scrungepipes
Scrungepipes

Reputation: 37600

genstrings only finding 5 out of about 100 instances of NSLocalizedString

I have about 100 instances where I'm using NSLocalizedString spread through multiple files in multiple directories.

I first tried to use this command from a high level directory to generate the .strings file:

find . -name \*.m | xargs genstrings -o en.lproj

But that resulted in the error:

couldn't connect to output directory en.lproj

So I just ran this:

find . -name \*.m | xargs genstrings

This generated a Localizable.strings file but the contents of it have only picked up NSLocalizedString occurrences from 2 files - which maybe not coincidentally happen to be in the same directory.

Why would the command only process one directory and then stop. I am running the command from a higher level directory H and these source files were found in M so the command found H/M but there are peer directories to M such as H/A H/B etc. containing .m files containing NSLocalizedString instances.

Any idea why the problem could be?

Upvotes: 2

Views: 373

Answers (3)

Ethan
Ethan

Reputation: 5835

I think genstrings is breaking on folders that have names with spaces in them. This worked for me:

find . -name "*.m" -print0 | xargs -0 genstrings -o "OUTPUT_FOLDER"

Upvotes: 2

Scrungepipes
Scrungepipes

Reputation: 37600

I used cat to concatenate all the files into one, then ran genstrings on that to get.

Would be interested to know for curiosity why it didn't work without that however.

Upvotes: 0

Suhail Patel
Suhail Patel

Reputation: 13694

Make sure you have a directory called en.lproj in the directory where you are running the command from (presumably where the .xcodeproj lives). If it doesn't exist, simply create it.

Upvotes: -1

Related Questions