Skip to content
Create a gist now

Instantly share code, notes, and snippets.

extract strings from m's and xib's
find . -name *.xib | xargs ruby -ne '$_.match(/<string key="(.*)">(.*)<\/string>/){|m|puts "\"#{m[2]}\" = \"#{m[2]}\";" if m[1] =~ /IB.*Title/}'
find . -name *.m | xargs ruby -ne '$_.scan(/NSLocalizedString\s*\(\s*@"([^"]*)"\s*,[^)]*\)/){|m|puts "\"#{m[0]}\" = \"#{m[0]}\";"}'
find . -name *.m | xargs ruby -ne '$_.scan(/__\(\s*@"([^"]*)"\s*\)/){|m|puts "\"#{m[0]}\" = \"#{m[0]}\";"}'
find . -name *.m | xargs ruby -ne '$_.scan(/__\(\s*@"([^"]*)"\s*\)/){|m|puts "\"#{m[0]}\" = \"#{m[0]}\""}'
find . -name *.m | xargs ruby -ne '$_.scan(/NSLocalizedString\s*\(\s*@"([^"]*)"\s*,[^)]*\)/){|m|puts "\"#{m[0]}\" = \"#{m[0]}\""}'

.scan is used instead of .match so it matches multiple times in a single line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.