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 3f79d36489
commit 68b413af5f
3 changed files with 9 additions and 10 deletions

1
.gitignore vendored
View File

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

View File

@ -293,7 +293,7 @@ GetText.add('Encrypt entire stream', '${escape(_("Encrypt entire stream"))}')
// EncryptionPage.js:41 // EncryptionPage.js:41
GetText.add('Encryption', '${escape(_("Encryption"))}') GetText.add('Encryption', '${escape(_("Encryption"))}')
// ConnectionManager.js:308, ConnectionManager.js:364, AddConnectionWindow.js:103, AddWindow.js:208 // ConnectionManager.js:308, ConnectionManager.js:364, AddConnectionWindow.js:103, AddWindow.js:209
GetText.add('Error', '${escape(_("Error"))}') GetText.add('Error', '${escape(_("Error"))}')
// Menus.js:247 // Menus.js:247
@ -506,7 +506,7 @@ GetText.add('Normal Priority', '${escape(_("Normal Priority"))}')
// Statusbar.js:39 // Statusbar.js:39
GetText.add('Not Connected', '${escape(_("Not Connected"))}') GetText.add('Not Connected', '${escape(_("Not Connected"))}')
// AddWindow.js:209 // AddWindow.js:210
GetText.add('Not a valid torrent', '${escape(_("Not a valid torrent"))}') GetText.add('Not a valid torrent', '${escape(_("Not a valid torrent"))}')
// ConnectionManager.js:180, ConnectionManager.js:188 // ConnectionManager.js:180, ConnectionManager.js:188
@ -611,7 +611,7 @@ GetText.add('Rate limit IP overhead', '${escape(_("Rate limit IP overhead"))}')
// TorrentGrid.js:162 // TorrentGrid.js:162
GetText.add('Ratio', '${escape(_("Ratio"))}') GetText.add('Ratio', '${escape(_("Ratio"))}')
// EditTrackersWindow.js:122, ConnectionManager.js:107, Toolbar.js:64, AddWindow.js:111 // EditTrackersWindow.js:122, ConnectionManager.js:107, Toolbar.js:64, AddWindow.js:112
GetText.add('Remove', '${escape(_("Remove"))}') GetText.add('Remove', '${escape(_("Remove"))}')
// Menus.js:224, RemoveWindow.js:39, RemoveWindow.js:57 // Menus.js:224, RemoveWindow.js:39, RemoveWindow.js:57
@ -827,4 +827,3 @@ GetText.add('Your password was successfully changed!', '${escape(_("Your passwor
// InterfacePage.js:200 // InterfacePage.js:200
GetText.add('Your passwords don\'t match!', '${escape(_("Your passwords don\'t match!"))}') GetText.add('Your passwords don\'t match!', '${escape(_("Your passwords don\'t match!"))}')