Updates to web gen_gettext script and add .build_data to gitignore

This commit is contained in:
Calum Lind 2012-11-23 00:53:49 +00:00
parent f016160c62
commit d6d1cc5f45
3 changed files with 336 additions and 256 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ dist
_trial_temp
deluge/i18n/*/
*.desktop
.build_data

11
deluge/ui/web/gen_gettext.py Normal file → Executable file
View File

@ -2,15 +2,14 @@
"""
Script to go through the javascript files and dynamically generate gettext.js
"""
import os
import re
import glob
import cStringIO as StringIO
output_file = "gettext.js"
string_re = re.compile('_\\(\'(.*?)\'\\)')
strings = {}
gettext_tpl = """## -*- coding: utf-8 -*-
/*
* Script: gettext.js
@ -59,10 +58,10 @@ for root, dnames, files in os.walk('js/deluge-all'):
keys = strings.keys()
keys.sort()
fp = StringIO.StringIO()
fp = open(output_file, 'w')
fp.write(gettext_tpl)
for key in keys:
fp.write('// %s\n' % ', '.join(map(lambda x: '%s:%s' % x, strings[key])))
fp.write("GetText.add('%(key)s', '${escape(_(\"%(key)s\"))}')\n\n" % locals())
fp.seek(0)
print fp.read()
fp.close()

File diff suppressed because it is too large Load Diff