mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
Added translaions to the alert module.
This commit is contained in:
@@ -18,7 +18,7 @@ Module.register("alert",{
|
|||||||
//Position
|
//Position
|
||||||
position: "center",
|
position: "center",
|
||||||
//shown at startup
|
//shown at startup
|
||||||
welcome_message: "Welcome, start was successful!"
|
welcome_message: true,
|
||||||
},
|
},
|
||||||
getScripts: function() {
|
getScripts: function() {
|
||||||
return ["classie.js", "modernizr.custom.js", "notificationFx.js"];
|
return ["classie.js", "modernizr.custom.js", "notificationFx.js"];
|
||||||
@@ -26,6 +26,13 @@ Module.register("alert",{
|
|||||||
getStyles: function() {
|
getStyles: function() {
|
||||||
return ["ns-default.css"];
|
return ["ns-default.css"];
|
||||||
},
|
},
|
||||||
|
// Define required translations.
|
||||||
|
getTranslations: function() {
|
||||||
|
return {
|
||||||
|
en: "translations/en.json",
|
||||||
|
de: "translations/de.json"
|
||||||
|
};
|
||||||
|
},
|
||||||
show_notification: function(message) {
|
show_notification: function(message) {
|
||||||
if (this.config.effect == "slide") {this.config.effect = this.config.effect + "-" + this.config.position;}
|
if (this.config.effect == "slide") {this.config.effect = this.config.effect + "-" + this.config.position;}
|
||||||
message = "<span class='thin' style='line-height: 35px; font-size:24px' color='#4A4A4A'>" + message.title + "</span><br /><span class='light' style='font-size:28px;line-height: 30px;'>" + message.message + "</span>";
|
message = "<span class='thin' style='line-height: 35px; font-size:24px' color='#4A4A4A'>" + message.title + "</span><br /><span class='light' style='font-size:28px;line-height: 30px;'>" + message.message + "</span>";
|
||||||
@@ -111,7 +118,12 @@ Module.register("alert",{
|
|||||||
this.alerts = {};
|
this.alerts = {};
|
||||||
this.setPosition(this.config.position);
|
this.setPosition(this.config.position);
|
||||||
if (this.config.welcome_message) {
|
if (this.config.welcome_message) {
|
||||||
this.show_notification({title: "MagicMirror Notification", message: this.config.welcome_message});
|
if (this.config.welcome_message == true){
|
||||||
|
this.show_notification({title: this.translate("sysTitle"), message: this.translate("welcome")});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.show_notification({title: this.translate("sysTitle"), message: this.config.welcome_message});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Log.info("Starting module: " + this.name);
|
Log.info("Starting module: " + this.name);
|
||||||
}
|
}
|
||||||
|
4
modules/default/alert/translations/de.json
Normal file
4
modules/default/alert/translations/de.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"sysTitle": "MagicMirror Benachrichtigung",
|
||||||
|
"welcome": "Willkommen, Start war erfolgreich!"
|
||||||
|
}
|
4
modules/default/alert/translations/en.json
Normal file
4
modules/default/alert/translations/en.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"sysTitle": "MagicMirror Notification",
|
||||||
|
"welcome": "Welcome, start was successful!"
|
||||||
|
}
|
Reference in New Issue
Block a user