Eunchul Jeon
Eunchul Jeon

Reputation: 179

How to extract strings from .m file for localization

I want to extract text string from source code in IOS automatically.

I found some solutions in googling

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

this only extract string if I use NSLocalizedStringFromTable like following

NSLocalizedStringFromTable(@"Not Reachable", @"AFNetworking", nil);

I just make text like NSString* test = @"test string". So all of my text did not extracted from that command.

And Following command just extract string in XIB file

find . -name *.xib | xargs -t -I '{}' ibtool --generate-strings-file '{}'.strings '{}'

I want to extract all string from .m file automatically. How can I do that?

Upvotes: 4

Views: 887

Answers (1)

vadian
vadian

Reputation: 285250

ibtool considers only strings wrapped in the NSLocalizedString macro because the localization functionality requires this macro anyway.

Upvotes: 1

Related Questions