Created
February 14, 2012 18:21
-
-
Save tralamazza/1828817 to your computer and use it in GitHub Desktop.
extract strings from m's and xib's
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| 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]}\";"}' |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.scanis used instead of.matchso it matches multiple times in a single line.