Fix unused_string.py uses python interpreter.

Closes #1081
// FREEBIE
pull/1/head
Michael Kirk 10 years ago committed by Frederic Jacobs
parent bd377e65af
commit b809890322

@ -1,9 +1,10 @@
#!/usr/bin/env sh #!/usr/bin/env python
""" """
This script can be used to grep the source to tree to see which localized strings are in use. This script can be used to grep the source to tree to see which localized strings are in use.
author: corbett author: corbett
usage: ./unused_strings.py Localizable.strings source_dir usage: ./unused_strings.py Localizable.strings source_dir
eg: ./unused_strings.py ../Signal/translations/en.lproj/Localizable.strings ../Signal/src
""" """
import sys import sys
import os import os
@ -32,10 +33,13 @@ def rgrep_match(dir_name, s_pat):
if match: if match:
return match return match
return False return False
if __name__ == '__main__': if __name__ == '__main__':
for item in open(sys.argv[1]).readlines(): strings_file = sys.argv[1]
grep_for=item.strip().split(' = ')[0].replace('"','') src_dir_name = sys.argv[2]
if rgrep_match(sys.argv[2],grep_for):
for item in open(strings_file).readlines():
grep_for = item.strip().split(' = ')[0].replace('"','')
if rgrep_match(src_dir_name, grep_for):
print item.strip() print item.strip()

Loading…
Cancel
Save