Workaround for js files generating warnings with generate_pot script

With xgettext set to python it will parse the comments in javascript files, so
single apostrophes or quotes are flagged as 'warning: untermined string'.

This change just rewrites js comments to not use apostrophes.
This commit is contained in:
Calum Lind 2015-08-09 16:29:03 +01:00
parent 576df1f6e3
commit a391bbd67b
9 changed files with 33 additions and 35 deletions

View File

@ -39,12 +39,12 @@
*/
Deluge.Formatters = {
/**
* Formats a date string in the locale's date representation based on the
* systems timezone.
* Formats a date string in the date representation of the current locale,
* based on the systems timezone.
*
* @param {Number} timestamp time in seconds since the Epoch
* @return {String} a string in the locale's date representation or ""
* if seconds < 0
* @param {Number} timestamp time in seconds since the Epoch.
* @return {String} a string in the date representation of the current locale
* or "" if seconds < 0.
*/
date: function(timestamp) {
function zeroPad(num, count) {

View File

@ -267,9 +267,8 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, {
},
/**
* Lets the option manager know when a field is focused so if a value
* changing operation is performed it won't change the value of the
* field.
* Lets the option manager know when a field is focused so if a value changing
* operation is performed it will not change the value of the field.
*/
onFieldFocus: function(field, event) {
this.focused = field;
@ -279,8 +278,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, {
// If we don't have a bind there's nothing to do.
if (Ext.isEmpty(this.binds[option])) return;
Ext.each(this.binds[option], function(bind) {
// The field is currently focused so we don't want to
// change it.
// The field is currently focused so we do not want to change it.
if (bind == this.focused) return;
// Set the form field to the new value.
bind.setValue(newValue);

View File

@ -149,7 +149,7 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, {
}
}
// Perform a cleanup of fitlers that aren't enabled any more
// Perform a cleanup of fitlers that are not enabled any more.
Ext.each(Ext.keys(this.panels), function(filter) {
if (Ext.keys(filters).indexOf(filter) == -1) {
// We need to remove the panel

View File

@ -1,6 +1,6 @@
/*!
* Deluge.StatusbarMenu.js
*
*
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@ -37,7 +37,7 @@ Ext.ns('Deluge');
* @extends Ext.menu.Menu
*/
Deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, {
initComponent: function() {
Deluge.StatusbarMenu.superclass.initComponent.call(this);
this.otherWin = new Deluge.OtherLimitWindow(this.initialConfig.otherWin || {});
@ -51,7 +51,7 @@ Deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, {
}
}, this);
},
setValue: function(value) {
var beenSet = false;
// set the new value
@ -67,12 +67,12 @@ Deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, {
beenSet = true;
} else {
item.setChecked(false);
}
}
item.resumeEvents();
}
}
if (item.value == 'other') other = item;
});
});
if (beenSet) return;
@ -82,7 +82,7 @@ Deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, {
},
onLimitChanged: function(item, checked) {
if (!checked || item.value == 'other') return; // we don't care about unchecks or other
if (!checked || item.value == 'other') return; // We do not care about unchecked or other.
var config = {}
config[item.group] = item.value
deluge.client.core.set_config(config, {

View File

@ -1,6 +1,6 @@
/*!
* Deluge.details.DetailsPanel.js
*
*
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@ -47,7 +47,7 @@ Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, {
this.add(new Deluge.details.PeersTab());
this.add(new Deluge.details.OptionsTab());
},
clear: function() {
this.items.each(function(panel) {
if (panel.clear) {
@ -56,42 +56,41 @@ Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, {
}
});
},
update: function(tab) {
var torrent = deluge.torrents.getSelected();
if (!torrent) {
this.clear();
return;
}
this.items.each(function(tab) {
if (tab.disabled) tab.enable();
});
tab = tab || this.getActiveTab();
if (tab.update) tab.update(torrent.id);
},
/* Event Handlers */
// We need to add the events in onRender since Deluge.Torrents hasn't
// been created yet.
// We need to add the events in onRender since Deluge.Torrents has not been created yet.
onRender: function(ct, position) {
Deluge.details.DetailsPanel.superclass.onRender.call(this, ct, position);
deluge.events.on('disconnect', this.clear, this);
deluge.torrents.on('rowclick', this.onTorrentsClick, this);
this.on('tabchange', this.onTabChange, this);
deluge.torrents.getSelectionModel().on('selectionchange', function(selModel) {
if (!selModel.hasSelection()) this.clear();
}, this);
},
onTabChange: function(panel, tab) {
this.update(tab);
},
onTorrentsClick: function(grid, rowIndex, e) {
this.update();
}

View File

@ -106,7 +106,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, {
};
for (var field in this.fields) {
if (!Ext.isDefined(data[field])) continue; // this is a field we aren't responsible for.
if (!Ext.isDefined(data[field])) continue; // This is a field we are not responsible for.
if (data[field] == this.oldData[field]) continue;
this.fields[field].dom.innerHTML = Ext.escapeHTML(data[field]);
}

View File

@ -375,7 +375,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
update: function(torrentId) {
if (this.torrentId && !torrentId) this.clear(); // we want to clear the pane if we get a null torrent torrentIds
if (!torrentId) return; // we don't care about null torrentIds
if (!torrentId) return; // We do not care about null torrentIds.
if (this.torrentId != torrentId) {
this.torrentId = torrentId;

View File

@ -150,7 +150,7 @@
}, this);
store.add(newPeers);
// Remove any peers that shouldn't be left in the store
// Remove any peers that should not be left in the store.
store.each(function(record) {
if (!addresses[record.id]) {
store.remove(record);

View File

@ -75,8 +75,9 @@ with open(infiles_list, "wb") as f:
f.write(line + "\n")
# Force xgettext language to parse javascript and update pot file
# Note: For javascript files xgettext will parse comments, so single apostrophes or quotes are
# flagged as a 'warning: untermined string'. Either ignore warning or edit javascript comment.
output = call(xgettext_cmd + ["--language=Python", "-j"])
print "====== Javascript 'unterminated string' warnings can be ignored ======"
# Replace YEAR and PACKAGE in the copyright message
with open(pot_filepath, "r") as f: