Update error to use translatable text

This commit is contained in:
rejas 2021-03-16 19:16:07 +01:00
parent a269b5cd93
commit e4f671c898
6 changed files with 7 additions and 5 deletions

View File

@ -90,7 +90,7 @@ Module.register("newsfeed", {
this.loaded = true; this.loaded = true;
this.error = null; this.error = null;
} else if (notification === "INCORRECT_URL") { } else if (notification === "INCORRECT_URL") {
this.error = "Newsfeed Error. Incorrect url: " + payload.url; this.error = `Incorrect url: ${payload.url}`;
this.scheduleUpdateInterval(); this.scheduleUpdateInterval();
} }
}, },

View File

@ -23,7 +23,7 @@
</div> </div>
{% elseif error %} {% elseif error %}
<div class="small dimmed"> <div class="small dimmed">
{{ error }} {{ "MODULE_CONFIG_ERROR" | translate({MODULE_NAME: "Newsfeed", ERROR: error}) | safe }}
</div> </div>
{% else %} {% else %}
<div class="small dimmed"> <div class="small dimmed">

View File

@ -38,7 +38,7 @@ module.exports = NodeHelper.create({
try { try {
new URL(url); new URL(url);
} catch (error) { } catch (error) {
this.sendSocketNotification("INCORRECT_URL", { url }); this.sendSocketNotification("INCORRECT_URL", { url: url });
return; return;
} }

View File

@ -30,7 +30,7 @@ describe("Newsfeed module", function () {
}); });
it("should show the newsfeed title", function () { it("should show the newsfeed title", function () {
return app.client.waitUntilTextExists(".newsfeed .small", "Rodrigo Ramirez Blog", 10000).should.be.fulfilled; return app.client.waitUntilTextExists(".newsfeed .small", "Rodrigo Ramirez Blog", 10000);
}); });
}); });
@ -40,7 +40,7 @@ describe("Newsfeed module", function () {
}); });
it("should show invalid url warning", function () { it("should show invalid url warning", function () {
return app.client.waitUntilTextExists(".newsfeed .small", "Newsfeed Error. Incorrect url:", 10000).should.be.fulfilled; return app.client.waitUntilTextExists(".newsfeed .small", "Error in the Newsfeed module. Incorrect url:", 10000);
}); });
}); });
}); });

View File

@ -27,6 +27,7 @@
"NNW": "NNW", "NNW": "NNW",
"MODULE_CONFIG_CHANGED": "Die Konfigurationsoptionen für das {MODULE_NAME} Modul haben sich geändert. \nBitte überprüfen Sie die Dokumentation.", "MODULE_CONFIG_CHANGED": "Die Konfigurationsoptionen für das {MODULE_NAME} Modul haben sich geändert. \nBitte überprüfen Sie die Dokumentation.",
"MODULE_CONFIG_ERROR": "Fehler im {MODULE_NAME} Modul. {ERROR}",
"UPDATE_NOTIFICATION": "Aktualisierung für MagicMirror² verfügbar.", "UPDATE_NOTIFICATION": "Aktualisierung für MagicMirror² verfügbar.",
"UPDATE_NOTIFICATION_MODULE": "Aktualisierung für das {MODULE_NAME} Modul verfügbar.", "UPDATE_NOTIFICATION_MODULE": "Aktualisierung für das {MODULE_NAME} Modul verfügbar.",

View File

@ -27,6 +27,7 @@
"NNW": "NNW", "NNW": "NNW",
"MODULE_CONFIG_CHANGED": "The configuration options for the {MODULE_NAME} module have changed.\nPlease check the documentation.", "MODULE_CONFIG_CHANGED": "The configuration options for the {MODULE_NAME} module have changed.\nPlease check the documentation.",
"MODULE_CONFIG_ERROR": "Error in the {MODULE_NAME} module. {ERROR}",
"UPDATE_NOTIFICATION": "MagicMirror² update available.", "UPDATE_NOTIFICATION": "MagicMirror² update available.",
"UPDATE_NOTIFICATION_MODULE": "Update available for {MODULE_NAME} module.", "UPDATE_NOTIFICATION_MODULE": "Update available for {MODULE_NAME} module.",