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 = { Deluge.Formatters = {
/** /**
* Formats a date string in the locale's date representation based on the * Formats a date string in the date representation of the current locale,
* systems timezone. * based on the systems timezone.
* *
* @param {Number} timestamp time in seconds since the Epoch * @param {Number} timestamp time in seconds since the Epoch.
* @return {String} a string in the locale's date representation or "" * @return {String} a string in the date representation of the current locale
* if seconds < 0 * or "" if seconds < 0.
*/ */
date: function(timestamp) { date: function(timestamp) {
function zeroPad(num, count) { 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 * Lets the option manager know when a field is focused so if a value changing
* changing operation is performed it won't change the value of the * operation is performed it will not change the value of the field.
* field.
*/ */
onFieldFocus: function(field, event) { onFieldFocus: function(field, event) {
this.focused = field; 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 we don't have a bind there's nothing to do.
if (Ext.isEmpty(this.binds[option])) return; if (Ext.isEmpty(this.binds[option])) return;
Ext.each(this.binds[option], function(bind) { Ext.each(this.binds[option], function(bind) {
// The field is currently focused so we don't want to // The field is currently focused so we do not want to change it.
// change it.
if (bind == this.focused) return; if (bind == this.focused) return;
// Set the form field to the new value. // Set the form field to the new value.
bind.setValue(newValue); 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) { Ext.each(Ext.keys(this.panels), function(filter) {
if (Ext.keys(filters).indexOf(filter) == -1) { if (Ext.keys(filters).indexOf(filter) == -1) {
// We need to remove the panel // We need to remove the panel

View File

@ -82,7 +82,7 @@ Deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, {
}, },
onLimitChanged: function(item, checked) { 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 = {} var config = {}
config[item.group] = item.value config[item.group] = item.value
deluge.client.core.set_config(config, { deluge.client.core.set_config(config, {

View File

@ -75,8 +75,7 @@ Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, {
/* Event Handlers */ /* Event Handlers */
// We need to add the events in onRender since Deluge.Torrents hasn't // We need to add the events in onRender since Deluge.Torrents has not been created yet.
// been created yet.
onRender: function(ct, position) { onRender: function(ct, position) {
Deluge.details.DetailsPanel.superclass.onRender.call(this, ct, position); Deluge.details.DetailsPanel.superclass.onRender.call(this, ct, position);
deluge.events.on('disconnect', this.clear, this); deluge.events.on('disconnect', this.clear, this);

View File

@ -106,7 +106,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, {
}; };
for (var field in this.fields) { 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; if (data[field] == this.oldData[field]) continue;
this.fields[field].dom.innerHTML = Ext.escapeHTML(data[field]); 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) { update: function(torrentId) {
if (this.torrentId && !torrentId) this.clear(); // we want to clear the pane if we get a null torrent torrentIds 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) { if (this.torrentId != torrentId) {
this.torrentId = torrentId; this.torrentId = torrentId;

View File

@ -150,7 +150,7 @@
}, this); }, this);
store.add(newPeers); 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) { store.each(function(record) {
if (!addresses[record.id]) { if (!addresses[record.id]) {
store.remove(record); store.remove(record);

View File

@ -75,8 +75,9 @@ with open(infiles_list, "wb") as f:
f.write(line + "\n") f.write(line + "\n")
# Force xgettext language to parse javascript and update pot file # 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"]) output = call(xgettext_cmd + ["--language=Python", "-j"])
print "====== Javascript 'unterminated string' warnings can be ignored ======"
# Replace YEAR and PACKAGE in the copyright message # Replace YEAR and PACKAGE in the copyright message
with open(pot_filepath, "r") as f: with open(pot_filepath, "r") as f: