Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added translaions to the alert module #225

Merged
merged 5 commits into from
Apr 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions modules/default/alert/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,21 @@ Module.register("alert",{
//Position
position: "center",
//shown at startup
welcome_message: "Welcome, start was successful!"
welcome_message: true,
},
getScripts: function() {
return ["classie.js", "modernizr.custom.js", "notificationFx.js"];
},
getStyles: function() {
return ["ns-default.css"];
},
// Define required translations.
getTranslations: function() {
return {
en: "translations/en.json",
de: "translations/de.json"
};
},
show_notification: function(message) {
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>";
Expand Down Expand Up @@ -111,7 +118,12 @@ Module.register("alert",{
this.alerts = {};
this.setPosition(this.config.position);
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);
}
Expand Down
4 changes: 4 additions & 0 deletions modules/default/alert/translations/de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"sysTitle": "MagicMirror Benachrichtigung",
"welcome": "Willkommen, Start war erfolgreich!"
}
4 changes: 4 additions & 0 deletions modules/default/alert/translations/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"sysTitle": "MagicMirror Notification",
"welcome": "Welcome, start was successful!"
}