From 5442beba8b5759f6ee2a243f594642942036fdc4 Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Sun, 22 Jul 2018 17:00:30 +1000 Subject: [PATCH] Fix check_lacked_trans.py script to check subfolders and also match on more than first occurrence of strings._ in a single line --- install/check_lacked_trans.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/install/check_lacked_trans.py b/install/check_lacked_trans.py index 3313db7c..57568b1a 100644 --- a/install/check_lacked_trans.py +++ b/install/check_lacked_trans.py @@ -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,11 +64,11 @@ 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('''"' ''') - translate_keys.add(key) + for match in m: + key = match.split(',')[0].strip('''"' ''') + translate_keys.add(key) if args.show_all_keys: for k in sorted(translate_keys):