mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-07 08:58:38 +00:00
Updates to web gen_gettext script and add .build_data to gitignore
This commit is contained in:
parent
f016160c62
commit
d6d1cc5f45
3 changed files with 336 additions and 256 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -9,3 +9,4 @@ dist
|
||||||
_trial_temp
|
_trial_temp
|
||||||
deluge/i18n/*/
|
deluge/i18n/*/
|
||||||
*.desktop
|
*.desktop
|
||||||
|
.build_data
|
||||||
|
|
11
deluge/ui/web/gen_gettext.py
Normal file → Executable file
11
deluge/ui/web/gen_gettext.py
Normal file → Executable file
|
@ -2,15 +2,14 @@
|
||||||
"""
|
"""
|
||||||
Script to go through the javascript files and dynamically generate gettext.js
|
Script to go through the javascript files and dynamically generate gettext.js
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import glob
|
|
||||||
import cStringIO as StringIO
|
|
||||||
|
|
||||||
|
output_file = "gettext.js"
|
||||||
string_re = re.compile('_\\(\'(.*?)\'\\)')
|
string_re = re.compile('_\\(\'(.*?)\'\\)')
|
||||||
strings = {}
|
strings = {}
|
||||||
|
|
||||||
|
|
||||||
gettext_tpl = """## -*- coding: utf-8 -*-
|
gettext_tpl = """## -*- coding: utf-8 -*-
|
||||||
/*
|
/*
|
||||||
* Script: gettext.js
|
* Script: gettext.js
|
||||||
|
@ -59,10 +58,10 @@ for root, dnames, files in os.walk('js/deluge-all'):
|
||||||
keys = strings.keys()
|
keys = strings.keys()
|
||||||
keys.sort()
|
keys.sort()
|
||||||
|
|
||||||
fp = StringIO.StringIO()
|
fp = open(output_file, 'w')
|
||||||
fp.write(gettext_tpl)
|
fp.write(gettext_tpl)
|
||||||
for key in keys:
|
for key in keys:
|
||||||
fp.write('// %s\n' % ', '.join(map(lambda x: '%s:%s' % x, strings[key])))
|
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.write("GetText.add('%(key)s', '${escape(_(\"%(key)s\"))}')\n\n" % locals())
|
||||||
fp.seek(0)
|
fp.close()
|
||||||
print fp.read()
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue