Language Support #2
19
index.js
19
index.js
@ -62,7 +62,6 @@ currentState.textColors = currentState.colorSegments
|
||||
loggy.log("Reading language file", "info", "Language")
|
||||
const languageProfile = JSON.parse(fs.readFileSync("lang/en_uk.json", "utf8"));
|
||||
|
||||
|
||||
loggy.log("Preparing websocket", "info", "Websocket");
|
||||
const wsServer = new ws.Server({ noServer: true });
|
||||
wsServer.on('connection', socket => {
|
||||
@ -93,11 +92,15 @@ function updatedData() {
|
||||
loggy.log("Preparing routes", "info", "Server");
|
||||
app.get("/", function (req, res) {
|
||||
const data = fs.readFileSync("templates/newAdminPanel.html", "utf8");
|
||||
|
||||
try {
|
||||
res.send(
|
||||
Eta.render(data, {
|
||||
lang: languageProfile
|
||||
}));
|
||||
} catch (e) {
|
||||
const data = fs.readFileSync("templates/brokenTranslation.html", "utf8");
|
||||
res.send(data);
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/timer", function (req, res) {
|
||||
@ -308,7 +311,7 @@ app.get("/api/v1/storage/delete", function (req, res) {
|
||||
updatedData()
|
||||
});
|
||||
|
||||
app.use(function(req, res, next) {
|
||||
app.use(function (req, res, next) {
|
||||
res.status(404);
|
||||
loggy.log("Server responded with 404 error", "warn", "Server", true);
|
||||
|
||||
@ -332,7 +335,7 @@ app.use(function(req, res, next) {
|
||||
|
||||
|
||||
|
||||
app.use(function(err, req, res, next) {
|
||||
/*app.use(function(err, req, res, next) {
|
||||
console.error(err.stack);
|
||||
if(String(err.stack).includes("TypeError: Cannot read properties of undefined")) {
|
||||
const data = fs.readFileSync("templates/brokenTranslation.html", "utf8");
|
||||
@ -341,22 +344,20 @@ app.use(function(err, req, res, next) {
|
||||
res.status(500).send('Something broke!');
|
||||
}
|
||||
|
||||
});
|
||||
});*/
|
||||
|
||||
|
||||
|
||||
loggy.log("Starting server", "info", "Server");
|
||||
|
||||
|
||||
const port = 3006
|
||||
const port = 3005;
|
||||
|
||||
process.on('SIGINT', function () {
|
||||
loggy.log("Caught interrupt signal and shutting down gracefully", "info", "Shutdown");
|
||||
server.close(); // Make the express server stop
|
||||
loggy.log("Goodbye! 👋", "magic", "Shutdown", true)
|
||||
loggy.close()
|
||||
loggy.close(); // Close and write log
|
||||
process.exit(); // Quit the application
|
||||
|
||||
});
|
||||
|
||||
const server = app.listen(port);
|
||||
|
@ -4,7 +4,9 @@
|
||||
"preview": "Vorschau",
|
||||
"mode": "Modus",
|
||||
"messaging": "Nachrichten",
|
||||
"countdownToTime": "Auf Uhrzeit runterzählen"
|
||||
"countdownToTime": "Auf Uhrzeit runterzählen",
|
||||
"attention": "Achtung",
|
||||
"hostinfo": "Host Informationen"
|
||||
},
|
||||
"sidebar": {
|
||||
"home": "Startseite",
|
||||
@ -16,7 +18,10 @@
|
||||
{
|
||||
"previewHint": "Eine Vorschau der Timeransicht.",
|
||||
"modeHint": "",
|
||||
"messagingHint": "Zeigt eine Nachricht auf der Timeransicht an."
|
||||
"messagingHint": "Zeigt eine Nachricht auf der Timeransicht an.",
|
||||
"copyHint": "Kopiert den Link zu der Countdown-Seite.",
|
||||
"openInNewTab": "Öffnet den Link in einem neuen Tab.",
|
||||
"selectMode": "Wählt einen Modus für die Timeransicht.",
|
||||
},
|
||||
"placeholders": {
|
||||
"msgHere": "Message here"
|
||||
@ -27,5 +32,38 @@
|
||||
"clock": "Uhr",
|
||||
"black": "Schwarz",
|
||||
"test": "Testbild"
|
||||
},
|
||||
"labels":
|
||||
{
|
||||
"clockOnTimer": "Zeigt die Uhrzeit auf dem Timer:",
|
||||
"showMillis": "Zeigt Millisekunden auf dem Timer:",
|
||||
"showProgress": "Zeige Fortschrittsbalken:",
|
||||
"progbarColors": "Fortschrittsbalken Farben",
|
||||
"time": "Zeit",
|
||||
"color": "Farbe",
|
||||
"remove": "Entfernen",
|
||||
"enableTextClrs": "Text Farben aktivieren:",
|
||||
"textClrs": "Text Farben",
|
||||
"addRow": "Neue Zeile",
|
||||
"timeVar": "Aktiviere zeitabweichungs display:"
|
||||
},
|
||||
"untis":
|
||||
{
|
||||
"seconds": "Sekunden",
|
||||
"minutes": "Minutes",
|
||||
"hours": "Stunden",
|
||||
"days": "Tage",
|
||||
"weeks": "Wochen",
|
||||
"months": "Monate",
|
||||
"years": "Jahre"
|
||||
},
|
||||
"informationTexts": {
|
||||
"debugInfo": "Das hier ist eine debug seite welche nur von professionellen Personen verwendet werden sollte. ",
|
||||
"proceedCaution": "Gehen Sie vorsichtig vor"
|
||||
},
|
||||
"_metadata": {
|
||||
"lang": "de",
|
||||
"version": "1.0.0",
|
||||
"authors": ["TheGreydiamond"]
|
||||
}
|
||||
}
|
@ -4,7 +4,9 @@
|
||||
"preview": "Preview",
|
||||
"mode": "Mode",
|
||||
"messaging": "Messaging",
|
||||
"countdownToTime": "Countdown to time"
|
||||
"countdownToTime": "Countdown to time",
|
||||
"attention": "Attention",
|
||||
"hostinfo": "Host information"
|
||||
},
|
||||
"sidebar": {
|
||||
"home": "Home",
|
||||
@ -16,7 +18,10 @@
|
||||
{
|
||||
"previewHint": "A preview of what is currently visible on the countdown view",
|
||||
"modeHint": "",
|
||||
"messagingHint": "Shows a given message on the timer view"
|
||||
"messagingHint": "Shows a given message on the timer view",
|
||||
"copyHint": "Copies the link to the timer view",
|
||||
"openInNewTab": "Open the countdown view in a new tab",
|
||||
"selectMode": "Select what to show on the countdown view"
|
||||
},
|
||||
"placeholders": {
|
||||
"msgHere": "Message here"
|
||||
@ -36,7 +41,25 @@
|
||||
"progbarColors": "Progressbar Colors",
|
||||
"time": "Time",
|
||||
"color": "Color",
|
||||
"remove": "Remove"
|
||||
"remove": "Remove",
|
||||
"enableTextClrs": "Enable Text Colours:",
|
||||
"textClrs": "Text Colours",
|
||||
"addRow": "Add Row",
|
||||
"timeVar": "Enable time variance display:"
|
||||
},
|
||||
"untis":
|
||||
{
|
||||
"seconds": "Seconds",
|
||||
"minutes": "Minutes",
|
||||
"hours": "Hours",
|
||||
"days": "Days",
|
||||
"weeks": "Weeks",
|
||||
"months": "Months",
|
||||
"years": "Years"
|
||||
},
|
||||
"informationTexts": {
|
||||
"debugInfo": "This is a debug page which should only be used by professionals. Changing any options below might impact operation.",
|
||||
"proceedCaution": "Proceed with caution."
|
||||
},
|
||||
"_metadata": {
|
||||
"lang": "en",
|
||||
|
70
lang/proto_black.json
Normal file
70
lang/proto_black.json
Normal file
@ -0,0 +1,70 @@
|
||||
{
|
||||
"titles": {
|
||||
"home": "████████",
|
||||
"preview": "██████",
|
||||
"mode": "████",
|
||||
"messaging": "█████████",
|
||||
"countdownToTime": "█████████ ██ ████",
|
||||
"attention": "███████████",
|
||||
"hostinfo": "████ █████████"
|
||||
},
|
||||
"sidebar": {
|
||||
"home": "████",
|
||||
"settings": "████████",
|
||||
"debug": "█████",
|
||||
"about": "█████"
|
||||
},
|
||||
"hints":
|
||||
{
|
||||
"previewHint": "█ ████ ███████ ████",
|
||||
"modeHint": "",
|
||||
"messagingHint": "████ █ ██████ ██ █████",
|
||||
"copyHint": "██████ ███ ████ ██ ███ █████ ████",
|
||||
"openInNewTab": "████ ███ ████████ ████ █ █ ███ ███",
|
||||
"selectMode": "█████ ████ ██ ████ ██ ███ ████████ ████"
|
||||
},
|
||||
"placeholders": {
|
||||
"msgHere": "██████ ████"
|
||||
},
|
||||
"others":
|
||||
{
|
||||
"timer": "████",
|
||||
"clock": "█████",
|
||||
"black": "████",
|
||||
"test": "███████"
|
||||
},
|
||||
"labels":
|
||||
{
|
||||
"clockOnTimer": "████ █████ ██ █████:",
|
||||
"showMillis": "████ ███████████ ██ █████:",
|
||||
"showProgress": "████ █████████:",
|
||||
"progbarColors": "████████ ████",
|
||||
"time": "████",
|
||||
"color": "█████",
|
||||
"remove": "██████",
|
||||
"enableTextClrs": "██████ ████ ███████:",
|
||||
"textClrs": "████ ██████",
|
||||
"addRow": "███ ███",
|
||||
"timeVar": "██████ ████ ███████ ███████:"
|
||||
},
|
||||
"untis":
|
||||
{
|
||||
"seconds": "Seconds",
|
||||
"minutes": "Minutes",
|
||||
"hours": "Hours",
|
||||
"days": "Days",
|
||||
"weeks": "Weeks",
|
||||
"months": "Months",
|
||||
"years": "Years"
|
||||
},
|
||||
"informationTexts": {
|
||||
"debugInfo": "████ ██ █ █████ ████ █████ █████ ████ ██ ████ ██ ██████████. ████████ ███ ██████ █████ █████ █████ ██████.",
|
||||
"proceedCaution": "█████ ████ ███████."
|
||||
},
|
||||
"_metadata": {
|
||||
"lang": "none",
|
||||
"version": "1.0.0",
|
||||
"authors": ["TheGreydiamond"],
|
||||
"comment": "A test language without proper text and only black blocks. █"
|
||||
}
|
||||
}
|
@ -1 +1 @@
|
||||
[{"timestamp":"2022-04-06 20:17:16.831","level":"info","module":"Logging","message":"2022-04-06 20:17:16.831 [info] [Logging] Logging initialized"},{"timestamp":"2022-04-06 20:17:16.833","level":"info","module":"Server","message":"2022-04-06 20:17:16.833 [info] [Server] Preparing server"},{"timestamp":"2022-04-06 20:17:16.834","level":"info","module":"Server","message":"2022-04-06 20:17:16.834 [info] [Server] Preparing static routes"},{"timestamp":"2022-04-06 20:17:16.836","level":"info","module":"Server","message":"2022-04-06 20:17:16.836 [info] [Server] Preparing middlewares"},{"timestamp":"2022-04-06 20:17:16.837","level":"info","module":"Config","message":"2022-04-06 20:17:16.837 [info] [Config] Loading config"},{"timestamp":"2022-04-06 20:17:16.838","level":"info","module":"Language","message":"2022-04-06 20:17:16.838 [info] [Language] Reading language file"},{"timestamp":"2022-04-06 20:17:16.838","level":"info","module":"Websocket","message":"2022-04-06 20:17:16.838 [info] [Websocket] Preparing websocket"},{"timestamp":"2022-04-06 20:17:16.839","level":"info","module":"Server","message":"2022-04-06 20:17:16.839 [info] [Server] Preparing routes"},{"timestamp":"2022-04-06 20:17:16.840","level":"info","module":"Server","message":"2022-04-06 20:17:16.840 [info] [Server] Starting server"},{"timestamp":"2022-04-06 20:17:22.971","level":"info","module":"Shutdown","message":"2022-04-06 20:17:22.971 [info] [Shutdown] Caught interrupt signal and shutting down gracefully"}]
|
||||
[{"timestamp":"2022-05-10 19:38:52.853","level":"info","module":"Logging","message":"2022-05-10 19:38:52.853 [info] [Logging] Logging initialized"},{"timestamp":"2022-05-10 19:38:52.854","level":"info","module":"Server","message":"2022-05-10 19:38:52.854 [info] [Server] Preparing server"},{"timestamp":"2022-05-10 19:38:52.856","level":"info","module":"Server","message":"2022-05-10 19:38:52.856 [info] [Server] Preparing static routes"},{"timestamp":"2022-05-10 19:38:52.857","level":"info","module":"Server","message":"2022-05-10 19:38:52.857 [info] [Server] Preparing middlewares"},{"timestamp":"2022-05-10 19:38:52.857","level":"info","module":"Config","message":"2022-05-10 19:38:52.857 [info] [Config] Loading config"},{"timestamp":"2022-05-10 19:38:52.857","level":"info","module":"Language","message":"2022-05-10 19:38:52.857 [info] [Language] Reading language file"},{"timestamp":"2022-05-10 19:38:52.858","level":"info","module":"Websocket","message":"2022-05-10 19:38:52.858 [info] [Websocket] Preparing websocket"},{"timestamp":"2022-05-10 19:38:52.858","level":"info","module":"Server","message":"2022-05-10 19:38:52.858 [info] [Server] Preparing routes"},{"timestamp":"2022-05-10 19:38:52.859","level":"info","module":"Server","message":"2022-05-10 19:38:52.859 [info] [Server] Starting server"},{"timestamp":"2022-05-10 19:48:56.465","level":"info","module":"Shutdown","message":"2022-05-10 19:48:56.465 [info] [Shutdown] Caught interrupt signal and shutting down gracefully"}]
|
@ -119,14 +119,14 @@
|
||||
</span>
|
||||
<div class="ms-auto">
|
||||
<span class="helperTip" data-placement="right"
|
||||
title="Copies the link to the timer view" data-toggle="tooltip">
|
||||
title="<%= it.lang.hints.copyHint %>" data-toggle="tooltip">
|
||||
<button class="btn" onclick="navigator.clipboard.writeText(window.location.toString() + 'timer')">
|
||||
<i class="bi bi-clipboard"></i>
|
||||
</button>
|
||||
</span>
|
||||
|
||||
<span class="helperTip" data-placement="right"
|
||||
title="Open the countdown view in a new tab" data-toggle="tooltip">
|
||||
title="<%= it.lang.hints.openInNewTab %>" data-toggle="tooltip">
|
||||
<a href="/timer" class="btn " target="_blank"><i
|
||||
class="bi bi-box-arrow-up-right"></i></a>
|
||||
</span>
|
||||
@ -137,7 +137,7 @@
|
||||
</div>
|
||||
<div class="col">
|
||||
<h3><%= it.lang.titles.mode %> <span class="helperTip" data-placement="right"
|
||||
title="Select what to show on the countdown view" data-toggle="tooltip">
|
||||
title=<%= it.lang.hints.selectMode %> data-toggle="tooltip">
|
||||
<i class="bi bi-question-circle-fill"></i>
|
||||
</span></h3>
|
||||
<div class="btn-group" role="group" aria-label="Basic radio toggle button group">
|
||||
@ -201,7 +201,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<br><br><br>
|
||||
<h3><%= it.lang.titles.timer %></h3>
|
||||
<h3><%= it.lang.others.timer %></h3>
|
||||
<div class="container">
|
||||
|
||||
|
||||
@ -278,10 +278,10 @@
|
||||
</p>
|
||||
</details>
|
||||
<hr>
|
||||
<label for="textColors">Enable Text Colors:</label>
|
||||
<label for="textColors"><%= it.lang.labels.enableTextClrs %></label>
|
||||
<input type="checkbox" name="textColors" id="textColors"><br>
|
||||
<details>
|
||||
<summary>Text Colors</summary>
|
||||
<summary><%= it.lang.labels.textClrs %></summary>
|
||||
<p>
|
||||
|
||||
<div id="table2" class="table-editable">
|
||||
@ -299,7 +299,7 @@
|
||||
<button type="button" class="btn btn-outline-success" id="copyColors">Copy from progressbar
|
||||
colors</button>
|
||||
|
||||
<button type="button" class="btn btn-outline-success" id="addRow2">Add row</button>
|
||||
<button type="button" class="btn btn-outline-success" id="addRow2"><%= it.lang.labels.row %></button>
|
||||
</p>
|
||||
</details>
|
||||
<br>
|
||||
@ -316,13 +316,12 @@
|
||||
<page id="debug" class="pageC hidden flex-fill overflow-auto">
|
||||
<h1>Debug page</h1>
|
||||
<div class="alert alert-danger" role="alert">
|
||||
<h4 class="alert-heading">Attention</h4>
|
||||
<p>This is a debug page which should only be used by professionals. Changing any options below might
|
||||
impact operation.</p>
|
||||
<h4 class="alert-heading"><%= it.lang.titles.attention %></h4>
|
||||
<p><%= it.lang.informationTexts.debugInfo %></p>
|
||||
<hr>
|
||||
<p class="mb-0"><b>Proceed with caution.</b></p>
|
||||
<p class="mb-0"><b><%= it.lang.informationTexts.proceedCaution %></b></p>
|
||||
</div>
|
||||
<label for="debugMode">Enable time variance display:</label>
|
||||
<label for="debugMode"><%= it.lang.labels.timeVar %></label>
|
||||
<input type="checkbox" name="debugMode" id="debugModeEnable" value="true"><br><br>
|
||||
|
||||
<button type="button" class="btn btn-outline-success" id="applyDebug">Apply settings</button>
|
||||
@ -330,7 +329,7 @@
|
||||
<hr>
|
||||
<br>
|
||||
|
||||
<h3>Host information</h3>
|
||||
<h3><%= it.lang.titles.hostinfo %></h3>
|
||||
<code id="systemInfo" class="overflow-auto">
|
||||
|
||||
</code>
|
||||
@ -345,9 +344,9 @@
|
||||
<table class="table table-bordered table-responsive-md table-striped text-center" id="colors1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">Time</th>
|
||||
<th class="text-center">Color</th>
|
||||
<th class="text-center">Remove</th>
|
||||
<th class="text-center"><%= it.lang.labels.time %></th>
|
||||
<th class="text-center"><%= it.lang.labels.color %></th>
|
||||
<th class="text-center"><%= it.lang.labels.remove %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr id="tableCopySource">
|
||||
@ -409,7 +408,10 @@
|
||||
<h1>About</h1>
|
||||
Version: <b id="nodeSwVers"></b><br>
|
||||
NodeJS Version: <b id="nodejsVers"></b><br>
|
||||
|
||||
<h2>About the translation</h2>
|
||||
Author: <%= it.lang._metadata.authors %><br>
|
||||
Language: <%= it.lang._metadata.lang %><br>
|
||||
Version: <%= it.lang._metadata.version %><br>
|
||||
</page>
|
||||
</pages>
|
||||
</main>
|
||||
|
Loading…
Reference in New Issue
Block a user