Commit 70c8ad0d authored by Curtis Adam's avatar Curtis Adam

Use a single i18n string for the notification message

parent 93f03d5b
...@@ -269,6 +269,9 @@ ...@@ -269,6 +269,9 @@
"help": { "help": {
"resetFilter": "Zeige die Hilfe für alle Seiten…" "resetFilter": "Zeige die Hilfe für alle Seiten…"
}, },
"webPushNotifications": {
"content": "Kartei: __cardsetName__\nKarten: __cardCount__\nFrist: __deadline__"
},
"notifications": { "notifications": {
"title": "Nachrichten", "title": "Nachrichten",
"clearAll": "Leeren", "clearAll": "Leeren",
...@@ -283,11 +286,7 @@ ...@@ -283,11 +286,7 @@
"reporteduseradmin": "Adminbenachrichtigung (Gemeldete/r Benutzer/in)", "reporteduseradmin": "Adminbenachrichtigung (Gemeldete/r Benutzer/in)",
"reportedcardsetadmin": "Adminbenachrichtigung (Gemeldete Kartei)", "reportedcardsetadmin": "Adminbenachrichtigung (Gemeldete Kartei)",
"lecturer": "Dozenten-Anfrage", "lecturer": "Dozenten-Anfrage",
"heading": "Aufgaben warten!", "admin": "Du bist angemeldet als Admin!"
"content": "Kartei: ",
"deadline": "\nFrist: ",
"admin": "Du bist angemeldet als Admin!",
"cards": "\nKarten: "
}, },
"input-group": { "input-group": {
"newcarddeck": "Neue Kartei" "newcarddeck": "Neue Kartei"
......
...@@ -33,9 +33,9 @@ export class WebNotifier { ...@@ -33,9 +33,9 @@ export class WebNotifier {
deadline = new Date(active.currentDate.getTime() + cardset.daysBeforeReset * 86400000); deadline = new Date(active.currentDate.getTime() + cardset.daysBeforeReset * 86400000);
} }
if (deadline.getTime() > cardset.learningEnd.getTime()) { if (deadline.getTime() > cardset.learningEnd.getTime()) {
return (TAPi18n.__('notifications.deadline', null, Meteor.settings.mail.language) + getDateString(cardset.learningEnd)); return getDateString(cardset.learningEnd);
} else { } else {
return (TAPi18n.__('notifications.deadline', null, Meteor.settings.mail.language) + getDateString(deadline)); return getDateString(deadline);
} }
} }
} }
...@@ -50,7 +50,7 @@ export class WebNotifier { ...@@ -50,7 +50,7 @@ export class WebNotifier {
throw new Meteor.Error("not-authorized"); throw new Meteor.Error("not-authorized");
} else { } else {
let notifier = new Notifications(); let notifier = new Notifications();
let message = TAPi18n.__('notifications.content', null, Meteor.settings.mail.language) + cardset.name + TAPi18n.__('notifications.cards', null, Meteor.settings.mail.language) + notifier.getActiveCardsCount(cardset._id, user_id, testUser) + this.getDeadline(cardset, user_id, testUser); let message = TAPi18n.__('webPushNotifications.content', {cardsetName: cardset.name, cardCount: notifier.getActiveCardsCount(cardset._id, user_id, testUser), deadline: this.getDeadline(cardset, user_id, testUser)}, Meteor.settings.mail.language);
Meteor.call("sendPushNotificationsToUser", user_id, message); Meteor.call("sendPushNotificationsToUser", user_id, message);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment