Skip to content

Commit ce0b6a7

Browse files
authored
Merge pull request #123 from Jumoo/custom-notif
Custom notif
2 parents 89841dd + 104e43d commit ce0b6a7

File tree

3 files changed

+141
-1
lines changed

3 files changed

+141
-1
lines changed

tm/03.userGuide/10.notifications.md renamed to tm/03.userGuide/10.notifications/10.notifications.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Get Email Notifications
2+
title: Email Notifications
33
---
44

55
You can setup email notifications to get emails when jobs pass certain stages in Translation Manager.
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
---
2+
title: Customising Notifications
3+
---
4+
You can customise the notifications that get fired during the translation process to fit your needs.
5+
6+
## Custom Subject Line
7+
8+
The subject line on notifications comes from config.
9+
10+
```json
11+
"Translation": {
12+
"Notify": {
13+
"subject": "Translations : [{job}] - {eventName}"
14+
}
15+
}
16+
```
17+
`{eventName}` and `{job}`can be swapped out for any of the valid replacements.
18+
19+
## Custom Template
20+
21+
When Translation Manager is sending notifications, it will look in these three locations:
22+
23+
- `[site folder]/translations/emails`
24+
- `[site folder]/emails`
25+
- `[site folder]/App_Plugins/TranslationManager/emails`
26+
27+
for the event folder for the notified event. For example, if you have notifications set up for Recieved and Pending, it will look for `recieved.html` and `pending.html`.
28+
29+
If an event file isn't found, it will use this inbuilt template:
30+
31+
```html
32+
<!DOCTYPE html>
33+
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
34+
35+
<head>
36+
<meta charset="utf-8" />
37+
</head>
38+
39+
<body style="margin:0;padding:0;font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;">
40+
<table border="0" cellpadding="0" cellspacing="0" width="100%">
41+
<tr>
42+
<td>
43+
<table align="center" cellpadding="0" cellspacing="0" border="0" width="600" style="border-collapse: collapse">
44+
<tr>
45+
<td>
46+
<table style="padding: 10px 10px 10px 10px;border-bottom: 4px solid #FFE0B2; background-color: #fafafa;"
47+
width="100%">
48+
<tr>
49+
<td>
50+
<h2>Translation Job : {event}</h2>
51+
{date} {time}
52+
</td>
53+
</tr>
54+
</table>
55+
</td>
56+
</tr>
57+
<tr>
58+
<td>
59+
<table style="padding: 40px 20px 50px 20px">
60+
<tr>
61+
<td>
62+
<table>
63+
<tr>
64+
<th>Job Name:</th>
65+
<td>{jobname}</td>
66+
</tr>
67+
<tr>
68+
<th>Source Lang:</th>
69+
<td>{source}</td>
70+
</tr>
71+
<tr>
72+
<th>Target Lang:</th>
73+
<td>{target}</td>
74+
</tr>
75+
<tr>
76+
<th>Node Count:</th>
77+
<td>{nodes}</td>
78+
</tr>
79+
<tr>
80+
<th>Status:</th>
81+
<td>{status}</td>
82+
</tr>
83+
<tr>
84+
<td>&nbsp;</td>
85+
<td>
86+
<a href="{serverName}/#/translation/jobs/edit/{id}">View Job
87+
({serverName}/#/translation/jobs/edit/{id})</a>
88+
89+
</td>
90+
</tr>
91+
</table>
92+
</td>
93+
</tr>
94+
</table>
95+
96+
</td>
97+
</tr>
98+
<tr>
99+
<td>
100+
<table
101+
style="padding: 10px 10px 10px 10px;border-top: 4px solid #292C44;font-size: 8pt;font-style: italic;"
102+
width="100%">
103+
<tr>
104+
<td>
105+
Translation Manager for Umbraco
106+
</td>
107+
</tr>
108+
</table>
109+
110+
</td>
111+
</tr>
112+
</table>
113+
</td>
114+
</tr>
115+
</table>
116+
</body>
117+
118+
</html>
119+
```
120+
If you take this HTML and put it in the .html file that Translation Manager uses to notify you, you can change the text and have your own custom notifications.
121+
122+
## Valid Replacements
123+
124+
The valid replacements for editing the template are:
125+
126+
```
127+
"{serverName}", $"{CurrentServerName.TrimEnd('/')}/umbraco/"
128+
"{date}", DateTime.Now.ToString("dd MMM yyy")
129+
"{time}", DateTime.Now.ToString("hh:mm:ss")
130+
"{id}", job.Id.ToString()
131+
"{job}", job.Name
132+
"{jobname}", job.Name
133+
"{source}", job.SourceCulture.DisplayName
134+
"{target}", job.TargetCulture.DisplayName
135+
"{event}", eventName
136+
"{eventName}", eventName
137+
"{status}", job.Status.ToString()
138+
"{nodes}", count.ToString()
139+
```
140+
File renamed without changes.

0 commit comments

Comments
 (0)