mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-03 07:03:39 +00:00
Minor gettext script improvements
This commit is contained in:
parent
9aed7a7f0c
commit
f32c8aff90
@ -1,10 +1,9 @@
|
||||
GetText={maps:{}, add:function(string,translation) {this.maps[string]=translation}, get:function(string) {if (this.maps[string]) {string=this.maps[string]} return string}}
|
||||
function _(string) {return GetText.get(string)}
|
||||
GetText.add('10 KiB/s','${escape(_("10 KiB/s"))}')
|
||||
GetText={maps:{},add:function(string,translation){this.maps[string]=translation},get:function(string){if (this.maps[string]){string=this.maps[string]} return string}};function _(string){return GetText.get(string)}GetText.add('10 KiB/s','${escape(_("10 KiB/s"))}')
|
||||
GetText.add('30 KiB/s','${escape(_("30 KiB/s"))}')
|
||||
GetText.add('300 KiB/s','${escape(_("300 KiB/s"))}')
|
||||
GetText.add('5 KiB/s','${escape(_("5 KiB/s"))}')
|
||||
GetText.add('80 KiB/s','${escape(_("80 KiB/s"))}')
|
||||
GetText.add('<b>IP</b> {0}','${escape(_("<b>IP</b> {0}"))}')
|
||||
GetText.add('Active','${escape(_("Active"))}')
|
||||
GetText.add('Active Torrents','${escape(_("Active Torrents"))}')
|
||||
GetText.add('Add','${escape(_("Add"))}')
|
||||
@ -15,13 +14,13 @@ GetText.add('Add Tracker','${escape(_("Add Tracker"))}')
|
||||
GetText.add('Add from Url','${escape(_("Add from Url"))}')
|
||||
GetText.add('Add torrents in Paused state','${escape(_("Add torrents in Paused state"))}')
|
||||
GetText.add('Added','${escape(_("Added"))}')
|
||||
GetText.add('Address','${escape(_("Address"))}')
|
||||
GetText.add('All','${escape(_("All"))}')
|
||||
GetText.add('Allocating','${escape(_("Allocating"))}')
|
||||
GetText.add('Allow Remote Connections','${escape(_("Allow Remote Connections"))}')
|
||||
GetText.add('Allow the use of multiple filters at once','${escape(_("Allow the use of multiple filters at once"))}')
|
||||
GetText.add('Announce OK','${escape(_("Announce OK"))}')
|
||||
GetText.add('Announce Sent','${escape(_("Announce Sent"))}')
|
||||
GetText.add('Anonymous Mode','${escape(_("Anonymous Mode"))}')
|
||||
GetText.add('Apply','${escape(_("Apply"))}')
|
||||
GetText.add('Author Email:','${escape(_("Author Email:"))}')
|
||||
GetText.add('Author:','${escape(_("Author:"))}')
|
||||
@ -32,15 +31,16 @@ GetText.add('Bandwidth','${escape(_("Bandwidth"))}')
|
||||
GetText.add('Be alerted about new releases','${escape(_("Be alerted about new releases"))}')
|
||||
GetText.add('Bottom','${escape(_("Bottom"))}')
|
||||
GetText.add('Browse','${escape(_("Browse"))}')
|
||||
GetText.add('Browse...','${escape(_("Browse..."))}')
|
||||
GetText.add('Cache','${escape(_("Cache"))}')
|
||||
GetText.add('Cache Expiry (seconds):','${escape(_("Cache Expiry (seconds):"))}')
|
||||
GetText.add('Cache Size (16 KiB Blocks):','${escape(_("Cache Size (16 KiB Blocks):"))}')
|
||||
GetText.add('Cancel','${escape(_("Cancel"))}')
|
||||
GetText.add('Categories','${escape(_("Categories"))}')
|
||||
GetText.add('Certificate:','${escape(_("Certificate:"))}')
|
||||
GetText.add('Change Default Password','${escape(_("Change Default Password"))}')
|
||||
GetText.add('Change Successful','${escape(_("Change Successful"))}')
|
||||
GetText.add('Checking','${escape(_("Checking"))}')
|
||||
GetText.add('Client','${escape(_("Client"))}')
|
||||
GetText.add('Close','${escape(_("Close"))}')
|
||||
GetText.add('Comment:','${escape(_("Comment:"))}')
|
||||
GetText.add('Complete Seen','${escape(_("Complete Seen"))}')
|
||||
@ -65,8 +65,6 @@ GetText.add('Details','${escape(_("Details"))}')
|
||||
GetText.add('Details:','${escape(_("Details:"))}')
|
||||
GetText.add('Disabled','${escape(_("Disabled"))}')
|
||||
GetText.add('Disconnect','${escape(_("Disconnect"))}')
|
||||
GetText.add('Do Not Download','${escape(_("Do Not Download"))}')
|
||||
GetText.add('Do not count slow torrents','${escape(_("Do not count slow torrents"))}')
|
||||
GetText.add('Do you want to refresh the page now to use the new language?','${escape(_("Do you want to refresh the page now to use the new language?"))}')
|
||||
GetText.add('Down','${escape(_("Down"))}')
|
||||
GetText.add('Down Limit','${escape(_("Down Limit"))}')
|
||||
@ -78,6 +76,7 @@ GetText.add('Download Speed','${escape(_("Download Speed"))}')
|
||||
GetText.add('Download to:','${escape(_("Download to:"))}')
|
||||
GetText.add('Downloaded','${escape(_("Downloaded"))}')
|
||||
GetText.add('Downloading','${escape(_("Downloading"))}')
|
||||
GetText.add('Downloading:','${escape(_("Downloading:"))}')
|
||||
GetText.add('Downloads','${escape(_("Downloads"))}')
|
||||
GetText.add('ETA','${escape(_("ETA"))}')
|
||||
GetText.add('Edit','${escape(_("Edit"))}')
|
||||
@ -89,6 +88,7 @@ GetText.add('Enabled','${escape(_("Enabled"))}')
|
||||
GetText.add('Encryption','${escape(_("Encryption"))}')
|
||||
GetText.add('Error','${escape(_("Error"))}')
|
||||
GetText.add('Expand All','${escape(_("Expand All"))}')
|
||||
GetText.add('External IP Address','${escape(_("External IP Address"))}')
|
||||
GetText.add('File','${escape(_("File"))}')
|
||||
GetText.add('File Browser','${escape(_("File Browser"))}')
|
||||
GetText.add('Filename','${escape(_("Filename"))}')
|
||||
@ -96,7 +96,9 @@ GetText.add('Files','${escape(_("Files"))}')
|
||||
GetText.add('Filters','${escape(_("Filters"))}')
|
||||
GetText.add('Find More','${escape(_("Find More"))}')
|
||||
GetText.add('Folders','${escape(_("Folders"))}')
|
||||
GetText.add('Force Proxy','${escape(_("Force Proxy"))}')
|
||||
GetText.add('Force Recheck','${escape(_("Force Recheck"))}')
|
||||
GetText.add('Force Use of Proxy','${escape(_("Force Use of Proxy"))}')
|
||||
GetText.add('Forced','${escape(_("Forced"))}')
|
||||
GetText.add('Forward','${escape(_("Forward"))}')
|
||||
GetText.add('Freespace in download folder','${escape(_("Freespace in download folder"))}')
|
||||
@ -112,18 +114,18 @@ GetText.add('Hash:','${escape(_("Hash:"))}')
|
||||
GetText.add('Help','${escape(_("Help"))}')
|
||||
GetText.add('Help us improve Deluge by sending us your Python version, PyGTK version, OS and processor types. Absolutely no other information is sent.','${escape(_("Help us improve Deluge by sending us your Python version, PyGTK version, OS and processor types. Absolutely no other information is sent."))}')
|
||||
GetText.add('Hide Client Identity','${escape(_("Hide Client Identity"))}')
|
||||
GetText.add('High Priority','${escape(_("High Priority"))}')
|
||||
GetText.add('Highest Priority','${escape(_("Highest Priority"))}')
|
||||
GetText.add('High','${escape(_("High"))}')
|
||||
GetText.add('Home','${escape(_("Home"))}')
|
||||
GetText.add('Homepage:','${escape(_("Homepage:"))}')
|
||||
GetText.add('Host','${escape(_("Host"))}')
|
||||
GetText.add('Host:','${escape(_("Host:"))}')
|
||||
GetText.add('I2P Proxy','${escape(_("I2P Proxy"))}')
|
||||
GetText.add('I2P','${escape(_("I2P"))}')
|
||||
GetText.add('Ignore','${escape(_("Ignore"))}')
|
||||
GetText.add('Ignore limits on local network','${escape(_("Ignore limits on local network"))}')
|
||||
GetText.add('Ignore slow torrents','${escape(_("Ignore slow torrents"))}')
|
||||
GetText.add('Incoming Address','${escape(_("Incoming Address"))}')
|
||||
GetText.add('Incoming Ports','${escape(_("Incoming Ports"))}')
|
||||
GetText.add('Incoming Port','${escape(_("Incoming Port"))}')
|
||||
GetText.add('Incoming:','${escape(_("Incoming:"))}')
|
||||
GetText.add('Info','${escape(_("Info"))}')
|
||||
GetText.add('Infohash','${escape(_("Infohash"))}')
|
||||
GetText.add('Install','${escape(_("Install"))}')
|
||||
GetText.add('Install Plugin','${escape(_("Install Plugin"))}')
|
||||
@ -133,11 +135,15 @@ GetText.add('KiB/s','${escape(_("KiB/s"))}')
|
||||
GetText.add('LSD','${escape(_("LSD"))}')
|
||||
GetText.add('Labels','${escape(_("Labels"))}')
|
||||
GetText.add('Language','${escape(_("Language"))}')
|
||||
GetText.add('Last Transfer','${escape(_("Last Transfer"))}')
|
||||
GetText.add('Level:','${escape(_("Level:"))}')
|
||||
GetText.add('Loading','${escape(_("Loading"))}')
|
||||
GetText.add('Login','${escape(_("Login"))}')
|
||||
GetText.add('Login Failed','${escape(_("Login Failed"))}')
|
||||
GetText.add('Logout','${escape(_("Logout"))}')
|
||||
GetText.add('Lost Connection','${escape(_("Lost Connection"))}')
|
||||
GetText.add('Lost connection to webserver','${escape(_("Lost connection to webserver"))}')
|
||||
GetText.add('Low','${escape(_("Low"))}')
|
||||
GetText.add('Max Connections','${escape(_("Max Connections"))}')
|
||||
GetText.add('Max Connections:','${escape(_("Max Connections:"))}')
|
||||
GetText.add('Max Down Speed','${escape(_("Max Down Speed"))}')
|
||||
@ -164,9 +170,10 @@ GetText.add('Name:','${escape(_("Name:"))}')
|
||||
GetText.add('Network','${escape(_("Network"))}')
|
||||
GetText.add('Network Extras','${escape(_("Network Extras"))}')
|
||||
GetText.add('Never','${escape(_("Never"))}')
|
||||
GetText.add('New Torrents','${escape(_("New Torrents"))}')
|
||||
GetText.add('New:','${escape(_("New:"))}')
|
||||
GetText.add('None','${escape(_("None"))}')
|
||||
GetText.add('Normal Priority','${escape(_("Normal Priority"))}')
|
||||
GetText.add('Normal','${escape(_("Normal"))}')
|
||||
GetText.add('Not Connected','${escape(_("Not Connected"))}')
|
||||
GetText.add('Not a valid torrent','${escape(_("Not a valid torrent"))}')
|
||||
GetText.add('OK','${escape(_("OK"))}')
|
||||
@ -184,6 +191,7 @@ GetText.add('Password','${escape(_("Password"))}')
|
||||
GetText.add('Password:','${escape(_("Password:"))}')
|
||||
GetText.add('Path:','${escape(_("Path:"))}')
|
||||
GetText.add('Pause','${escape(_("Pause"))}')
|
||||
GetText.add('Pause torrent','${escape(_("Pause torrent"))}')
|
||||
GetText.add('Paused','${escape(_("Paused"))}')
|
||||
GetText.add('Peer Exchange','${escape(_("Peer Exchange"))}')
|
||||
GetText.add('Peer TOS Byte:','${escape(_("Peer TOS Byte:"))}')
|
||||
@ -197,7 +205,7 @@ GetText.add('Port','${escape(_("Port"))}')
|
||||
GetText.add('Port:','${escape(_("Port:"))}')
|
||||
GetText.add('Pre-allocate disk space','${escape(_("Pre-allocate disk space"))}')
|
||||
GetText.add('Preallocate Disk Space','${escape(_("Preallocate Disk Space"))}')
|
||||
GetText.add('Prefer Seeding over Downloading','${escape(_("Prefer Seeding over Downloading"))}')
|
||||
GetText.add('Prefer seeding torrents','${escape(_("Prefer seeding torrents"))}')
|
||||
GetText.add('Preferences','${escape(_("Preferences"))}')
|
||||
GetText.add('Prioritize First/Last','${escape(_("Prioritize First/Last"))}')
|
||||
GetText.add('Prioritize First/Last Pieces','${escape(_("Prioritize First/Last Pieces"))}')
|
||||
@ -209,10 +217,11 @@ GetText.add('Progress','${escape(_("Progress"))}')
|
||||
GetText.add('Protocol Traffic Download/Upload','${escape(_("Protocol Traffic Download/Upload"))}')
|
||||
GetText.add('Proxy','${escape(_("Proxy"))}')
|
||||
GetText.add('Proxy Hostnames','${escape(_("Proxy Hostnames"))}')
|
||||
GetText.add('Proxy Peer Connections','${escape(_("Proxy Peer Connections"))}')
|
||||
GetText.add('Proxy Peers','${escape(_("Proxy Peers"))}')
|
||||
GetText.add('Proxy Trackers','${escape(_("Proxy Trackers"))}')
|
||||
GetText.add('Public','${escape(_("Public"))}')
|
||||
GetText.add('Queue','${escape(_("Queue"))}')
|
||||
GetText.add('Queue new torrents to top','${escape(_("Queue new torrents to top"))}')
|
||||
GetText.add('Queue to top','${escape(_("Queue to top"))}')
|
||||
GetText.add('Queued','${escape(_("Queued"))}')
|
||||
GetText.add('Rate limit IP overhead','${escape(_("Rate limit IP overhead"))}')
|
||||
GetText.add('Ratio','${escape(_("Ratio"))}')
|
||||
@ -222,11 +231,12 @@ GetText.add('Remove','${escape(_("Remove"))}')
|
||||
GetText.add('Remove Torrent','${escape(_("Remove Torrent"))}')
|
||||
GetText.add('Remove With Data','${escape(_("Remove With Data"))}')
|
||||
GetText.add('Remove at ratio','${escape(_("Remove at ratio"))}')
|
||||
GetText.add('Remove torrent when share ratio is reached','${escape(_("Remove torrent when share ratio is reached"))}')
|
||||
GetText.add('Remove torrent','${escape(_("Remove torrent"))}')
|
||||
GetText.add('Resume','${escape(_("Resume"))}')
|
||||
GetText.add('Save','${escape(_("Save"))}')
|
||||
GetText.add('Seed Time (m):','${escape(_("Seed Time (m):"))}')
|
||||
GetText.add('Seeding','${escape(_("Seeding"))}')
|
||||
GetText.add('Seeding Rotation','${escape(_("Seeding Rotation"))}')
|
||||
GetText.add('Seeding:','${escape(_("Seeding:"))}')
|
||||
GetText.add('Seeds','${escape(_("Seeds"))}')
|
||||
GetText.add('Seeds:Peers','${escape(_("Seeds:Peers"))}')
|
||||
GetText.add('Select an egg','${escape(_("Select an egg"))}')
|
||||
@ -238,8 +248,8 @@ GetText.add('Set Maximum Connections','${escape(_("Set Maximum Connections"))}')
|
||||
GetText.add('Set Maximum Download Speed','${escape(_("Set Maximum Download Speed"))}')
|
||||
GetText.add('Set Maximum Upload Speed','${escape(_("Set Maximum Upload Speed"))}')
|
||||
GetText.add('Settings','${escape(_("Settings"))}')
|
||||
GetText.add('Share Ratio Limit:','${escape(_("Share Ratio Limit:"))}')
|
||||
GetText.add('Share Time Ratio:','${escape(_("Share Time Ratio:"))}')
|
||||
GetText.add('Share Ratio Reached','${escape(_("Share Ratio Reached"))}')
|
||||
GetText.add('Share Ratio:','${escape(_("Share Ratio:"))}')
|
||||
GetText.add('Shared','${escape(_("Shared"))}')
|
||||
GetText.add('Show filters with zero torrents','${escape(_("Show filters with zero torrents"))}')
|
||||
GetText.add('Show session speed in titlebar','${escape(_("Show session speed in titlebar"))}')
|
||||
@ -255,19 +265,18 @@ GetText.add('Status','${escape(_("Status"))}')
|
||||
GetText.add('Status:','${escape(_("Status:"))}')
|
||||
GetText.add('Stop Daemon','${escape(_("Stop Daemon"))}')
|
||||
GetText.add('Stop seed at ratio:','${escape(_("Stop seed at ratio:"))}')
|
||||
GetText.add('Stop seeding when share ratio reaches:','${escape(_("Stop seeding when share ratio reaches:"))}')
|
||||
GetText.add('System Default','${escape(_("System Default"))}')
|
||||
GetText.add('System Information','${escape(_("System Information"))}')
|
||||
GetText.add('The connection to the webserver has been lost!','${escape(_("The connection to the webserver has been lost!"))}')
|
||||
GetText.add('Tier','${escape(_("Tier"))}')
|
||||
GetText.add('Time (m):','${escape(_("Time (m):"))}')
|
||||
GetText.add('Time Ratio:','${escape(_("Time Ratio:"))}')
|
||||
GetText.add('To:','${escape(_("To:"))}')
|
||||
GetText.add('Top','${escape(_("Top"))}')
|
||||
GetText.add('Total Active Downloading:','${escape(_("Total Active Downloading:"))}')
|
||||
GetText.add('Total Active Seeding:','${escape(_("Total Active Seeding:"))}')
|
||||
GetText.add('Total Active:','${escape(_("Total Active:"))}')
|
||||
GetText.add('Total Files:','${escape(_("Total Files:"))}')
|
||||
GetText.add('Total Size:','${escape(_("Total Size:"))}')
|
||||
GetText.add('Total:','${escape(_("Total:"))}')
|
||||
GetText.add('Tracker','${escape(_("Tracker"))}')
|
||||
GetText.add('Tracker Exchange','${escape(_("Tracker Exchange"))}')
|
||||
GetText.add('Tracker Host','${escape(_("Tracker Host"))}')
|
||||
GetText.add('Tracker:','${escape(_("Tracker:"))}')
|
||||
GetText.add('Trackers','${escape(_("Trackers"))}')
|
||||
@ -276,6 +285,7 @@ GetText.add('Type Of Service','${escape(_("Type Of Service"))}')
|
||||
GetText.add('Type:','${escape(_("Type:"))}')
|
||||
GetText.add('U/L Speed Limit','${escape(_("U/L Speed Limit"))}')
|
||||
GetText.add('UPnP','${escape(_("UPnP"))}')
|
||||
GetText.add('Unable to add host: {0}','${escape(_("Unable to add host: {0}"))}')
|
||||
GetText.add('Unlimited','${escape(_("Unlimited"))}')
|
||||
GetText.add('Up','${escape(_("Up"))}')
|
||||
GetText.add('Up Limit','${escape(_("Up Limit"))}')
|
||||
@ -288,6 +298,7 @@ GetText.add('Uploaded','${escape(_("Uploaded"))}')
|
||||
GetText.add('Uploading your plugin...','${escape(_("Uploading your plugin..."))}')
|
||||
GetText.add('Uploading your torrent...','${escape(_("Uploading your torrent..."))}')
|
||||
GetText.add('Url','${escape(_("Url"))}')
|
||||
GetText.add('Use Random Port','${escape(_("Use Random Port"))}')
|
||||
GetText.add('Use Random Ports','${escape(_("Use Random Ports"))}')
|
||||
GetText.add('Username:','${escape(_("Username:"))}')
|
||||
GetText.add('Version','${escape(_("Version"))}')
|
||||
|
@ -66,32 +66,34 @@ def check_missing_markup(js_dir):
|
||||
return strings
|
||||
|
||||
|
||||
GETTEXT_TPL = (
|
||||
'GetText={maps:{},'
|
||||
'add:function(string,translation){this.maps[string]=translation},'
|
||||
'get:function(string){if (this.maps[string]){string=this.maps[string]} return string}};'
|
||||
'function _(string){return GetText.get(string)}')
|
||||
|
||||
|
||||
def create_gettext_js(js_dir):
|
||||
string_re = re.compile('_\\(\'(.*?)\'\\)')
|
||||
strings = {}
|
||||
for root, dnames, files in os.walk(js_dir):
|
||||
for filename in files:
|
||||
if os.path.splitext(filename)[1] != '.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
|
||||
|
||||
gettext_tpl = (
|
||||
'GetText={maps:{},'
|
||||
'add:function(string,translation){this.maps[string]=translation},'
|
||||
'get:function(string){if (this.maps[string]){string=this.maps[string]} return string}};'
|
||||
'function _(string){return GetText.get(string)}')
|
||||
if filename.endswith('.js'):
|
||||
filepath = os.path.join(root, filename)
|
||||
with open(os.path.join(root, filename)) as _file:
|
||||
for lineno, line in enumerate(_file, 1):
|
||||
for match in string_re.finditer(line):
|
||||
string = match.group(1)
|
||||
locations = strings.get(string, [])
|
||||
locations.append((filepath, lineno))
|
||||
strings[string] = locations
|
||||
|
||||
gettext_file = os.path.join(os.path.dirname(js_dir), 'gettext.js')
|
||||
with open(gettext_file, 'w') as fp:
|
||||
fp.write(gettext_tpl)
|
||||
fp.write(GETTEXT_TPL)
|
||||
for key in sorted(strings):
|
||||
if DEBUG:
|
||||
fp.write('\n// %s\n' % ', '.join(['%s:%s' % x for x in strings[key]]))
|
||||
fp.write('\n//: %s' % '//: '.join(['%s:%s\n' % x for x in strings[key]]))
|
||||
fp.write('''GetText.add('%(key)s','${escape(_("%(key)s"))}')\n''' % locals())
|
||||
return gettext_file
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user