[WebUI] Fix i18n issue in Connection Manager

The status strings were incorrectly marked for translation which when combined with
some translations using 'connected' and 'online' as the same word resulted in
users being unabe to connect to running daemon.

 * Removed translation markup from json_api but left as original capitalised word in
case other third-party scripts do comparison on these status strings.
 * Added translation markup prior to displaying ConnectionManager using template.
 * Reworded password prompt and added translation markup.
 * Update gettext.js
This commit is contained in:
Calum Lind 2015-08-20 00:55:10 +01:00
parent 0516e3df45
commit 123dd8f011
3 changed files with 48 additions and 31 deletions

View File

@ -80,7 +80,7 @@ GetText.add('80 KiB/s', '${escape(_("80 KiB/s"))}')
// QueuePage.js:69
GetText.add('Active Torrents', '${escape(_("Active Torrents"))}')
// EditTrackersWindow.js:112, ConnectionManager.js:100, AddConnectionWindow.js:56, Toolbar.js:58, AddTrackerWindow.js:57, UrlWindow.js:50, FileWindow.js:53, AddWindow.js:52
// EditTrackersWindow.js:112, ConnectionManager.js:110, AddConnectionWindow.js:56, Toolbar.js:58, AddTrackerWindow.js:57, UrlWindow.js:50, FileWindow.js:53, AddWindow.js:52
GetText.add('Add', '${escape(_("Add"))}')
// AddConnectionWindow.js:40
@ -167,6 +167,9 @@ GetText.add('Certificate', '${escape(_("Certificate"))}')
// InterfacePage.js:117
GetText.add('Change', '${escape(_("Change"))}')
// ConnectionManager.js:284
GetText.add('Change Default Password', '${escape(_("Change Default Password"))}')
// InterfacePage.js:224
GetText.add('Change Successful', '${escape(_("Change Successful"))}')
@ -182,10 +185,10 @@ GetText.add('Compact', '${escape(_("Compact"))}')
// InterfacePage.js:105
GetText.add('Confirm Password', '${escape(_("Confirm Password"))}')
// ConnectionManager.js:55, ConnectionManager.js:184
// ConnectionManager.js:55, ConnectionManager.js:193
GetText.add('Connect', '${escape(_("Connect"))}')
// ConnectionManager.js:177, ConnectionManager.js:225
// ConnectionManager.js:79
GetText.add('Connected', '${escape(_("Connected"))}')
// Menus.js:142
@ -233,10 +236,10 @@ GetText.add('Details', '${escape(_("Details"))}')
// EncryptionPage.js:65, EncryptionPage.js:82
GetText.add('Disabled', '${escape(_("Disabled"))}')
// ConnectionManager.js:179
// ConnectionManager.js:188
GetText.add('Disconnect', '${escape(_("Disconnect"))}')
// Menus.js:257, Deluge.js:156
// Menus.js:257, Deluge.js:163
GetText.add('Do Not Download', '${escape(_("Do Not Download"))}')
// QueuePage.js:107
@ -293,7 +296,7 @@ GetText.add('Encrypt entire stream', '${escape(_("Encrypt entire stream"))}')
// EncryptionPage.js:41
GetText.add('Encryption', '${escape(_("Encryption"))}')
// ConnectionManager.js:308, ConnectionManager.js:364, AddConnectionWindow.js:103, UrlWindow.js:116, FileWindow.js:103, AddWindow.js:211
// ConnectionManager.js:316, ConnectionManager.js:372, AddConnectionWindow.js:103, UrlWindow.js:116, FileWindow.js:103, AddWindow.js:211
GetText.add('Error', '${escape(_("Error"))}')
// Menus.js:253
@ -371,16 +374,16 @@ GetText.add('Hash', '${escape(_("Hash"))}')
// Toolbar.js:107
GetText.add('Help', '${escape(_("Help"))}')
// Menus.js:267, Deluge.js:158
// Menus.js:267, Deluge.js:165
GetText.add('High Priority', '${escape(_("High Priority"))}')
// Menus.js:272, Deluge.js:159
// Menus.js:272, Deluge.js:166
GetText.add('Highest Priority', '${escape(_("Highest Priority"))}')
// FileBrowser.js:56
GetText.add('Home', '${escape(_("Home"))}')
// ConnectionManager.js:74, AddConnectionWindow.js:66, ProxyField.js:74
// ConnectionManager.js:84, AddConnectionWindow.js:66, ProxyField.js:74
GetText.add('Host', '${escape(_("Host"))}')
// BandwidthPage.js:122
@ -509,7 +512,7 @@ GetText.add('New Password', '${escape(_("New Password"))}')
// ProxyField.js:55
GetText.add('None', '${escape(_("None"))}')
// Menus.js:262, Deluge.js:157
// Menus.js:262, Deluge.js:164
GetText.add('Normal Priority', '${escape(_("Normal Priority"))}')
// Statusbar.js:39
@ -518,7 +521,7 @@ GetText.add('Not Connected', '${escape(_("Not Connected"))}')
// AddWindow.js:212
GetText.add('Not a valid torrent', '${escape(_("Not a valid torrent"))}')
// ConnectionManager.js:180, ConnectionManager.js:188
// ConnectionManager.js:76
GetText.add('Offline', '${escape(_("Offline"))}')
// EditTrackersWindow.js:57, OtherLimitWindow.js:73, PreferencesWindow.js:108
@ -527,6 +530,9 @@ GetText.add('Ok', '${escape(_("Ok"))}')
// InterfacePage.js:97
GetText.add('Old Password', '${escape(_("Old Password"))}')
// ConnectionManager.js:73
GetText.add('Online', '${escape(_("Online"))}')
// Menus.js:99, OptionsTab.js:49, OptionsTab.js:40, DownloadsPage.js:129
GetText.add('Options', '${escape(_("Options"))}')
@ -620,7 +626,7 @@ GetText.add('Rate limit IP overhead', '${escape(_("Rate limit IP overhead"))}')
// TorrentGrid.js:162
GetText.add('Ratio', '${escape(_("Ratio"))}')
// EditTrackersWindow.js:122, ConnectionManager.js:107, Toolbar.js:64, AddWindow.js:112
// EditTrackersWindow.js:122, ConnectionManager.js:117, Toolbar.js:64, AddWindow.js:112
GetText.add('Remove', '${escape(_("Remove"))}')
// Menus.js:230, RemoveWindow.js:39, RemoveWindow.js:57
@ -701,7 +707,7 @@ GetText.add('Socksv5', '${escape(_("Socksv5"))}')
// ProxyField.js:58
GetText.add('Socksv5 with Auth', '${escape(_("Socksv5 with Auth"))}')
// ConnectionManager.js:191
// ConnectionManager.js:200
GetText.add('Start Daemon', '${escape(_("Start Daemon"))}')
// Sidebar.js:34
@ -710,7 +716,7 @@ GetText.add('State', '${escape(_("State"))}')
// ConnectionManager.js:68, StatusTab.js:39, DetailsTab.js:52
GetText.add('Status', '${escape(_("Status"))}')
// ConnectionManager.js:115, ConnectionManager.js:197, ConnectionManager.js:328
// ConnectionManager.js:125, ConnectionManager.js:206, ConnectionManager.js:336
GetText.add('Stop Daemon', '${escape(_("Stop Daemon"))}')
// OptionsTab.js:225
@ -815,9 +821,12 @@ GetText.add('Use SSL (paths relative to Deluge config folder)', '${escape(_("Use
// AddConnectionWindow.js:83, ProxyField.js:93
GetText.add('Username', '${escape(_("Username"))}')
// ConnectionManager.js:80
// ConnectionManager.js:90
GetText.add('Version', '${escape(_("Version"))}')
// ConnectionManager.js:285
GetText.add('We recommend changing the default password. Would you like to change it now?', '${escape(_("We recommend changing the default password. Would you like to change it now?"))}')
// ProxyPage.js:58
GetText.add('Web Seed', '${escape(_("Web Seed"))}')

View File

@ -68,6 +68,16 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
header: _('Status'),
width: .24,
sortable: true,
tpl: new Ext.XTemplate(
'<tpl if="status == \'Online\'">',
_('Online'),
'</tpl>',
'<tpl if="status == \'Offline\'">',
_('Offline'),
'</tpl>',
'<tpl if="status == \'Connected\'">',
_('Connected'),
'</tpl>'),
dataIndex: 'status'
}, {
id:'host',
@ -172,12 +182,11 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
*/
updateButtons: function(record) {
var button = this.buttons[1], status = record.get('status');
// Update the Connect/Disconnect button
if (status == _('Connected')) {
if (status == 'Connected') {
button.enable();
button.setText(_('Disconnect'));
} else if (status == _('Offline')) {
} else if (status == 'Offline') {
button.disable();
} else {
button.enable();
@ -185,7 +194,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
}
// Update the Stop/Start Daemon button
if (status == _('Offline')) {
if (status == 'Offline') {
if (record.get('host') == '127.0.0.1' || record.get('host') == 'localhost') {
this.stopHostButton.enable();
this.stopHostButton.setText(_('Start Daemon'));
@ -222,7 +231,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
var selected = this.list.getSelectedRecords()[0];
if (!selected) return;
if (selected.get('status') == _('Connected')) {
if (selected.get('status') == 'Connected') {
deluge.client.web.disconnect({
success: function(result) {
this.update(this);
@ -272,10 +281,9 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
// private
onLogin: function() {
if (deluge.config.first_login) {
Ext.MessageBox.confirm('Change password',
'As this is your first login, we recommend that you ' +
'change your password. Would you like to ' +
'do this now?', function(res) {
Ext.MessageBox.confirm(_('Change Default Password'),
_('We recommend changing the default password.<br><br>Would you like to change it now?'),
function(res) {
this.checkConnected();
if (res == 'yes') {
deluge.preferences.show();

View File

@ -780,7 +780,7 @@ class WebApi(JSONComponent):
Return the hosts in the hostlist.
"""
log.debug("get_hosts called")
return [(tuple(host[HOSTS_ID:HOSTS_PORT+1]) + (_("Offline"),)) for host in self.host_list["hosts"]]
return [(tuple(host[HOSTS_ID:HOSTS_PORT+1]) + ("Offline",)) for host in self.host_list["hosts"]]
@export
def get_host_status(self, host_id):
@ -799,32 +799,32 @@ class WebApi(JSONComponent):
except TypeError, e:
host = None
port = None
return response(_("Offline"))
return response("Offline")
def on_connect(connected, c, host_id):
def on_info(info, c):
c.disconnect()
return response(_("Online"), info)
return response("Online", info)
def on_info_fail(reason, c):
c.disconnect()
return response(_("Offline"))
return response("Offline")
if not connected:
return response(_("Offline"))
return response("Offline")
return c.daemon.info(
).addCallback(on_info, c
).addErrback(on_info_fail, c)
def on_connect_failed(reason, host_id):
return response(_("Offline"))
return response("Offline")
if client.connected() and (host, port, "localclient" if not
user and host in ("127.0.0.1", "localhost") else
user) == client.connection_info():
def on_info(info):
return response(_("Connected"), info)
return response("Connected", info)
return client.daemon.info().addCallback(on_info)
else: