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.
This commit is contained in:
Damien Churchill 2012-01-09 21:58:20 +00:00
parent e1745443bf
commit 81fc47d080

View File

@ -41,14 +41,21 @@ function _(string) {
""" """
files = glob.glob('js/Deluge*.js') for root, dnames, files in os.walk('js/deluge-all'):
for filename in files: for filename in files:
for line_num, line in enumerate(open(filename)): if filename.startswith('.'):
for match in string_re.finditer(line): continue
string = match.group(1) if not filename.endswith('.js'):
locations = strings.get(string, []) continue
locations.append((os.path.basename(filename), line_num + 1))
strings[string] = locations 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 = strings.keys()
keys.sort() keys.sort()