From aa726f723b14aae1ffa1c7f3e1ac3f83ba5eb651 Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Mon, 9 Jan 2012 21:58:20 +0000 Subject: [PATCH] web: fix gen_gettext script The script for generating the gettext.js file was outdated and needed a fix to work with the newer layout of the javascript source code, it was still looking for Deluge.Something files which no longer exist. --- deluge/ui/web/gen_gettext.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/deluge/ui/web/gen_gettext.py b/deluge/ui/web/gen_gettext.py index 302891817..05025aec5 100644 --- a/deluge/ui/web/gen_gettext.py +++ b/deluge/ui/web/gen_gettext.py @@ -41,14 +41,21 @@ function _(string) { """ -files = glob.glob('js/Deluge*.js') -for filename in files: - for line_num, line in enumerate(open(filename)): - for match in string_re.finditer(line): - string = match.group(1) - locations = strings.get(string, []) - locations.append((os.path.basename(filename), line_num + 1)) - strings[string] = locations +for root, dnames, files in os.walk('js/deluge-all'): + for filename in files: + if filename.startswith('.'): + continue + if not filename.endswith('.js'): + continue + + for lineno, line in enumerate(open(os.path.join(root, filename))): + for match in string_re.finditer(line): + string = match.group(1) + locations = strings.get(string, []) + locations.append((os.path.basename(filename), lineno + 1)) + strings[string] = locations + + keys = strings.keys() keys.sort()