On Aug 5, 2014, at 5:03 PM, Daryle Walker <[email protected]> wrote: > If I change my localizable code from NSLocalizedString(@“My Key”, @“My > Comment”) to NSLocalizedStringFromTable(@“My Key”, @“My Table”, @“My > Comment”), can I use the class name as the table name via a macro? If I have > a object type “MyClass" in “MyClass.m," do I have to use @“MyClass” directly, > or can I hide it between a macro constant? A macro function? A full-blown > Objective-C expression? Is the genstrings program smart enough to handle > "NSStringFromClass([self class])"?
I don't believe it will do any of those things. It doesn't preprocess your code, let alone compile it or run it. The expression [self class] is a run-time expression. It doesn't even reliably correspond to MyClass just because it's in a method defined on MyClass. That method may have been invoked on an instance of a subclass, for example. genstrings is a pretty "dumb" text processor. Among other things, it will find uses of NSLocalizedString and friends inside of comments, which is a useful feature. You have to use string literals. (For some things, like the comment parameter, it actually doesn't even matter if it's a C string literal or an Objective-C string literal.) I haven't tested but, if you use a macro, it would either ignore that instance of NSLocalizedStringFromTable as one it doesn't understand or, possibly, it would treat the macro _name_ as the table name. Regards, Ken _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
