ändern der Praxissoftware in deutsch und Spanisch

This commit is contained in:
Cay 2026-01-18 18:52:08 +00:00
parent 81473882e5
commit 10e83f53da
106 changed files with 3627 additions and 239 deletions

52
app.js
View File

@ -4,6 +4,8 @@ const express = require("express");
const session = require("express-session");
const helmet = require("helmet");
const mysql = require("mysql2/promise");
const fs = require("fs");
const path = require("path");
// ✅ Verschlüsselte Config
const { configExists, saveConfig } = require("./config-manager");
@ -97,6 +99,19 @@ app.use(
}),
);
// ✅ i18n Middleware
app.use((req, res, next) => {
const lang = req.session.lang || "de"; // Standard DE
const filePath = path.join(__dirname, "locales", `${lang}.json`);
const raw = fs.readFileSync(filePath, "utf-8");
res.locals.t = JSON.parse(raw); // t = translations
res.locals.lang = lang;
next();
});
const flashMiddleware = require("./middleware/flash.middleware");
app.use(flashMiddleware);
@ -166,6 +181,43 @@ app.use((req, res, next) => {
next();
});
//Sprachen Route
// ✅ i18n Middleware (Sprache pro Benutzer über Session)
app.use((req, res, next) => {
const lang = req.session.lang || "de"; // Standard: Deutsch
let translations = {};
try {
const filePath = path.join(__dirname, "locales", `${lang}.json`);
translations = JSON.parse(fs.readFileSync(filePath, "utf-8"));
} catch (err) {
console.error("❌ i18n Fehler:", err.message);
}
// ✅ In EJS verfügbar machen
res.locals.t = translations;
res.locals.lang = lang;
next();
});
app.get("/lang/:lang", (req, res) => {
const newLang = req.params.lang;
if (!["de", "es"].includes(newLang)) {
return res.redirect(req.get("Referrer") || "/dashboard");
}
req.session.lang = newLang;
// ✅ WICHTIG: Session speichern bevor redirect
req.session.save((err) => {
if (err) console.error("❌ Session save error:", err);
return res.redirect(req.get("Referrer") || "/dashboard");
});
});
/* ===============================
DEINE LOGIK (unverändert)
================================ */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

BIN
libmysql.dll Normal file

Binary file not shown.

26
locales/de.json Normal file
View File

@ -0,0 +1,26 @@
{
"global": {
"save": "Speichern",
"cancel": "Abbrechen",
"search": "Suchen",
"reset": "Reset",
"dashboard": "Dashboard"
},
"sidebar": {
"patients": "Patienten",
"medications": "Medikamente",
"servicesOpen": "Offene Leistungen",
"billing": "Abrechnung",
"admin": "Verwaltung",
"logout": "Logout"
},
"dashboard": {
"welcome": "Willkommen",
"waitingRoom": "Wartezimmer-Monitor",
"noWaitingPatients": "Keine Patienten im Wartezimmer."
},
"adminSidebar": {
"users": "Userverwaltung",
"database": "Datenbankverwaltung"
}
}

27
locales/es.json Normal file
View File

@ -0,0 +1,27 @@
{
"global": {
"save": "Guardar",
"cancel": "Cancelar",
"search": "Buscar",
"reset": "Resetear",
"dashboard": "Panel"
},
"sidebar": {
"patients": "Pacientes",
"medications": "Medicamentos",
"servicesOpen": "Servicios abiertos",
"billing": "Facturación",
"admin": "Administración",
"logout": "Cerrar sesión"
},
"dashboard": {
"welcome": "Bienvenido",
"waitingRoom": "Monitor sala de espera",
"noWaitingPatients": "No hay pacientes en la sala de espera."
},
"adminSidebar": {
"users": "Administración de usuarios",
"database": "Administración de base de datos"
}
}

BIN
mysql.exe Normal file

Binary file not shown.

BIN
mysqldump.exe Normal file

Binary file not shown.

BIN
plugin/adt_null.dll Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
plugin/ddl_rewriter.dll Normal file

Binary file not shown.

BIN
plugin/debug/adt_null.dll Normal file

Binary file not shown.

BIN
plugin/debug/adt_null.pdb Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
plugin/debug/ha_example.dll Normal file

Binary file not shown.

BIN
plugin/debug/ha_example.pdb Normal file

Binary file not shown.

BIN
plugin/debug/ha_mock.dll Normal file

Binary file not shown.

BIN
plugin/debug/ha_mock.pdb Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
plugin/debug/mypluglib.dll Normal file

Binary file not shown.

BIN
plugin/debug/mypluglib.pdb Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
plugin/debug/rewriter.dll Normal file

Binary file not shown.

BIN
plugin/debug/rewriter.pdb Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
plugin/ha_example.dll Normal file

Binary file not shown.

BIN
plugin/ha_mock.dll Normal file

Binary file not shown.

BIN
plugin/keyring_udf.dll Normal file

Binary file not shown.

BIN
plugin/libpluginmecab.dll Normal file

Binary file not shown.

BIN
plugin/locking_service.dll Normal file

Binary file not shown.

BIN
plugin/mypluglib.dll Normal file

Binary file not shown.

BIN
plugin/mysql_clone.dll Normal file

Binary file not shown.

Binary file not shown.

BIN
plugin/mysql_no_login.dll Normal file

Binary file not shown.

BIN
plugin/rewrite_example.dll Normal file

Binary file not shown.

BIN
plugin/rewriter.dll Normal file

Binary file not shown.

BIN
plugin/semisync_replica.dll Normal file

Binary file not shown.

BIN
plugin/semisync_source.dll Normal file

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More