Fix check_lacked_trans.py script to check subfolders and also match on more than first occurrence of strings._ in a single line

This commit is contained in:
Miguel Jacq 2018-07-22 17:00:30 +10:00
parent e343aa194e
commit 5442beba8b
No known key found for this signature in database
GPG Key ID: EEA4341C6D97A0B6

View File

@ -54,7 +54,7 @@ def main():
dir = args.onionshare_dir
src = files_in(dir, 'onionshare') + files_in(dir, 'onionshare_gui')
src = files_in(dir, 'onionshare') + files_in(dir, 'onionshare_gui') + files_in(dir, 'onionshare_gui/share_mode') + files_in(dir, 'onionshare_gui/receive_mode') + files_in(dir, 'install/scripts')
pysrc = [p for p in src if p.endswith('.py')]
lang_code = args.lang_code
@ -64,10 +64,10 @@ def main():
for line in fileinput.input(pysrc, openhook=fileinput.hook_encoded('utf-8')):
# search `strings._('translate_key')`
# `strings._('translate_key', True)`
m = re.search(r'strings\._\((.*?)\)', line)
m = re.findall(r'strings\._\((.*?)\)', line)
if m:
arg = m.group(1)
key = arg.split(',')[0].strip('''"' ''')
for match in m:
key = match.split(',')[0].strip('''"' ''')
translate_keys.add(key)
if args.show_all_keys: