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 f8651b63c8
commit aa726f723b
1 changed files with 15 additions and 8 deletions

View File

@ -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()