How to extract strings from a .m file for localization

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

I found some solutions by googling

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

      

this one is only retrieve string if i use NSLocalizedStringFromTable as below

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

      

I just make a text like NSString * test = @ "test string". Thus, all the text was not extracted from this command.

And the following command just fetches the line in the XIB file

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

      

I want to extract the entire line from the .m file automatically. How can i do this?

+3


source to share


1 answer


ibtool

only considers strings wrapped in a macro NSLocalizedString

, as the localization function requires this macro.



+1


source







All Articles