Mike
Mike

Reputation: 1132

Can genstrings work on custom #defines?

The macros iOS has for creating localized strings are pretty awesome when used with genstrings. However, I'd like to create my own #define on top of one of the macros like so:

#define MyLocalizedStringWithDefaultValue(key, tbl, val, comment) \
NSLocalizedStringWithDefaultValue(key, tbl, [NSBundle mainBundle], val, comment)
#endif

Essentially, I always want to be going against the main bundle, so I don't feel the need to type it out every time. This works great in code, but genstrings doesn't pick up my macro. Is there anything I can do to make it pick up my custom macro? I saw on the man page that there's a routine parameter that looks like what I'm trying to do, but I was unable to get it to work.

Upvotes: 7

Views: 957

Answers (1)

rmaddy
rmaddy

Reputation: 318944

Type genstrings to see the help text. Notice the -s substring option. You want something like:

genstrings -s MyLocalizedString -o someDir *.m

Upvotes: 4

Related Questions