Compare commits
27 Commits
v1.4.7
...
1967cef7fc
Author | SHA1 | Date | |
---|---|---|---|
1967cef7fc | |||
0c0997c1bd | |||
118c7c1516 | |||
773696d6be | |||
f53a2661da | |||
53b40ca91d | |||
43eb609b4a | |||
53d5309d65 | |||
a131fc8077 | |||
deec62fec0 | |||
9e5906943d | |||
cabe628875 | |||
35ecba348b | |||
31b1c12dcb | |||
95ed606796 | |||
52eac7530a | |||
2f6138b1d6 | |||
f5a39e80b4 | |||
f9f73e24c9 | |||
d697928241 | |||
f998f7fff8 | |||
1a5aa003a2 | |||
eecc2b8b73 | |||
0b13a408cd | |||
c4a65bba48 | |||
e4b37d9261 | |||
45cc02b4b0 |
495
README.md
495
README.md
@@ -1,500 +1,25 @@
|
||||
# Elpatrons Datumsrechner
|
||||
# Elpatrons Date Calculator
|
||||
|
||||
[](https://github.com/elpatron/datecalc)
|
||||
[](https://date.elpatron.me)
|
||||
[](https://date.elpatron.me)
|
||||
[](https://date.elpatron.me)
|
||||
[](https://date.elpatron.me)
|
||||
A modern Python web application (Flask) that enables various date calculations through a clear, accessible web interface. Features include calculating days between dates, working days with state-specific holidays, calendar weeks, date arithmetic, and more. The application supports German and English languages, includes a REST API, and is designed with accessibility in mind.
|
||||
|
||||
Diese moderne Python-Webanwendung (Flask) ermöglicht verschiedene Datumsberechnungen über eine übersichtliche, barrierefreie Weboberfläche.
|
||||
## Documentation
|
||||
|
||||
## Inhaltsverzeichnis
|
||||
- **[English Documentation](README_en.md)** - Complete documentation in English
|
||||
- **[Deutsche Dokumentation](README_de.md)** - Vollständige Dokumentation auf Deutsch
|
||||
|
||||
- [Demo](#demo)
|
||||
- [Funktionen](#funktionen)
|
||||
- [Installation (lokal)](#installation-lokal)
|
||||
- [Starten der App](#starten-der-app)
|
||||
- [Statistik-Dashboard & Passwortschutz](#statistik-dashboard-stats--passwortschutz)
|
||||
- [Docker (empfohlen für Produktion)](#docker-empfohlen-für-produktion)
|
||||
- [Log-Verzeichnis mounten](#log-verzeichnis-mounten-logs-auf-dem-host-speichern)
|
||||
- [docker-compose Beispiel](#docker-compose-beispiel)
|
||||
- [REST API](#rest-api)
|
||||
- [Tage/Werktage zwischen zwei Daten](#1-tagewerktage-zwischen-zwei-daten)
|
||||
- [Wochentag zu einem Datum](#2-wochentag-zu-einem-datum)
|
||||
- [Kalenderwoche zu Datum](#3-kalenderwoche-zu-datum)
|
||||
- [Start-/Enddatum einer Kalenderwoche](#4-start-enddatum-einer-kalenderwoche)
|
||||
- [Datum plus/minus Tage, Wochen, Monate](#5-datum-plusminus-tage-wochen-monate)
|
||||
- [Statistik](#6-statistik)
|
||||
- [Monitoring & Healthcheck](#7-monitoring--healthcheck)
|
||||
- [Progressive Web App (PWA)](#progressive-web-app-pwa)
|
||||
- [Monitoring & Healthcheck](#monitoring--healthcheck)
|
||||
- [Entwicklung & Hinweise](#entwicklung--hinweise)
|
||||
- [Automatisierte Tests](#automatisierte-tests)
|
||||
- [Hinweise](#hinweise)
|
||||
- [Motivation](#motivation)
|
||||
- [Vibe Coding](#vibe-coding)
|
||||
- [Statistik-Erfassung, Logging](#statistik-erfassung-logging)
|
||||
- [Barrierefreiheit (Accessibility)](#barrierefreiheit-accessibility)
|
||||
- [Code Statistik](#code-statistik)
|
||||
- [Lizenz](#lizenz)
|
||||
|
||||
## Demo
|
||||
|
||||
Datumsrechner Live: [https://date.elpatron.me](https://date.elpatron.me)
|
||||
|
||||

|
||||
|
||||
**[Lighthouse](https://en.wikipedia.org/wiki/Lighthouse_(software))-Performance-Score:**
|
||||
|
||||
Die Webanwendung erreicht hervorragende Performance-Werte in allen Kategorien (Performance, Accessibility, Best Practices, SEO).
|
||||
|
||||
[Lighthouse-Ergebnis (PDF)](./lighthouse/lighthouse-score.pdf)
|
||||
|
||||
## Funktionen
|
||||
|
||||
- Anzahl der Tage zwischen zwei Daten
|
||||
- Anzahl der Werktage zwischen zwei Daten (mit optionaler Berücksichtigung bundeslandspezifischer Feiertage)
|
||||
- Anzeige des Wochentags eines Datums
|
||||
- Datum plus/minus X Tage
|
||||
- Datum plus/minus X Werktage
|
||||
- Datum plus/minus X Wochen/Monate
|
||||
- Kalenderwoche zu Datum
|
||||
- Start-/Enddatum einer Kalenderwoche eines Jahres
|
||||
- Mehrsprachige Unterstützung (Deutsch/Englisch) mit automatischer Browser-Spracherkennung
|
||||
- Sprachausgabe für alle Ergebnisse (barrierefrei)
|
||||
- Statistik-Dashboard mit Passwortschutz unter `/stats`
|
||||
|
||||
## Bundesland-Feiertage
|
||||
|
||||
Die Werktagsberechnung kann optional bundeslandspezifische Feiertage berücksichtigen. Dazu wird die kostenlose API von [feiertage-api.de](https://feiertage-api.de) verwendet.
|
||||
|
||||
**Verfügbare Bundesländer:**
|
||||
- Baden-Württemberg (BW)
|
||||
- Bayern (BY)
|
||||
- Berlin (BE)
|
||||
- Brandenburg (BB)
|
||||
- Bremen (HB)
|
||||
- Hamburg (HH)
|
||||
- Hessen (HE)
|
||||
- Mecklenburg-Vorpommern (MV)
|
||||
- Niedersachsen (NI)
|
||||
- Nordrhein-Westfalen (NW)
|
||||
- Rheinland-Pfalz (RP)
|
||||
- Saarland (SL)
|
||||
- Sachsen (SN)
|
||||
- Sachsen-Anhalt (ST)
|
||||
- Schleswig-Holstein (SH)
|
||||
- Thüringen (TH)
|
||||
|
||||
Die Feiertage werden automatisch für den gewählten Zeitraum abgerufen und bei der Werktagsberechnung als arbeitsfreie Tage behandelt. Im Ergebnis werden zusätzlich die Anzahl der Wochenendtage und Feiertage angezeigt.
|
||||
|
||||
## Mehrsprachige Unterstützung (i18n)
|
||||
|
||||
Die Anwendung unterstützt Deutsch und Englisch mit folgenden Features:
|
||||
|
||||
### Automatische Spracherkennung:
|
||||
- *Browser-Sprache*: Automatische Erkennung der Browser-Einstellung
|
||||
- *URL-Parameter*: Sprachauswahl über `?lang=de` oder `?lang=en`
|
||||
- *localStorage*: Persistente Sprachauswahl im Browser
|
||||
- *Fallback*: Deutsch als Standardsprache
|
||||
|
||||
### *Datenschutzfreundliche Implementierung:*
|
||||
- *Keine Cookies*: Sprachauswahl ohne Cookies
|
||||
- *URL-Parameter*: Transparente Sprachauswahl in der URL
|
||||
- *localStorage*: Lokale Speicherung im Browser
|
||||
- *Teilbare URLs*: URLs mit Sprachauswahl können geteilt werden
|
||||
|
||||
### *Barrierefreiheit:*
|
||||
- *Screenreader*: Vollständige Unterstützung
|
||||
- *Tastatur-Navigation*: Vollständig bedienbar
|
||||
- *ARIA-Attribute*: Korrekte Beschriftungen
|
||||
- *Semantische HTML*: Korrekte Struktur
|
||||
|
||||
### *Technische Details:*
|
||||
- *Flask-Babel*: Professionelle i18n-Implementierung
|
||||
- *Gettext*: Standard für Übersetzungen
|
||||
- *Responsive Design*: Angepasst für alle Geräte
|
||||
- *SEO-freundlich*: URLs sind indexierbar
|
||||
|
||||
## Installation (lokal)
|
||||
|
||||
1. Python 3.8+ installieren
|
||||
2. Abhängigkeiten installieren:
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## Starten der App
|
||||
|
||||
```bash
|
||||
python app.py
|
||||
```
|
||||
|
||||
Die App ist dann unter http://localhost:5000 erreichbar.
|
||||
Visit [https://date.elpatron.me](https://date.elpatron.me) for the live demo.
|
||||
|
||||
## Statistik-Dashboard (/stats) & Passwortschutz
|
||||
## License
|
||||
|
||||
Das Dashboard ist mit einem statischen Passwort geschützt, das über die Umgebungsvariable `STATS_PASSWORD` gesetzt wird.
|
||||
|
||||

|
||||
|
||||
Beispiel (PowerShell):
|
||||
|
||||
```powershell
|
||||
$env:STATS_PASSWORD = "meinSicheresPasswort"
|
||||
python app.py
|
||||
```
|
||||
|
||||
Für Docker:
|
||||
|
||||
```powershell
|
||||
$env:STATS_PASSWORD = "meinSicheresPasswort"
|
||||
docker run -e STATS_PASSWORD=$env:STATS_PASSWORD -p 5000:5000 datumsrechner
|
||||
```
|
||||
|
||||
## Docker (empfohlen für Produktion)
|
||||
|
||||
Die App läuft im Container mit dem WSGI-Server **Gunicorn**:
|
||||
|
||||
```bash
|
||||
docker build -t datumsrechner .
|
||||
docker run -p 5000:5000 datumsrechner
|
||||
```
|
||||
|
||||
- Gunicorn startet automatisch (siehe Dockerfile)
|
||||
- Empfohlen für produktiven Einsatz
|
||||
|
||||
### Log-Verzeichnis mounten (Logs auf dem Host speichern)
|
||||
|
||||
Um die Logdateien außerhalb des Containers zu speichern, kannst du das log-Verzeichnis mounten:
|
||||
|
||||
**PowerShell-Beispiel:**
|
||||
|
||||
```powershell
|
||||
docker run -e STATS_PASSWORD=deinPasswort -p 5000:5000 -v ${PWD}/log:/app/log datumsrechner
|
||||
```
|
||||
|
||||
### docker-compose Beispiel
|
||||
|
||||
Erstelle eine Datei `docker-compose.yml`:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
datumsrechner:
|
||||
build: .
|
||||
ports:
|
||||
- "5000:5000"
|
||||
environment:
|
||||
- STATS_PASSWORD=deinPasswort
|
||||
volumes:
|
||||
- ./log:/app/log
|
||||
```
|
||||
|
||||
Starte mit:
|
||||
|
||||
```bash
|
||||
docker-compose up --build
|
||||
```
|
||||
|
||||
## REST API
|
||||
|
||||
Alle Datumsfunktionen stehen auch als REST-API zur Verfügung. Die API akzeptiert und liefert JSON.
|
||||
**Basis-URL:** `http://localhost:5000/api/`
|
||||
|
||||
**Hinweis:** Die Nutzung der REST API wird im Statistik-Dashboard ausgewertet und als Diagramm angezeigt.
|
||||
|
||||
### Endpunkte und Beispiele
|
||||
|
||||
#### 1. Tage/Werktage zwischen zwei Daten
|
||||
|
||||
**POST** `/api/tage_werktage`
|
||||
|
||||
```json
|
||||
{
|
||||
"start": "2024-06-01",
|
||||
"end": "2024-06-10",
|
||||
"werktage": true,
|
||||
"bundesland": "BY"
|
||||
}
|
||||
```
|
||||
|
||||
**Mit curl:**
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:5000/api/tage_werktage \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"start": "2024-06-01", "end": "2024-06-10", "werktage": true, "bundesland": "BY"}'
|
||||
```
|
||||
|
||||
**Antwort:**
|
||||
|
||||
```json
|
||||
{ "result": 7 }
|
||||
```
|
||||
|
||||
**Hinweis:** Der Parameter `bundesland` ist optional und wird nur bei `"werktage": true` berücksichtigt. Verfügbare Bundesland-Kürzel siehe oben.
|
||||
|
||||
#### 2. Wochentag zu einem Datum
|
||||
|
||||
**POST** `/api/wochentag`
|
||||
|
||||
```json
|
||||
{ "datum": "2024-06-10" }
|
||||
```
|
||||
|
||||
**Mit curl:**
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:5000/api/wochentag \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"datum": "2024-06-10"}'
|
||||
```
|
||||
|
||||
**Antwort:**
|
||||
|
||||
```json
|
||||
{ "result": "Montag" }
|
||||
```
|
||||
|
||||
#### 3. Kalenderwoche zu Datum
|
||||
|
||||
**POST** `/api/kw_berechnen`
|
||||
|
||||
```json
|
||||
{ "datum": "2024-06-10" }
|
||||
```
|
||||
|
||||
**Mit curl:**
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:5000/api/kw_berechnen \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"datum": "2024-06-10"}'
|
||||
```
|
||||
|
||||
**Antwort:**
|
||||
|
||||
```json
|
||||
{ "result": "KW 24 (2024)", "kw": 24, "jahr": 2024 }
|
||||
```
|
||||
|
||||
#### 4. Start-/Enddatum einer Kalenderwoche
|
||||
|
||||
**POST** `/api/kw_datum`
|
||||
|
||||
```json
|
||||
{ "jahr": 2024, "kw": 24 }
|
||||
```
|
||||
|
||||
**Mit curl:**
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:5000/api/kw_datum \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"jahr": 2024, "kw": 24}'
|
||||
```
|
||||
|
||||
**Antwort:**
|
||||
|
||||
```json
|
||||
{
|
||||
"result": "10.06.2024 bis 16.06.2024",
|
||||
"start": "2024-06-10",
|
||||
"end": "2024-06-16"
|
||||
}
|
||||
```
|
||||
|
||||
#### 5. Datum plus/minus Tage, Wochen, Monate
|
||||
|
||||
**POST** `/api/plusminus`
|
||||
|
||||
```json
|
||||
{
|
||||
"datum": "2024-06-10",
|
||||
"anzahl": 5,
|
||||
"einheit": "tage",
|
||||
"richtung": "add",
|
||||
"werktage": false
|
||||
}
|
||||
```
|
||||
|
||||
**Mit curl:**
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:5000/api/plusminus \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"datum": "2024-06-10", "anzahl": 5, "einheit": "tage", "richtung": "add", "werktage": false}'
|
||||
```
|
||||
|
||||
**Antwort:**
|
||||
|
||||
```json
|
||||
{ "result": "2024-06-15" }
|
||||
```
|
||||
|
||||
**Hinweis:**
|
||||
- `"einheit"`: `"tage"`, `"wochen"` oder `"monate"`
|
||||
- `"richtung"`: `"add"` (plus) oder `"sub"` (minus)
|
||||
- `"werktage"`: `true` für Werktage, sonst `false` (nur bei `"tage"` unterstützt)
|
||||
|
||||
#### 6. Statistik
|
||||
|
||||
**GET** `/api/stats`
|
||||
|
||||
**Mit curl:**
|
||||
|
||||
```bash
|
||||
curl http://localhost:5000/api/stats
|
||||
```
|
||||
|
||||
**Antwort:**
|
||||
|
||||
```json
|
||||
{
|
||||
"pageviews": 42,
|
||||
"func_counts": { "plusminus": 10, "tage_werktage": 5 },
|
||||
"impressions_per_day": { "2024-06-10": 7 }
|
||||
}
|
||||
```
|
||||
|
||||
#### 7. Monitoring & Healthcheck
|
||||
|
||||
**GET** `/api/monitor`
|
||||
|
||||
**Mit curl:**
|
||||
|
||||
```bash
|
||||
curl http://localhost:5000/api/monitor
|
||||
```
|
||||
|
||||
**Antwort:**
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "ok",
|
||||
"message": "App running",
|
||||
"time": "2025-07-24T13:37:00.123456",
|
||||
"uptime_seconds": 12345,
|
||||
"pageviews_last_7_days": 42
|
||||
}
|
||||
```
|
||||
This project is licensed under the [MIT License](LICENSE).
|
||||
|
||||
---
|
||||
|
||||
**Fehlerfälle** liefern immer einen HTTP-Statuscode 400 und ein JSON mit `"error"`-Feld, z.B.:
|
||||
|
||||
```json
|
||||
{ "error": "Ungültige Eingabe", "details": "..." }
|
||||
```
|
||||
|
||||
## Progressive Web App (PWA)
|
||||
|
||||
Elpatrons Datumsrechner ist als PWA installierbar (z.B. auf Android/iOS-Homescreen oder Desktop). Die App funktioniert offline für die Startseite und statische Ressourcen, die Datumsberechnung bleibt serverseitig.
|
||||
|
||||
- Manifest und Service Worker sind integriert
|
||||
- App-Icon und Theme-Color für Homescreen
|
||||
- Installation über Browser-Menü ("Zum Startbildschirm hinzufügen")
|
||||
|
||||
## Monitoring & Healthcheck
|
||||
|
||||
Die App bietet einen Monitoring-Endpunkt unter `/monitor`, der Statusinformationen als JSON zurückgibt (z.B. für Uptime-Robot, Docker Healthcheck oder eigene Tools):
|
||||
|
||||
- Status (ok)
|
||||
- Aktuelle Serverzeit
|
||||
- Uptime (Sekunden seit Start)
|
||||
- Pageviews der letzten 7 Tage
|
||||
|
||||
Beispiel-Aufruf:
|
||||
|
||||
```
|
||||
GET https://date.elpatron.me/monitor
|
||||
```
|
||||
|
||||
Antwort:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "ok",
|
||||
"message": "App running",
|
||||
"time": "2025-07-24T13:37:00.123456",
|
||||
"uptime_seconds": 12345,
|
||||
"pageviews_last_7_days": 42
|
||||
}
|
||||
```
|
||||
|
||||
## Entwicklung & Hinweise
|
||||
|
||||
- Die HTML-Templates liegen im Ordner `templates/` (Trennung von Logik und Darstellung)
|
||||
- Das Projekt ist auf Codeberg gehostet: [https://codeberg.org/elpatron/datecalc](https://codeberg.org/elpatron/datecalc)
|
||||
- Modernes, responsives Design mit Akkordeon und Icons
|
||||
|
||||
## Automatisierte Tests
|
||||
|
||||
Automatisierte Tests sind mit pytest möglich:
|
||||
|
||||
```powershell
|
||||
pip install -r requirements.txt
|
||||
pytest test_app.py
|
||||
```
|
||||
|
||||
Die Tests prüfen u.a. die Erreichbarkeit der App, die wichtigsten Funktionen und den Schutz vor XSS-Angriffen.
|
||||
|
||||
## Hinweise
|
||||
|
||||
### Motivation
|
||||
|
||||
Finde mal eine Datumsrechner- Webapp, die nicht völlig Werbe- und Tracking verseucht ist! Da ich sowas häufiger mal brauche, hab ich mir eine eigene gemacht.
|
||||
|
||||
### Vibe Coding
|
||||
|
||||
Dieses Projekt wurde zu nahezu 100% mit Unterstützung künsticher Intelligenz (*[Vibe Coding](https://de.wikipedia.org/wiki/Vibe_Coding)*) erstellt. Das Grundgerüst war nach ca. 45 Minuten fertig gestellt, insgesamt hat die Entwicklung des Projekts ca. 4 Stunden Zeit beansprucht.
|
||||
|
||||
### Statistik-Erfassung, Logging
|
||||
|
||||
Es werden keine IP-Adressen oder sonstigen persönlichen Daten gespeichert, lediglich die Zahl der Aufrufe der Funktionen in einer kumulierten Darstellung. Die Logdatei enthält nur Einträge der letzten sieben Tage.
|
||||
|
||||
### Barrierefreiheit (Accessibility)
|
||||
|
||||
*Elpatrons Datumsrechner* ist barrierefrei gestaltet und erfüllt zentrale Anforderungen an Accessibility (a11y):
|
||||
|
||||
- *Semantische HTML-Struktur:* Überschriften, Labels und Formularelemente sind korrekt ausgezeichnet und verknüpft.
|
||||
- *ARIA-Attribute:* Accordion und Statusmeldungen sind mit ARIA-Attributen versehen, damit Screenreader die Struktur und Zustände erkennen.
|
||||
- *Tastaturbedienbarkeit:* Alle interaktiven Elemente (Accordion, Buttons, Formulare) sind vollständig per Tastatur bedienbar (inkl. Fokus-Indikator und Pfeiltasten-Navigation im Accordion).
|
||||
- *Fokus-Indikatoren:* Deutliche visuelle Hervorhebung des Fokus für alle Bedienelemente.
|
||||
- *Farbkontraste:* Hohe Kontraste für Texte, Buttons und Ergebnisboxen, geprüft nach WCAG-Richtlinien.
|
||||
- *Status- und Fehlermeldungen:* Ergebnisse und Fehler werden mit `aria-live` für Screenreader zugänglich gemacht.
|
||||
- *Sprachausgabe:* Alle Ergebnisse können über 🔊-Buttons vorgelesen werden (Web Speech API, deutsche Sprache).
|
||||
- *Mobile Optimierung:* Zusätzliche Meta-Tags für bessere Bedienbarkeit auf mobilen Geräten und Unterstützung von Screenreadern.
|
||||
- *SEO:* Das Thema Barrierefreiheit ist in den Meta-Tags für Suchmaschinen sichtbar.
|
||||
|
||||
Damit ist die App für Menschen mit unterschiedlichen Einschränkungen (z.B. Sehbehinderung, motorische Einschränkungen) gut nutzbar und entspricht modernen Webstandards.
|
||||
|
||||
### Code Statistik
|
||||
|
||||
cloc|github.com/AlDanial/cloc v 2.06 T=0.17 s (146.7 files/s, 35235.5 lines/s)
|
||||
--- | ---
|
||||
|
||||
Language|files|blank|comment|code
|
||||
:-------|-------:|-------:|-------:|-------:
|
||||
HTML|8|48|6|2092
|
||||
Python|2|59|68|690
|
||||
JavaScript|2|95|87|571
|
||||
Markdown|3|176|0|493
|
||||
PO File|2|234|240|492
|
||||
JSON|3|0|0|243
|
||||
CSS|1|186|3|188
|
||||
SVG|2|0|0|14
|
||||
Dockerfile|1|5|6|8
|
||||
DOS Batch|1|0|0|1
|
||||
--------|--------|--------|--------|--------
|
||||
SUM:|25|803|410|4792
|
||||
|
||||
## Lizenz
|
||||
|
||||
Dieses Projekt steht unter der [MIT-Lizenz](LICENSE).
|
||||
|
||||
---
|
||||
(c) 2025 [Markus Busche](https://digitalcourage.social/@elpatron)
|
||||
|
||||
**Version 1.4.0** - Mehrsprachige Unterstützung hinzugefügt
|
||||
(c) 2025 [Markus Busche](https://digitalcourage.social/@elpatron)
|
512
README_de.md
Normal file
512
README_de.md
Normal file
@@ -0,0 +1,512 @@
|
||||
# Elpatrons Datumsrechner
|
||||
|
||||
[](https://github.com/elpatron/datecalc)
|
||||
[](https://date.elpatron.me)
|
||||
[](https://date.elpatron.me)
|
||||
[](https://date.elpatron.me)
|
||||
[](https://date.elpatron.me)
|
||||
|
||||
Diese moderne Python-Webanwendung (Flask) ermöglicht verschiedene Datumsberechnungen über eine übersichtliche, barrierefreie Weboberfläche.
|
||||
|
||||
## Inhaltsverzeichnis
|
||||
|
||||
- [Demo](#demo)
|
||||
- [Funktionen](#funktionen)
|
||||
- [Installation (lokal)](#installation-lokal)
|
||||
- [Starten der App](#starten-der-app)
|
||||
- [Statistik-Dashboard & Passwortschutz](#statistik-dashboard-stats--passwortschutz)
|
||||
- [Docker (empfohlen für Produktion)](#docker-empfohlen-für-produktion)
|
||||
- [Log-Verzeichnis mounten](#log-verzeichnis-mounten-logs-auf-dem-host-speichern)
|
||||
- [docker-compose Beispiel](#docker-compose-beispiel)
|
||||
- [REST API](#rest-api)
|
||||
- [Tage/Werktage zwischen zwei Daten](#1-tagewerktage-zwischen-zwei-daten)
|
||||
- [Wochentag zu einem Datum](#2-wochentag-zu-einem-datum)
|
||||
- [Kalenderwoche zu Datum](#3-kalenderwoche-zu-datum)
|
||||
- [Start-/Enddatum einer Kalenderwoche](#4-start-enddatum-einer-kalenderwoche)
|
||||
- [Datum plus/minus Tage, Wochen, Monate](#5-datum-plusminus-tage-wochen-monate)
|
||||
- [Statistik](#6-statistik)
|
||||
- [Monitoring & Healthcheck](#7-monitoring--healthcheck)
|
||||
- [Progressive Web App (PWA)](#progressive-web-app-pwa)
|
||||
- [Monitoring & Healthcheck](#monitoring--healthcheck)
|
||||
- [Entwicklung & Hinweise](#entwicklung--hinweise)
|
||||
- [Automatisierte Tests](#automatisierte-tests)
|
||||
- [Hinweise](#hinweise)
|
||||
- [Motivation](#motivation)
|
||||
- [Vibe Coding](#vibe-coding)
|
||||
- [Statistik-Erfassung, Logging](#statistik-erfassung-logging)
|
||||
- [Barrierefreiheit (Accessibility)](#barrierefreiheit-accessibility)
|
||||
- [Code Statistik](#code-statistik)
|
||||
- [Lizenz](#lizenz)
|
||||
|
||||
## Demo
|
||||
|
||||
Datumsrechner Live: [https://date.elpatron.me](https://date.elpatron.me)
|
||||
|
||||
[](https://date.elpatron.me)
|
||||
|
||||
**[Lighthouse](https://en.wikipedia.org/wiki/Lighthouse_(software))-Performance-Score:**
|
||||
|
||||
Die Webanwendung erreicht hervorragende Performance-Werte in allen Kategorien (Performance, Accessibility, Best Practices, SEO).
|
||||
|
||||
[Lighthouse-Ergebnis (PDF)](./lighthouse/lighthouse-score.pdf)
|
||||
|
||||
## Funktionen
|
||||
|
||||
- Anzahl der Tage zwischen zwei Daten
|
||||
- Anzahl der Werktage zwischen zwei Daten (mit optionaler Berücksichtigung bundeslandspezifischer Feiertage)
|
||||
- Anzeige des Wochentags eines Datums
|
||||
- Datum plus/minus X Tage
|
||||
- Datum plus/minus X Werktage
|
||||
- Datum plus/minus X Wochen/Monate
|
||||
- Kalenderwoche zu Datum
|
||||
- Start-/Enddatum einer Kalenderwoche eines Jahres
|
||||
- Integrierter Taschenrechner mit History und Sprachausgabe
|
||||
- Mehrsprachige Unterstützung (Deutsch/Englisch) mit automatischer Browser-Spracherkennung
|
||||
- Sprachausgabe für alle Ergebnisse (barrierefrei)
|
||||
- Statistik-Dashboard mit Passwortschutz unter `/stats`
|
||||
|
||||
## Bundesland-Feiertage
|
||||
|
||||
Die Werktagsberechnung kann optional bundeslandspezifische Feiertage berücksichtigen. Dazu wird die kostenlose API von [feiertage-api.de](https://feiertage-api.de) verwendet.
|
||||
|
||||
**Verfügbare Bundesländer:**
|
||||
|
||||
- Baden-Württemberg (BW)
|
||||
- Bayern (BY)
|
||||
- Berlin (BE)
|
||||
- Brandenburg (BB)
|
||||
- Bremen (HB)
|
||||
- Hamburg (HH)
|
||||
- Hessen (HE)
|
||||
- Mecklenburg-Vorpommern (MV)
|
||||
- Niedersachsen (NI)
|
||||
- Nordrhein-Westfalen (NW)
|
||||
- Rheinland-Pfalz (RP)
|
||||
- Saarland (SL)
|
||||
- Sachsen (SN)
|
||||
- Sachsen-Anhalt (ST)
|
||||
- Schleswig-Holstein (SH)
|
||||
- Thüringen (TH)
|
||||
|
||||
Die Feiertage werden automatisch für den gewählten Zeitraum abgerufen und bei der Werktagsberechnung als arbeitsfreie Tage behandelt. Im Ergebnis werden zusätzlich die Anzahl der Wochenendtage und Feiertage angezeigt.
|
||||
|
||||
## Mehrsprachige Unterstützung (i18n)
|
||||
|
||||
Die Anwendung unterstützt Deutsch und Englisch mit folgenden Features:
|
||||
|
||||
### Automatische Spracherkennung:
|
||||
|
||||
- *Browser-Sprache*: Automatische Erkennung der Browser-Einstellung
|
||||
- *URL-Parameter*: Sprachauswahl über `?lang=de` oder `?lang=en`
|
||||
- *localStorage*: Persistente Sprachauswahl im Browser
|
||||
- *Fallback*: Deutsch als Standardsprache
|
||||
|
||||
### *Datenschutzfreundliche Implementierung:*
|
||||
|
||||
- *Keine Cookies*: Sprachauswahl ohne Cookies
|
||||
- *URL-Parameter*: Transparente Sprachauswahl in der URL
|
||||
- *localStorage*: Lokale Speicherung im Browser
|
||||
- *Teilbare URLs*: URLs mit Sprachauswahl können geteilt werden
|
||||
|
||||
### *Barrierefreiheit:*
|
||||
|
||||
- *Screenreader*: Vollständige Unterstützung
|
||||
- *Tastatur-Navigation*: Vollständig bedienbar
|
||||
- *ARIA-Attribute*: Korrekte Beschriftungen
|
||||
- *Semantische HTML*: Korrekte Struktur
|
||||
- *Taschenrechner*: Vollständig barrierefrei mit Tastatur-Bedienung und Sprachausgabe
|
||||
|
||||
### *Technische Details:*
|
||||
|
||||
- *Flask-Babel*: Professionelle i18n-Implementierung
|
||||
- *Gettext*: Standard für Übersetzungen
|
||||
- *Responsive Design*: Angepasst für alle Geräte
|
||||
- *SEO-freundlich*: URLs sind indexierbar
|
||||
|
||||
## Installation (lokal)
|
||||
|
||||
1. Python 3.8+ installieren
|
||||
2. Abhängigkeiten installieren:
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## Starten der App
|
||||
|
||||
```bash
|
||||
python app.py
|
||||
```
|
||||
|
||||
Die App ist dann unter http://localhost:5000 erreichbar.
|
||||
|
||||
## Statistik-Dashboard (/stats) & Passwortschutz
|
||||
|
||||
Das Dashboard ist mit einem statischen Passwort geschützt, das über die Umgebungsvariable `STATS_PASSWORD` gesetzt wird.
|
||||
|
||||

|
||||
|
||||
Beispiel (PowerShell):
|
||||
|
||||
```powershell
|
||||
$env:STATS_PASSWORD = "meinSicheresPasswort"
|
||||
python app.py
|
||||
```
|
||||
|
||||
Für Docker:
|
||||
|
||||
```powershell
|
||||
$env:STATS_PASSWORD = "meinSicheresPasswort"
|
||||
docker run -e STATS_PASSWORD=$env:STATS_PASSWORD -p 5000:5000 datumsrechner
|
||||
```
|
||||
|
||||
## Docker (empfohlen für Produktion)
|
||||
|
||||
Die App läuft im Container mit dem WSGI-Server **Gunicorn**:
|
||||
|
||||
```bash
|
||||
docker build -t datumsrechner .
|
||||
docker run -p 5000:5000 datumsrechner
|
||||
```
|
||||
|
||||
- Gunicorn startet automatisch (siehe Dockerfile)
|
||||
- Empfohlen für produktiven Einsatz
|
||||
|
||||
### Log-Verzeichnis mounten (Logs auf dem Host speichern)
|
||||
|
||||
Um die Logdateien außerhalb des Containers zu speichern, kannst du das log-Verzeichnis mounten:
|
||||
|
||||
**PowerShell-Beispiel:**
|
||||
|
||||
```powershell
|
||||
docker run -e STATS_PASSWORD=deinPasswort -p 5000:5000 -v ${PWD}/log:/app/log datumsrechner
|
||||
```
|
||||
|
||||
### docker-compose Beispiel
|
||||
|
||||
Erstelle eine Datei `docker-compose.yml`:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
datumsrechner:
|
||||
build: .
|
||||
ports:
|
||||
- "5000:5000"
|
||||
environment:
|
||||
- STATS_PASSWORD=deinPasswort
|
||||
volumes:
|
||||
- ./log:/app/log
|
||||
```
|
||||
|
||||
Starte mit:
|
||||
|
||||
```bash
|
||||
docker-compose up --build
|
||||
```
|
||||
|
||||
## REST API
|
||||
|
||||
Alle Datumsfunktionen stehen auch als REST-API zur Verfügung. Die API akzeptiert und liefert JSON.
|
||||
|
||||
**Basis-URL:** `http://localhost:5000/api/`
|
||||
|
||||
**Swagger Dokumentation:** [https://date.elpatron.me/api-docs](https://date.elpatron.me/api-docs)
|
||||
|
||||
**Hinweis:** Die Nutzung der REST API wird im Statistik-Dashboard ausgewertet und als Diagramm angezeigt.
|
||||
|
||||
### Endpunkte und Beispiele
|
||||
|
||||
#### 1. Tage/Werktage zwischen zwei Daten
|
||||
|
||||
**POST** `/api/tage_werktage`
|
||||
|
||||
```json
|
||||
{
|
||||
"start": "2024-06-01",
|
||||
"end": "2024-06-10",
|
||||
"werktage": true,
|
||||
"bundesland": "BY"
|
||||
}
|
||||
```
|
||||
|
||||
**Mit curl:**
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:5000/api/tage_werktage \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"start": "2024-06-01", "end": "2024-06-10", "werktage": true, "bundesland": "BY"}'
|
||||
```
|
||||
|
||||
**Antwort:**
|
||||
|
||||
```json
|
||||
{ "result": 7 }
|
||||
```
|
||||
|
||||
**Hinweis:** Der Parameter `bundesland` ist optional und wird nur bei `"werktage": true` berücksichtigt. Verfügbare Bundesland-Kürzel siehe oben.
|
||||
|
||||
#### 2. Wochentag zu einem Datum
|
||||
|
||||
**POST** `/api/wochentag`
|
||||
|
||||
```json
|
||||
{ "datum": "2024-06-10" }
|
||||
```
|
||||
|
||||
**Mit curl:**
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:5000/api/wochentag \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"datum": "2024-06-10"}'
|
||||
```
|
||||
|
||||
**Antwort:**
|
||||
|
||||
```json
|
||||
{ "result": "Montag" }
|
||||
```
|
||||
|
||||
#### 3. Kalenderwoche zu Datum
|
||||
|
||||
**POST** `/api/kw_berechnen`
|
||||
|
||||
```json
|
||||
{ "datum": "2024-06-10" }
|
||||
```
|
||||
|
||||
**Mit curl:**
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:5000/api/kw_berechnen \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"datum": "2024-06-10"}'
|
||||
```
|
||||
|
||||
**Antwort:**
|
||||
|
||||
```json
|
||||
{ "result": "KW 24 (2024)", "kw": 24, "jahr": 2024 }
|
||||
```
|
||||
|
||||
#### 4. Start-/Enddatum einer Kalenderwoche
|
||||
|
||||
**POST** `/api/kw_datum`
|
||||
|
||||
```json
|
||||
{ "jahr": 2024, "kw": 24 }
|
||||
```
|
||||
|
||||
**Mit curl:**
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:5000/api/kw_datum \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"jahr": 2024, "kw": 24}'
|
||||
```
|
||||
|
||||
**Antwort:**
|
||||
|
||||
```json
|
||||
{
|
||||
"result": "10.06.2024 bis 16.06.2024",
|
||||
"start": "2024-06-10",
|
||||
"end": "2024-06-16"
|
||||
}
|
||||
```
|
||||
|
||||
#### 5. Datum plus/minus Tage, Wochen, Monate
|
||||
|
||||
**POST** `/api/plusminus`
|
||||
|
||||
```json
|
||||
{
|
||||
"datum": "2024-06-10",
|
||||
"anzahl": 5,
|
||||
"einheit": "tage",
|
||||
"richtung": "add",
|
||||
"werktage": false
|
||||
}
|
||||
```
|
||||
|
||||
**Mit curl:**
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:5000/api/plusminus \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"datum": "2024-06-10", "anzahl": 5, "einheit": "tage", "richtung": "add", "werktage": false}'
|
||||
```
|
||||
|
||||
**Antwort:**
|
||||
|
||||
```json
|
||||
{ "result": "2024-06-15" }
|
||||
```
|
||||
|
||||
**Hinweis:**
|
||||
|
||||
- `"einheit"`: `"tage"`, `"wochen"` oder `"monate"`
|
||||
- `"richtung"`: `"add"` (plus) oder `"sub"` (minus)
|
||||
- `"werktage"`: `true` für Werktage, sonst `false` (nur bei `"tage"` unterstützt)
|
||||
|
||||
#### 6. Statistik
|
||||
|
||||
**GET** `/api/stats`
|
||||
|
||||
**Mit curl:**
|
||||
|
||||
```bash
|
||||
curl http://localhost:5000/api/stats
|
||||
```
|
||||
|
||||
**Antwort:**
|
||||
|
||||
```json
|
||||
{
|
||||
"pageviews": 42,
|
||||
"func_counts": { "plusminus": 10, "tage_werktage": 5 },
|
||||
"impressions_per_day": { "2024-06-10": 7 }
|
||||
}
|
||||
```
|
||||
|
||||
#### 7. Monitoring & Healthcheck
|
||||
|
||||
**GET** `/api/monitor`
|
||||
|
||||
**Mit curl:**
|
||||
|
||||
```bash
|
||||
curl http://localhost:5000/api/monitor
|
||||
```
|
||||
|
||||
**Antwort:**
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "ok",
|
||||
"message": "App running",
|
||||
"time": "2025-07-24T13:37:00.123456",
|
||||
"uptime_seconds": 12345,
|
||||
"pageviews_last_7_days": 42
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Fehlerfälle** liefern immer einen HTTP-Statuscode 400 und ein JSON mit `"error"`-Feld, z.B.:
|
||||
|
||||
```json
|
||||
{ "error": "Ungültige Eingabe", "details": "..." }
|
||||
```
|
||||
|
||||
## Progressive Web App (PWA)
|
||||
|
||||
Elpatrons Datumsrechner ist als PWA installierbar (z.B. auf Android/iOS-Homescreen oder Desktop). Die App funktioniert offline für die Startseite und statische Ressourcen, die Datumsberechnung bleibt serverseitig.
|
||||
|
||||
- Manifest und Service Worker sind integriert
|
||||
- App-Icon und Theme-Color für Homescreen
|
||||
- Installation über Browser-Menü ("Zum Startbildschirm hinzufügen")
|
||||
- Taschenrechner funktioniert vollständig clientseitig (offline verfügbar)
|
||||
|
||||
## Monitoring & Healthcheck
|
||||
|
||||
Die App bietet einen Monitoring-Endpunkt unter `/monitor`, der Statusinformationen als JSON zurückgibt (z.B. für Uptime-Robot, Docker Healthcheck oder eigene Tools):
|
||||
|
||||
- Status (ok)
|
||||
- Aktuelle Serverzeit
|
||||
- Uptime (Sekunden seit Start)
|
||||
- Pageviews der letzten 7 Tage
|
||||
|
||||
Beispiel-Aufruf:
|
||||
|
||||
`GET https://date.elpatron.me/monitor`
|
||||
|
||||
Antwort:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "ok",
|
||||
"message": "App running",
|
||||
"time": "2025-07-24T13:37:00.123456",
|
||||
"uptime_seconds": 12345,
|
||||
"pageviews_last_7_days": 42
|
||||
}
|
||||
```
|
||||
|
||||
## Entwicklung & Hinweise
|
||||
|
||||
- Die HTML-Templates liegen im Ordner `templates/` (Trennung von Logik und Darstellung)
|
||||
- Das Projekt ist auf Codeberg gehostet: [https://codeberg.org/elpatron/datecalc](https://codeberg.org/elpatron/datecalc)
|
||||
- Modernes, responsives Design mit Akkordeon und Icons
|
||||
|
||||
## Automatisierte Tests
|
||||
|
||||
Automatisierte Tests sind mit pytest möglich:
|
||||
|
||||
```powershell
|
||||
pip install -r requirements.txt
|
||||
pytest test_app.py
|
||||
```
|
||||
|
||||
Die Tests prüfen u.a. die Erreichbarkeit der App, die wichtigsten Funktionen und den Schutz vor XSS-Angriffen.
|
||||
|
||||
## Hinweise
|
||||
|
||||
### Motivation
|
||||
|
||||
Finde mal eine Datumsrechner- Webapp, die nicht völlig Werbe- und Tracking verseucht ist! Da ich sowas häufiger mal brauche, hab ich mir eine eigene gemacht.
|
||||
|
||||
### Vibe Coding
|
||||
|
||||
Dieses Projekt wurde zu nahezu 100% mit Unterstützung künsticher Intelligenz (*[Vibe Coding](https://de.wikipedia.org/wiki/Vibe_Coding)*) erstellt. Das Grundgerüst war nach ca. 45 Minuten fertig gestellt, insgesamt hat die Entwicklung des Projekts ca. 12 Stunden Zeit beansprucht.
|
||||
|
||||
### Statistik-Erfassung, Logging
|
||||
|
||||
Es werden keine IP-Adressen oder sonstigen persönlichen Daten gespeichert, lediglich die Zahl der Aufrufe der Funktionen in einer kumulierten Darstellung. Die Logdatei enthält nur Einträge der letzten sieben Tage.
|
||||
|
||||
### Barrierefreiheit (Accessibility)
|
||||
|
||||
*Elpatrons Datumsrechner* ist barrierefrei gestaltet und erfüllt zentrale Anforderungen an Accessibility (a11y):
|
||||
|
||||
- *Semantische HTML-Struktur:* Überschriften, Labels und Formularelemente sind korrekt ausgezeichnet und verknüpft.
|
||||
- *ARIA-Attribute:* Accordion und Statusmeldungen sind mit ARIA-Attributen versehen, damit Screenreader die Struktur und Zustände erkennen.
|
||||
- *Tastaturbedienbarkeit:* Alle interaktiven Elemente (Accordion, Buttons, Formulare) sind vollständig per Tastatur bedienbar (inkl. Fokus-Indikator und Pfeiltasten-Navigation im Accordion).
|
||||
- *Fokus-Indikatoren:* Deutliche visuelle Hervorhebung des Fokus für alle Bedienelemente.
|
||||
- *Farbkontraste:* Hohe Kontraste für Texte, Buttons und Ergebnisboxen, geprüft nach WCAG-Richtlinien.
|
||||
- *Status- und Fehlermeldungen:* Ergebnisse und Fehler werden mit `aria-live` für Screenreader zugänglich gemacht.
|
||||
- *Sprachausgabe:* Alle Ergebnisse können über 🔊-Buttons vorgelesen werden (Web Speech API, deutsche Sprache).
|
||||
- *Taschenrechner:* Vollständig barrierefrei mit Tastatur-Bedienung, Sprachausgabe und History-Funktion.
|
||||
- *Mobile Optimierung:* Zusätzliche Meta-Tags für bessere Bedienbarkeit auf mobilen Geräten und Unterstützung von Screenreadern.
|
||||
- *SEO:* Das Thema Barrierefreiheit ist in den Meta-Tags für Suchmaschinen sichtbar.
|
||||
|
||||
Damit ist die App für Menschen mit unterschiedlichen Einschränkungen (z.B. Sehbehinderung, motorische Einschränkungen) gut nutzbar und entspricht modernen Webstandards.
|
||||
|
||||
### Code Statistik
|
||||
|
||||
cloc|github.com/AlDanial/cloc v 2.06 T=0.22 s (124.7 files/s, 34058.5 lines/s)
|
||||
--- | ---
|
||||
|
||||
Language|files|blank|comment|code
|
||||
:-------|-------:|-------:|-------:|-------:
|
||||
HTML|8|159|8|2806
|
||||
Markdown|5|340|0|876
|
||||
Python|2|68|76|744
|
||||
JavaScript|2|95|88|580
|
||||
PO File|2|260|266|544
|
||||
JSON|3|0|0|243
|
||||
CSS|1|186|3|188
|
||||
XML|1|10|4|69
|
||||
SVG|2|0|0|14
|
||||
Dockerfile|1|5|6|8
|
||||
DOS Batch|1|0|0|1
|
||||
--------|--------|--------|--------|--------
|
||||
SUM:|28|1123|451|6073
|
||||
|
||||
## Lizenz
|
||||
|
||||
Dieses Projekt steht unter der [MIT-Lizenz](LICENSE).
|
||||
|
||||
---
|
||||
(c) 2025 [Markus Busche](https://digitalcourage.social/@elpatron)
|
||||
|
||||
**Version 1.4.12** - Integrierter Taschenrechner mit History und Sprachausgabe hinzugefügt
|
512
README_en.md
Normal file
512
README_en.md
Normal file
@@ -0,0 +1,512 @@
|
||||
# Elpatrons Date Calculator
|
||||
|
||||
[](https://github.com/elpatron/datecalc)
|
||||
[](https://date.elpatron.me)
|
||||
[](https://date.elpatron.me)
|
||||
[](https://date.elpatron.me)
|
||||
[](https://date.elpatron.me)
|
||||
|
||||
This modern Python web application (Flask) enables various date calculations through a clear, accessible web interface.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Demo](#demo)
|
||||
- [Features](#features)
|
||||
- [Installation (local)](#installation-local)
|
||||
- [Starting the App](#starting-the-app)
|
||||
- [Statistics Dashboard & Password Protection](#statistics-dashboard--password-protection)
|
||||
- [Docker (recommended for production)](#docker-recommended-for-production)
|
||||
- [Mounting log directory](#mounting-log-directory-logs-stored-on-host)
|
||||
- [docker-compose example](#docker-compose-example)
|
||||
- [REST API](#rest-api)
|
||||
- [Days/Working days between two dates](#1-daysworking-days-between-two-dates)
|
||||
- [Weekday for a date](#2-weekday-for-a-date)
|
||||
- [Calendar week for date](#3-calendar-week-for-date)
|
||||
- [Start/End date of a calendar week](#4-startend-date-of-a-calendar-week)
|
||||
- [Date plus/minus days, weeks, months](#5-date-plusminus-days-weeks-months)
|
||||
- [Statistics](#6-statistics)
|
||||
- [Monitoring & Healthcheck](#7-monitoring--healthcheck)
|
||||
- [Progressive Web App (PWA)](#progressive-web-app-pwa)
|
||||
- [Monitoring & Healthcheck](#monitoring--healthcheck)
|
||||
- [Development & Notes](#development--notes)
|
||||
- [Automated Tests](#automated-tests)
|
||||
- [Notes](#notes)
|
||||
- [Motivation](#motivation)
|
||||
- [Vibe Coding](#vibe-coding)
|
||||
- [Statistics collection, Logging](#statistics-collection-logging)
|
||||
- [Accessibility](#accessibility)
|
||||
- [Code Statistics](#code-statistics)
|
||||
- [License](#license)
|
||||
|
||||
## Demo
|
||||
|
||||
Date Calculator Live: [https://date.elpatron.me](https://date.elpatron.me)
|
||||
|
||||
[](https://date.elpatron.me)
|
||||
|
||||
**[Lighthouse](https://en.wikipedia.org/wiki/Lighthouse_(software)) Performance Score:**
|
||||
|
||||
The web application achieves excellent performance values in all categories (Performance, Accessibility, Best Practices, SEO).
|
||||
|
||||
[Lighthouse Result (PDF)](./lighthouse/lighthouse-score.pdf)
|
||||
|
||||
## Features
|
||||
|
||||
- Number of days between two dates
|
||||
- Number of working days between two dates (with optional consideration of state-specific holidays)
|
||||
- Display of the weekday of a date
|
||||
- Date plus/minus X days
|
||||
- Date plus/minus X working days
|
||||
- Date plus/minus X weeks/months
|
||||
- Calendar week for date
|
||||
- Start/End date of a calendar week of a year
|
||||
- Integrated calculator with history and speech output
|
||||
- Multilingual support (German/English) with automatic browser language detection
|
||||
- Speech output for all results (accessible)
|
||||
- Statistics dashboard with password protection under `/stats`
|
||||
|
||||
## State Holidays
|
||||
|
||||
The working day calculation can optionally consider state-specific holidays. The free API from [feiertage-api.de](https://feiertage-api.de) is used for this purpose.
|
||||
|
||||
**Available States:**
|
||||
|
||||
- Baden-Württemberg (BW)
|
||||
- Bavaria (BY)
|
||||
- Berlin (BE)
|
||||
- Brandenburg (BB)
|
||||
- Bremen (HB)
|
||||
- Hamburg (HH)
|
||||
- Hesse (HE)
|
||||
- Mecklenburg-Vorpommern (MV)
|
||||
- Lower Saxony (NI)
|
||||
- North Rhine-Westphalia (NW)
|
||||
- Rhineland-Palatinate (RP)
|
||||
- Saarland (SL)
|
||||
- Saxony (SN)
|
||||
- Saxony-Anhalt (ST)
|
||||
- Schleswig-Holstein (SH)
|
||||
- Thuringia (TH)
|
||||
|
||||
Holidays are automatically retrieved for the selected time period and treated as non-working days in the working day calculation. The result also shows the number of weekend days and holidays.
|
||||
|
||||
## Multilingual Support (i18n)
|
||||
|
||||
The application supports German and English with the following features:
|
||||
|
||||
### Automatic Language Detection:
|
||||
|
||||
- *Browser Language*: Automatic detection of browser settings
|
||||
- *URL Parameter*: Language selection via `?lang=de` or `?lang=en`
|
||||
- *localStorage*: Persistent language selection in browser
|
||||
- *Fallback*: German as default language
|
||||
|
||||
### *Privacy-friendly Implementation:*
|
||||
|
||||
- *No Cookies*: Language selection without cookies
|
||||
- *URL Parameters*: Transparent language selection in URL
|
||||
- *localStorage*: Local storage in browser
|
||||
- *Shareable URLs*: URLs with language selection can be shared
|
||||
|
||||
### *Accessibility:*
|
||||
|
||||
- *Screen Reader*: Full support
|
||||
- *Keyboard Navigation*: Fully operable
|
||||
- *ARIA Attributes*: Correct labels
|
||||
- *Semantic HTML*: Correct structure
|
||||
- *Calculator*: Fully accessible with keyboard operation and speech output
|
||||
|
||||
### *Technical Details:*
|
||||
|
||||
- *Flask-Babel*: Professional i18n implementation
|
||||
- *Gettext*: Standard for translations
|
||||
- *Responsive Design*: Adapted for all devices
|
||||
- *SEO-friendly*: URLs are indexable
|
||||
|
||||
## Installation (local)
|
||||
|
||||
1. Install Python 3.8+
|
||||
2. Install dependencies:
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## Starting the App
|
||||
|
||||
```bash
|
||||
python app.py
|
||||
```
|
||||
|
||||
The app is then accessible at http://localhost:5000.
|
||||
|
||||
## Statistics Dashboard (/stats) & Password Protection
|
||||
|
||||
The dashboard is protected with a static password that is set via the environment variable `STATS_PASSWORD`.
|
||||
|
||||

|
||||
|
||||
Example (PowerShell):
|
||||
|
||||
```powershell
|
||||
$env:STATS_PASSWORD = "mySecurePassword"
|
||||
python app.py
|
||||
```
|
||||
|
||||
For Docker:
|
||||
|
||||
```powershell
|
||||
$env:STATS_PASSWORD = "mySecurePassword"
|
||||
docker run -e STATS_PASSWORD=$env:STATS_PASSWORD -p 5000:5000 datumsrechner
|
||||
```
|
||||
|
||||
## Docker (recommended for production)
|
||||
|
||||
The app runs in a container with the **Gunicorn** WSGI server:
|
||||
|
||||
```bash
|
||||
docker build -t datumsrechner .
|
||||
docker run -p 5000:5000 datumsrechner
|
||||
```
|
||||
|
||||
- Gunicorn starts automatically (see Dockerfile)
|
||||
- Recommended for production use
|
||||
|
||||
### Mounting log directory (Logs stored on host)
|
||||
|
||||
To store log files outside the container, you can mount the log directory:
|
||||
|
||||
**PowerShell Example:**
|
||||
|
||||
```powershell
|
||||
docker run -e STATS_PASSWORD=yourPassword -p 5000:5000 -v ${PWD}/log:/app/log datumsrechner
|
||||
```
|
||||
|
||||
### docker-compose example
|
||||
|
||||
Create a `docker-compose.yml` file:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
datumsrechner:
|
||||
build: .
|
||||
ports:
|
||||
- "5000:5000"
|
||||
environment:
|
||||
- STATS_PASSWORD=yourPassword
|
||||
volumes:
|
||||
- ./log:/app/log
|
||||
```
|
||||
|
||||
Start with:
|
||||
|
||||
```bash
|
||||
docker-compose up --build
|
||||
```
|
||||
|
||||
## REST API
|
||||
|
||||
All date functions are also available as a REST API. The API accepts and returns JSON.
|
||||
|
||||
**Base URL:** `http://localhost:5000/api/`
|
||||
|
||||
**Swagger Documentation:** [https://date.elpatron.me/api-docs](https://date.elpatron.me/api-docs)
|
||||
|
||||
**Note:** The use of the REST API is evaluated in the statistics dashboard and displayed as a chart.
|
||||
|
||||
### Endpoints and Examples
|
||||
|
||||
#### 1. Days/Working days between two dates
|
||||
|
||||
**POST** `/api/tage_werktage`
|
||||
|
||||
```json
|
||||
{
|
||||
"start": "2024-06-01",
|
||||
"end": "2024-06-10",
|
||||
"werktage": true,
|
||||
"bundesland": "BY"
|
||||
}
|
||||
```
|
||||
|
||||
**With curl:**
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:5000/api/tage_werktage \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"start": "2024-06-01", "end": "2024-06-10", "werktage": true, "bundesland": "BY"}'
|
||||
```
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{ "result": 7 }
|
||||
```
|
||||
|
||||
**Note:** The `bundesland` parameter is optional and is only considered when `"werktage": true`. Available state abbreviations see above.
|
||||
|
||||
#### 2. Weekday for a date
|
||||
|
||||
**POST** `/api/wochentag`
|
||||
|
||||
```json
|
||||
{ "datum": "2024-06-10" }
|
||||
```
|
||||
|
||||
**With curl:**
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:5000/api/wochentag \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"datum": "2024-06-10"}'
|
||||
```
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{ "result": "Monday" }
|
||||
```
|
||||
|
||||
#### 3. Calendar week for date
|
||||
|
||||
**POST** `/api/kw_berechnen`
|
||||
|
||||
```json
|
||||
{ "datum": "2024-06-10" }
|
||||
```
|
||||
|
||||
**With curl:**
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:5000/api/kw_berechnen \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"datum": "2024-06-10"}'
|
||||
```
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{ "result": "CW 24 (2024)", "kw": 24, "jahr": 2024 }
|
||||
```
|
||||
|
||||
#### 4. Start/End date of a calendar week
|
||||
|
||||
**POST** `/api/kw_datum`
|
||||
|
||||
```json
|
||||
{ "jahr": 2024, "kw": 24 }
|
||||
```
|
||||
|
||||
**With curl:**
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:5000/api/kw_datum \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"jahr": 2024, "kw": 24}'
|
||||
```
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{
|
||||
"result": "10.06.2024 to 16.06.2024",
|
||||
"start": "2024-06-10",
|
||||
"end": "2024-06-16"
|
||||
}
|
||||
```
|
||||
|
||||
#### 5. Date plus/minus days, weeks, months
|
||||
|
||||
**POST** `/api/plusminus`
|
||||
|
||||
```json
|
||||
{
|
||||
"datum": "2024-06-10",
|
||||
"anzahl": 5,
|
||||
"einheit": "tage",
|
||||
"richtung": "add",
|
||||
"werktage": false
|
||||
}
|
||||
```
|
||||
|
||||
**With curl:**
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:5000/api/plusminus \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"datum": "2024-06-10", "anzahl": 5, "einheit": "tage", "richtung": "add", "werktage": false}'
|
||||
```
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{ "result": "2024-06-15" }
|
||||
```
|
||||
|
||||
**Note:**
|
||||
|
||||
- `"einheit"`: `"tage"`, `"wochen"` or `"monate"`
|
||||
- `"richtung"`: `"add"` (plus) or `"sub"` (minus)
|
||||
- `"werktage"`: `true` for working days, otherwise `false` (only supported for `"tage"`)
|
||||
|
||||
#### 6. Statistics
|
||||
|
||||
**GET** `/api/stats`
|
||||
|
||||
**With curl:**
|
||||
|
||||
```bash
|
||||
curl http://localhost:5000/api/stats
|
||||
```
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{
|
||||
"pageviews": 42,
|
||||
"func_counts": { "plusminus": 10, "tage_werktage": 5 },
|
||||
"impressions_per_day": { "2024-06-10": 7 }
|
||||
}
|
||||
```
|
||||
|
||||
#### 7. Monitoring & Healthcheck
|
||||
|
||||
**GET** `/api/monitor`
|
||||
|
||||
**With curl:**
|
||||
|
||||
```bash
|
||||
curl http://localhost:5000/api/monitor
|
||||
```
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "ok",
|
||||
"message": "App running",
|
||||
"time": "2025-07-24T13:37:00.123456",
|
||||
"uptime_seconds": 12345,
|
||||
"pageviews_last_7_days": 42
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Error cases** always return an HTTP status code 400 and JSON with an `"error"` field, e.g.:
|
||||
|
||||
```json
|
||||
{ "error": "Invalid input", "details": "..." }
|
||||
```
|
||||
|
||||
## Progressive Web App (PWA)
|
||||
|
||||
Elpatron's Date Calculator is installable as a PWA (e.g., on Android/iOS home screen or desktop). The app works offline for the homepage and static resources, date calculation remains server-side.
|
||||
|
||||
- Manifest and Service Worker are integrated
|
||||
- App icon and theme color for home screen
|
||||
- Installation via browser menu ("Add to home screen")
|
||||
- Calculator works completely client-side (available offline)
|
||||
|
||||
## Monitoring & Healthcheck
|
||||
|
||||
The app provides a monitoring endpoint at `/monitor` that returns status information as JSON (e.g., for Uptime Robot, Docker Healthcheck or own tools):
|
||||
|
||||
- Status (ok)
|
||||
- Current server time
|
||||
- Uptime (seconds since start)
|
||||
- Pageviews of the last 7 days
|
||||
|
||||
Example call:
|
||||
|
||||
`GET https://date.elpatron.me/monitor`
|
||||
|
||||
Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "ok",
|
||||
"message": "App running",
|
||||
"time": "2025-07-24T13:37:00.123456",
|
||||
"uptime_seconds": 12345,
|
||||
"pageviews_last_7_days": 42
|
||||
}
|
||||
```
|
||||
|
||||
## Development & Notes
|
||||
|
||||
- HTML templates are in the `templates/` folder (separation of logic and presentation)
|
||||
- The project is hosted on Codeberg: [https://codeberg.org/elpatron/datecalc](https://codeberg.org/elpatron/datecalc)
|
||||
- Modern, responsive design with accordion and icons
|
||||
|
||||
## Automated Tests
|
||||
|
||||
Automated tests are possible with pytest:
|
||||
|
||||
```powershell
|
||||
pip install -r requirements.txt
|
||||
pytest test_app.py
|
||||
```
|
||||
|
||||
The tests check, among other things, the accessibility of the app, the most important functions, and protection against XSS attacks.
|
||||
|
||||
## Notes
|
||||
|
||||
### Motivation
|
||||
|
||||
Try to find a date calculator web app that isn't completely riddled with ads and tracking! Since I need something like this more often, I made my own.
|
||||
|
||||
### Vibe Coding
|
||||
|
||||
This project was created almost 100% with the support of artificial intelligence (*[Vibe Coding](https://en.wikipedia.org/wiki/Vibe_Coding)*). The basic framework was completed after about 45 minutes, and the total development of the project took about 12 hours.
|
||||
|
||||
### Statistics collection, Logging
|
||||
|
||||
No IP addresses or other personal data are stored, only the number of function calls in a cumulative representation. The log file only contains entries from the last seven days.
|
||||
|
||||
### Accessibility
|
||||
|
||||
*Elpatron's Date Calculator* is designed to be accessible and meets central accessibility (a11y) requirements:
|
||||
|
||||
- *Semantic HTML Structure:* Headings, labels, and form elements are correctly marked and linked.
|
||||
- *ARIA Attributes:* Accordion and status messages are equipped with ARIA attributes so that screen readers can recognize the structure and states.
|
||||
- *Keyboard Operability:* All interactive elements (accordion, buttons, forms) are fully operable by keyboard (including focus indicator and arrow key navigation in accordion).
|
||||
- *Focus Indicators:* Clear visual highlighting of focus for all control elements.
|
||||
- *Color Contrasts:* High contrasts for texts, buttons, and result boxes, tested according to WCAG guidelines.
|
||||
- *Status and Error Messages:* Results and errors are made accessible to screen readers with `aria-live`.
|
||||
- *Speech Output:* All results can be read aloud via 🔊 buttons (Web Speech API, German language).
|
||||
- *Calculator:* Fully accessible with keyboard operation, speech output, and history function.
|
||||
- *Mobile Optimization:* Additional meta tags for better usability on mobile devices and support for screen readers.
|
||||
- *SEO:* The accessibility topic is visible in meta tags for search engines.
|
||||
|
||||
This makes the app well usable for people with different disabilities (e.g., visual impairment, motor limitations) and meets modern web standards.
|
||||
|
||||
### Code Statistics
|
||||
|
||||
cloc|github.com/AlDanial/cloc v 2.06 T=0.22 s (124.7 files/s, 34058.5 lines/s)
|
||||
--- | ---
|
||||
|
||||
Language|files|blank|comment|code
|
||||
:-------|-------:|-------:|-------:|-------:
|
||||
HTML|8|159|8|2806
|
||||
Markdown|5|340|0|876
|
||||
Python|2|68|76|744
|
||||
JavaScript|2|95|88|580
|
||||
PO File|2|260|266|544
|
||||
JSON|3|0|0|243
|
||||
CSS|1|186|3|188
|
||||
XML|1|10|4|69
|
||||
SVG|2|0|0|14
|
||||
Dockerfile|1|5|6|8
|
||||
DOS Batch|1|0|0|1
|
||||
--------|--------|--------|--------|--------
|
||||
SUM:|28|1123|451|6073
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the [MIT License](LICENSE).
|
||||
|
||||
---
|
||||
(c) 2025 [Markus Busche](https://digitalcourage.social/@elpatron)
|
||||
|
||||
**Version 1.4.12** - Integrated calculator with history and speech output added
|
99
app.py
99
app.py
@@ -1,5 +1,5 @@
|
||||
from flask import Flask, render_template, request, redirect, url_for, session, abort, jsonify, g
|
||||
from flask_babel import Babel, gettext, ngettext, get_locale
|
||||
from flask import Flask, render_template, request, redirect, url_for, session, jsonify, make_response
|
||||
from flask_babel import Babel, gettext, get_locale
|
||||
from datetime import datetime, timedelta
|
||||
import numpy as np
|
||||
from dateutil.relativedelta import relativedelta
|
||||
@@ -20,7 +20,23 @@ app.config['BABEL_TRANSLATION_DIRECTORIES'] = 'translations'
|
||||
babel = Babel()
|
||||
|
||||
# Version der App
|
||||
APP_VERSION = "1.4.7"
|
||||
APP_VERSION = "1.4.17"
|
||||
|
||||
def add_cache_headers(response):
|
||||
"""Fügt Cache-Control-Header hinzu, die den Back-Forward-Cache ermöglichen"""
|
||||
# Cache-Control für statische Inhalte und API-Endpunkte
|
||||
if request.path.startswith('/static/') or request.path.startswith('/api/'):
|
||||
response.headers['Cache-Control'] = 'public, max-age=3600, s-maxage=3600'
|
||||
else:
|
||||
# Für HTML-Seiten: kurze Cache-Zeit, aber Back-Forward-Cache erlauben
|
||||
response.headers['Cache-Control'] = 'public, max-age=60, s-maxage=300'
|
||||
|
||||
# Wichtig: Keine Vary-Header für User-Agent oder andere dynamische Werte
|
||||
# Dies verhindert den Back-Forward-Cache
|
||||
if 'Vary' in response.headers:
|
||||
del response.headers['Vary']
|
||||
|
||||
return response
|
||||
|
||||
# HTML-Template wird jetzt aus templates/index.html geladen
|
||||
|
||||
@@ -102,7 +118,7 @@ def index():
|
||||
with open(log_path, 'a', encoding='utf-8') as f:
|
||||
from datetime import datetime as dt
|
||||
f.write(f"{dt.now().isoformat()} PAGEVIEW\n")
|
||||
tage = werktage = wochentag = datumsrechnung = werktagsrechnung = kw_berechnen = kw_datum = wochen_monate = None
|
||||
tage = wochentag = kw_berechnen = kw_datum = None
|
||||
feiertage_anzahl = wochenendtage_anzahl = None
|
||||
active_idx = 0
|
||||
plusminus_result = None
|
||||
@@ -229,9 +245,10 @@ def index():
|
||||
plusminus_result = f"Datum {d.strftime('%d.%m.%Y')} {'plus' if anzahl_int>=0 else 'minus'} {abs(anzahl_int)} Monate: {result.strftime('%d.%m.%Y')}"
|
||||
except Exception:
|
||||
plusminus_result = gettext('Ungültige Eingabe')
|
||||
return render_template('index.html', tage=tage, werktage=werktage, wochentag=wochentag, plusminus_result=plusminus_result, kw_berechnen=kw_berechnen, kw_datum=kw_datum, active_idx=active_idx
|
||||
response = make_response(render_template('index.html', tage=tage, wochentag=wochentag, plusminus_result=plusminus_result, kw_berechnen=kw_berechnen, kw_datum=kw_datum, active_idx=active_idx
|
||||
, feiertage_anzahl=feiertage_anzahl, wochenendtage_anzahl=wochenendtage_anzahl, app_version=APP_VERSION, get_locale=get_locale
|
||||
)
|
||||
))
|
||||
return add_cache_headers(response)
|
||||
|
||||
|
||||
def parse_log_stats(log_path):
|
||||
@@ -304,11 +321,17 @@ def stats():
|
||||
session['stats_auth'] = True
|
||||
return redirect(url_for('stats'))
|
||||
else:
|
||||
return render_template('stats_login.html', error='Falsches Passwort!')
|
||||
return render_template('stats_login.html', error=None)
|
||||
response = make_response(render_template('stats_login.html', error='Falsches Passwort!'))
|
||||
return add_cache_headers(response)
|
||||
else:
|
||||
response = make_response(render_template('stats_login.html', error=None))
|
||||
return add_cache_headers(response)
|
||||
|
||||
# Wenn authentifiziert, zeige Dashboard
|
||||
log_path = os.path.join('log', 'pageviews.log')
|
||||
pageviews, func_counts, func_counts_hourly, impressions_per_day, impressions_per_hour, api_counts, api_counts_hourly = parse_log_stats(log_path)
|
||||
return render_template('stats_dashboard.html', pageviews=pageviews, func_counts=func_counts, func_counts_hourly=func_counts_hourly, impressions_per_day=impressions_per_day, impressions_per_hour=impressions_per_hour, api_counts=api_counts, api_counts_hourly=api_counts_hourly)
|
||||
response = make_response(render_template('stats_dashboard.html', pageviews=pageviews, func_counts=func_counts, func_counts_hourly=func_counts_hourly, impressions_per_day=impressions_per_day, impressions_per_hour=impressions_per_hour, api_counts=api_counts, api_counts_hourly=api_counts_hourly))
|
||||
return add_cache_headers(response)
|
||||
|
||||
# --- REST API ---
|
||||
def log_api_usage(api_name):
|
||||
@@ -342,7 +365,8 @@ def api_tage_werktage():
|
||||
tage = int(np.busday_count(d1.date(), (d2 + timedelta(days=1)).date(), holidays=holidays))
|
||||
else:
|
||||
tage = abs((d2 - d1).days)
|
||||
return jsonify({'result': tage})
|
||||
response = jsonify({'result': tage})
|
||||
return add_cache_headers(response)
|
||||
except Exception as e:
|
||||
return jsonify({'error': 'Ungültige Eingabe', 'details': str(e)}), 400
|
||||
|
||||
@@ -355,7 +379,8 @@ def api_wochentag():
|
||||
d = datetime.strptime(datum, '%Y-%m-%d')
|
||||
wochentage = get_wochentage()
|
||||
wochentag = wochentage[d.weekday()]
|
||||
return jsonify({'result': wochentag})
|
||||
response = jsonify({'result': wochentag})
|
||||
return add_cache_headers(response)
|
||||
except Exception as e:
|
||||
return jsonify({'error': 'Ungültige Eingabe', 'details': str(e)}), 400
|
||||
|
||||
@@ -372,7 +397,8 @@ def api_kw_berechnen():
|
||||
kw_berechnen = f"Week {kw} ({d.year})"
|
||||
else:
|
||||
kw_berechnen = f"KW {kw} ({d.year})"
|
||||
return jsonify({'result': kw_berechnen, 'kw': kw, 'jahr': d.year})
|
||||
response = jsonify({'result': kw_berechnen, 'kw': kw, 'jahr': d.year})
|
||||
return add_cache_headers(response)
|
||||
except Exception as e:
|
||||
return jsonify({'error': 'Ungültige Eingabe', 'details': str(e)}), 400
|
||||
|
||||
@@ -392,7 +418,8 @@ def api_kw_datum():
|
||||
kw_datum = f"{start.strftime('%m/%d/%Y')} to {end.strftime('%m/%d/%Y')}"
|
||||
else:
|
||||
kw_datum = f"{start.strftime('%d.%m.%Y')} bis {end.strftime('%d.%m.%Y')}"
|
||||
return jsonify({'result': kw_datum, 'start': start.strftime('%Y-%m-%d'), 'end': end.strftime('%Y-%m-%d')})
|
||||
response = jsonify({'result': kw_datum, 'start': start.strftime('%Y-%m-%d'), 'end': end.strftime('%Y-%m-%d')})
|
||||
return add_cache_headers(response)
|
||||
except Exception as e:
|
||||
return jsonify({'error': 'Ungültige Eingabe', 'details': str(e)}), 400
|
||||
|
||||
@@ -415,34 +442,26 @@ def api_plusminus():
|
||||
if is_werktage:
|
||||
result = np.busday_offset(d.date(), anzahl_int, roll='forward')
|
||||
result_dt = datetime.strptime(str(result), '%Y-%m-%d')
|
||||
if locale == 'en':
|
||||
plusminus_result = f"Date {d.strftime('%m/%d/%Y')} {'plus' if anzahl_int>=0 else 'minus'} {abs(anzahl_int)} workdays: {result_dt.strftime('%m/%d/%Y')}"
|
||||
else:
|
||||
plusminus_result = f"Datum {d.strftime('%d.%m.%Y')} {'plus' if anzahl_int>=0 else 'minus'} {abs(anzahl_int)} Werktage: {result_dt.strftime('%d.%m.%Y')}"
|
||||
response = jsonify({'result': result_dt.strftime('%Y-%m-%d')})
|
||||
return add_cache_headers(response)
|
||||
else:
|
||||
result = d + timedelta(days=anzahl_int)
|
||||
if locale == 'en':
|
||||
plusminus_result = f"Date {d.strftime('%m/%d/%Y')} {'plus' if anzahl_int>=0 else 'minus'} {abs(anzahl_int)} days: {result.strftime('%m/%d/%Y')}"
|
||||
else:
|
||||
plusminus_result = f"Datum {d.strftime('%d.%m.%Y')} {'plus' if anzahl_int>=0 else 'minus'} {abs(anzahl_int)} Tage: {result.strftime('%d.%m.%Y')}"
|
||||
response = jsonify({'result': result.strftime('%Y-%m-%d')})
|
||||
return add_cache_headers(response)
|
||||
elif einheit == 'wochen':
|
||||
if is_werktage:
|
||||
return jsonify({'error': 'Nicht unterstützt: Werktage + Wochen.'}), 400
|
||||
else:
|
||||
result = d + timedelta(weeks=anzahl_int)
|
||||
if locale == 'en':
|
||||
plusminus_result = f"Date {d.strftime('%m/%d/%Y')} {'plus' if anzahl_int>=0 else 'minus'} {abs(anzahl_int)} weeks: {result.strftime('%m/%d/%Y')}"
|
||||
else:
|
||||
plusminus_result = f"Datum {d.strftime('%d.%m.%Y')} {'plus' if anzahl_int>=0 else 'minus'} {abs(anzahl_int)} Wochen: {result.strftime('%d.%m.%Y')}"
|
||||
response = jsonify({'result': result.strftime('%Y-%m-%d')})
|
||||
return add_cache_headers(response)
|
||||
elif einheit == 'monate':
|
||||
if is_werktage:
|
||||
return jsonify({'error': 'Nicht unterstützt: Werktage + Monate.'}), 400
|
||||
else:
|
||||
result = d + relativedelta(months=anzahl_int)
|
||||
if locale == 'en':
|
||||
plusminus_result = f"Date {d.strftime('%m/%d/%Y')} {'plus' if anzahl_int>=0 else 'minus'} {abs(anzahl_int)} months: {result.strftime('%m/%d/%Y')}"
|
||||
else:
|
||||
plusminus_result = f"Datum {d.strftime('%d.%m.%Y')} {'plus' if anzahl_int>=0 else 'minus'} {abs(anzahl_int)} Monate: {result.strftime('%d.%m.%Y')}"
|
||||
response = jsonify({'result': result.strftime('%Y-%m-%d')})
|
||||
return add_cache_headers(response)
|
||||
else:
|
||||
return jsonify({'error': 'Ungültige Einheit'}), 400
|
||||
except Exception as e:
|
||||
@@ -451,8 +470,14 @@ def api_plusminus():
|
||||
@app.route('/api/stats', methods=['GET'])
|
||||
def api_stats():
|
||||
log_path = os.path.join('log', 'pageviews.log')
|
||||
pageviews, func_counts, impressions_per_day, api_counts = parse_log_stats(log_path)
|
||||
return render_template('stats_dashboard.html', pageviews=pageviews, func_counts=func_counts, impressions_per_day=impressions_per_day, api_counts=api_counts)
|
||||
pageviews, func_counts, func_counts_hourly, impressions_per_day, impressions_per_hour, api_counts, api_counts_hourly = parse_log_stats(log_path)
|
||||
response = jsonify({
|
||||
"pageviews": pageviews,
|
||||
"func_counts": func_counts,
|
||||
"impressions_per_day": impressions_per_day,
|
||||
"api_counts": api_counts
|
||||
})
|
||||
return add_cache_headers(response)
|
||||
|
||||
@app.route('/api/monitor', methods=['GET'])
|
||||
def api_monitor():
|
||||
@@ -464,17 +489,25 @@ def api_monitor():
|
||||
if 'PAGEVIEW' in line:
|
||||
pageviews += 1
|
||||
uptime = int(time.time() - app_start_time)
|
||||
return jsonify({
|
||||
response = jsonify({
|
||||
"status": "ok",
|
||||
"message": "App running",
|
||||
"time": datetime.now().isoformat(),
|
||||
"uptime_seconds": uptime,
|
||||
"pageviews_last_7_days": pageviews
|
||||
})
|
||||
return add_cache_headers(response)
|
||||
|
||||
@app.route('/api-docs')
|
||||
def api_docs():
|
||||
return render_template('swagger.html')
|
||||
response = make_response(render_template('swagger.html'))
|
||||
return add_cache_headers(response)
|
||||
|
||||
@app.route('/sitemap.xml')
|
||||
def sitemap():
|
||||
"""Serviert die Sitemap für Suchmaschinen"""
|
||||
from flask import send_file
|
||||
return send_file('sitemap.xml', mimetype='application/xml')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 57 KiB |
426
bruno/Datecalc.json
Normal file
426
bruno/Datecalc.json
Normal file
@@ -0,0 +1,426 @@
|
||||
{
|
||||
"name": "Datecalc",
|
||||
"version": "1",
|
||||
"items": [
|
||||
{
|
||||
"type": "folder",
|
||||
"name": "localhost",
|
||||
"filename": "localhost",
|
||||
"seq": 2,
|
||||
"root": {
|
||||
"request": {
|
||||
"auth": {
|
||||
"mode": "inherit"
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "localhost",
|
||||
"seq": 2
|
||||
}
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
"type": "http",
|
||||
"name": "wochentag",
|
||||
"filename": "wochentag.bru",
|
||||
"seq": 5,
|
||||
"settings": {
|
||||
"encodeUrl": false
|
||||
},
|
||||
"tags": [],
|
||||
"request": {
|
||||
"url": "http://localhost:5000/api/wochentag",
|
||||
"method": "POST",
|
||||
"headers": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json",
|
||||
"enabled": true
|
||||
}
|
||||
],
|
||||
"params": [],
|
||||
"body": {
|
||||
"mode": "json",
|
||||
"json": "{\n \"datum\": \"2024-06-10\"\n}",
|
||||
"formUrlEncoded": [],
|
||||
"multipartForm": [],
|
||||
"file": []
|
||||
},
|
||||
"script": {},
|
||||
"vars": {},
|
||||
"assertions": [],
|
||||
"tests": "",
|
||||
"docs": "",
|
||||
"auth": {
|
||||
"mode": "inherit"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"name": "kw_berechnen",
|
||||
"filename": "kw_berechnen.bru",
|
||||
"seq": 1,
|
||||
"settings": {
|
||||
"encodeUrl": false
|
||||
},
|
||||
"tags": [],
|
||||
"request": {
|
||||
"url": "http://localhost:5000/api/kw_berechnen",
|
||||
"method": "POST",
|
||||
"headers": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json",
|
||||
"enabled": true
|
||||
}
|
||||
],
|
||||
"params": [],
|
||||
"body": {
|
||||
"mode": "json",
|
||||
"json": "{\n \"datum\": \"2024-06-10\"\n}",
|
||||
"formUrlEncoded": [],
|
||||
"multipartForm": [],
|
||||
"file": []
|
||||
},
|
||||
"script": {},
|
||||
"vars": {},
|
||||
"assertions": [],
|
||||
"tests": "",
|
||||
"docs": "",
|
||||
"auth": {
|
||||
"mode": "inherit"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"name": "kw_datum",
|
||||
"filename": "kw_datum.bru",
|
||||
"seq": 3,
|
||||
"settings": {
|
||||
"encodeUrl": false
|
||||
},
|
||||
"tags": [],
|
||||
"request": {
|
||||
"url": "http://localhost:5000/api/kw_datum",
|
||||
"method": "POST",
|
||||
"headers": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json",
|
||||
"enabled": true
|
||||
}
|
||||
],
|
||||
"params": [],
|
||||
"body": {
|
||||
"mode": "json",
|
||||
"json": "{\n \"jahr\": 2024,\n \"kw\": 24\n}",
|
||||
"formUrlEncoded": [],
|
||||
"multipartForm": [],
|
||||
"file": []
|
||||
},
|
||||
"script": {},
|
||||
"vars": {},
|
||||
"assertions": [],
|
||||
"tests": "",
|
||||
"docs": "",
|
||||
"auth": {
|
||||
"mode": "inherit"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"name": "plusminus",
|
||||
"filename": "plusminus.bru",
|
||||
"seq": 4,
|
||||
"settings": {
|
||||
"encodeUrl": false
|
||||
},
|
||||
"tags": [],
|
||||
"request": {
|
||||
"url": "http://localhost:5000/api/plusminus",
|
||||
"method": "POST",
|
||||
"headers": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json",
|
||||
"enabled": true
|
||||
}
|
||||
],
|
||||
"params": [],
|
||||
"body": {
|
||||
"mode": "json",
|
||||
"json": "{\n \"datum\": \"2024-06-10\",\n \"anzahl\": 5,\n \"einheit\": \"tage\",\n \"richtung\": \"add\",\n \"werktage\": false\n}",
|
||||
"formUrlEncoded": [],
|
||||
"multipartForm": [],
|
||||
"file": []
|
||||
},
|
||||
"script": {},
|
||||
"vars": {},
|
||||
"assertions": [],
|
||||
"tests": "",
|
||||
"docs": "",
|
||||
"auth": {
|
||||
"mode": "inherit"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"name": "tage_werktage",
|
||||
"filename": "tage_werktage.bru",
|
||||
"seq": 2,
|
||||
"settings": {
|
||||
"encodeUrl": false
|
||||
},
|
||||
"tags": [],
|
||||
"request": {
|
||||
"url": "http://localhost:5000/api/tage_werktage",
|
||||
"method": "POST",
|
||||
"headers": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json",
|
||||
"enabled": true
|
||||
}
|
||||
],
|
||||
"params": [],
|
||||
"body": {
|
||||
"mode": "json",
|
||||
"json": "{\n \"start\": \"2024-06-01\",\n \"end\": \"2024-06-10\",\n \"werktage\": true,\n \"bundesland\": \"BY\"\n}",
|
||||
"formUrlEncoded": [],
|
||||
"multipartForm": [],
|
||||
"file": []
|
||||
},
|
||||
"script": {},
|
||||
"vars": {},
|
||||
"assertions": [],
|
||||
"tests": "",
|
||||
"docs": "",
|
||||
"auth": {
|
||||
"mode": "inherit"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "folder",
|
||||
"name": "public",
|
||||
"filename": "public",
|
||||
"seq": 2,
|
||||
"root": {
|
||||
"request": {
|
||||
"auth": {
|
||||
"mode": "inherit"
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "public",
|
||||
"seq": 2
|
||||
}
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
"type": "http",
|
||||
"name": "kw_berechnen",
|
||||
"filename": "kw_berechnen.bru",
|
||||
"seq": 6,
|
||||
"settings": {
|
||||
"encodeUrl": false
|
||||
},
|
||||
"tags": [],
|
||||
"request": {
|
||||
"url": "https://date.elpatron.me/api/kw_berechnen",
|
||||
"method": "POST",
|
||||
"headers": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json",
|
||||
"enabled": true
|
||||
}
|
||||
],
|
||||
"params": [],
|
||||
"body": {
|
||||
"mode": "json",
|
||||
"json": "{\n \"datum\": \"2024-06-10\"\n}",
|
||||
"formUrlEncoded": [],
|
||||
"multipartForm": [],
|
||||
"file": []
|
||||
},
|
||||
"script": {},
|
||||
"vars": {},
|
||||
"assertions": [],
|
||||
"tests": "",
|
||||
"docs": "",
|
||||
"auth": {
|
||||
"mode": "inherit"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"name": "tage_werktage",
|
||||
"filename": "tage_werktage.bru",
|
||||
"seq": 6,
|
||||
"settings": {
|
||||
"encodeUrl": false
|
||||
},
|
||||
"tags": [],
|
||||
"request": {
|
||||
"url": "https://date.elpatron.me/api/tage_werktage",
|
||||
"method": "POST",
|
||||
"headers": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json",
|
||||
"enabled": true
|
||||
}
|
||||
],
|
||||
"params": [],
|
||||
"body": {
|
||||
"mode": "json",
|
||||
"json": "{\n \"start\": \"2024-06-01\",\n \"end\": \"2025-06-10\",\n \"werktage\": true,\n \"bundesland\": \"SH\"\n}",
|
||||
"formUrlEncoded": [],
|
||||
"multipartForm": [],
|
||||
"file": []
|
||||
},
|
||||
"script": {},
|
||||
"vars": {},
|
||||
"assertions": [],
|
||||
"tests": "",
|
||||
"docs": "",
|
||||
"auth": {
|
||||
"mode": "inherit"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"name": "kw_datum",
|
||||
"filename": "kw_datum.bru",
|
||||
"seq": 6,
|
||||
"settings": {
|
||||
"encodeUrl": false
|
||||
},
|
||||
"tags": [],
|
||||
"request": {
|
||||
"url": "https://date.elpatron.me/api/kw_datum",
|
||||
"method": "POST",
|
||||
"headers": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json",
|
||||
"enabled": true
|
||||
}
|
||||
],
|
||||
"params": [],
|
||||
"body": {
|
||||
"mode": "json",
|
||||
"json": "{\n \"jahr\": 2024,\n \"kw\": 24\n}",
|
||||
"formUrlEncoded": [],
|
||||
"multipartForm": [],
|
||||
"file": []
|
||||
},
|
||||
"script": {},
|
||||
"vars": {},
|
||||
"assertions": [],
|
||||
"tests": "",
|
||||
"docs": "",
|
||||
"auth": {
|
||||
"mode": "inherit"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"name": "plusminus",
|
||||
"filename": "plusminus.bru",
|
||||
"seq": 6,
|
||||
"settings": {
|
||||
"encodeUrl": false
|
||||
},
|
||||
"tags": [],
|
||||
"request": {
|
||||
"url": "https://date.elpatron.me/api/plusminus",
|
||||
"method": "POST",
|
||||
"headers": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json",
|
||||
"enabled": true
|
||||
}
|
||||
],
|
||||
"params": [],
|
||||
"body": {
|
||||
"mode": "json",
|
||||
"json": "{\n \"datum\": \"2024-06-10\",\n \"anzahl\": 5,\n \"einheit\": \"tage\",\n \"richtung\": \"add\",\n \"werktage\": false\n}",
|
||||
"formUrlEncoded": [],
|
||||
"multipartForm": [],
|
||||
"file": []
|
||||
},
|
||||
"script": {},
|
||||
"vars": {},
|
||||
"assertions": [],
|
||||
"tests": "",
|
||||
"docs": "",
|
||||
"auth": {
|
||||
"mode": "inherit"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"name": "wochentag",
|
||||
"filename": "wochentag.bru",
|
||||
"seq": 6,
|
||||
"settings": {
|
||||
"encodeUrl": false
|
||||
},
|
||||
"tags": [],
|
||||
"request": {
|
||||
"url": "https://date.elpatron.me/api/wochentag",
|
||||
"method": "POST",
|
||||
"headers": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json",
|
||||
"enabled": true
|
||||
}
|
||||
],
|
||||
"params": [],
|
||||
"body": {
|
||||
"mode": "json",
|
||||
"json": "{\n \"datum\": \"2024-06-10\"\n}",
|
||||
"formUrlEncoded": [],
|
||||
"multipartForm": [],
|
||||
"file": []
|
||||
},
|
||||
"script": {},
|
||||
"vars": {},
|
||||
"assertions": [],
|
||||
"tests": "",
|
||||
"docs": "",
|
||||
"auth": {
|
||||
"mode": "inherit"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"environments": [],
|
||||
"brunoConfig": {
|
||||
"version": "1",
|
||||
"name": "Datecalc",
|
||||
"type": "collection",
|
||||
"ignore": [
|
||||
"node_modules",
|
||||
".git"
|
||||
],
|
||||
"size": 0.0014009475708007812,
|
||||
"filesCount": 5
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
@@ -1,5 +1,6 @@
|
||||
Flask==3.0.0
|
||||
numpy==1.26.4
|
||||
Flask==3.1.1
|
||||
numpy==2.3.2
|
||||
python-dateutil==2.9.0.post0
|
||||
requests==2.31.0
|
||||
Flask-Babel==4.0.0
|
||||
requests==2.32.4
|
||||
Flask-Babel==4.0.0
|
||||
pytest==8.4.1
|
14
robots.txt
14
robots.txt
@@ -1,2 +1,14 @@
|
||||
User-agent: *
|
||||
Allow: /
|
||||
Allow: /
|
||||
|
||||
# Sitemap
|
||||
Sitemap: https://date.elpatron.me/sitemap.xml
|
||||
|
||||
# Disallow private areas
|
||||
Disallow: /stats
|
||||
Disallow: /log/
|
||||
Disallow: /htmlcov/
|
||||
|
||||
# Allow API endpoints for documentation
|
||||
Allow: /api-docs
|
||||
Allow: /static/swagger.json
|
83
sitemap.xml
Normal file
83
sitemap.xml
Normal file
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<!-- Hauptseite -->
|
||||
<url>
|
||||
<loc>https://date.elpatron.me/</loc>
|
||||
<lastmod>2025-08-03</lastmod>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
|
||||
<!-- API-Dokumentation -->
|
||||
<url>
|
||||
<loc>https://date.elpatron.me/api-docs</loc>
|
||||
<lastmod>2025-08-03</lastmod>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.8</priority>
|
||||
</url>
|
||||
|
||||
<!-- Statische Ressourcen -->
|
||||
<url>
|
||||
<loc>https://date.elpatron.me/static/favicon.ico</loc>
|
||||
<lastmod>2025-08-03</lastmod>
|
||||
<changefreq>yearly</changefreq>
|
||||
<priority>0.1</priority>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://date.elpatron.me/static/favicon.png</loc>
|
||||
<lastmod>2025-08-03</lastmod>
|
||||
<changefreq>yearly</changefreq>
|
||||
<priority>0.1</priority>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://date.elpatron.me/static/favicon.svg</loc>
|
||||
<lastmod>2025-08-03</lastmod>
|
||||
<changefreq>yearly</changefreq>
|
||||
<priority>0.1</priority>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://date.elpatron.me/static/logo.svg</loc>
|
||||
<lastmod>2025-08-03</lastmod>
|
||||
<changefreq>yearly</changefreq>
|
||||
<priority>0.1</priority>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://date.elpatron.me/static/manifest.json</loc>
|
||||
<lastmod>2025-08-03</lastmod>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.3</priority>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://date.elpatron.me/static/service-worker.js</loc>
|
||||
<lastmod>2025-08-03</lastmod>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.3</priority>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://date.elpatron.me/static/swagger.json</loc>
|
||||
<lastmod>2025-08-03</lastmod>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.5</priority>
|
||||
</url>
|
||||
|
||||
<!-- Sprachversionen der Hauptseite -->
|
||||
<url>
|
||||
<loc>https://date.elpatron.me/?lang=de</loc>
|
||||
<lastmod>2025-08-03</lastmod>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>0.9</priority>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://date.elpatron.me/?lang=en</loc>
|
||||
<lastmod>2025-08-03</lastmod>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>0.9</priority>
|
||||
</url>
|
||||
</urlset>
|
@@ -1,15 +1,25 @@
|
||||
const CACHE_NAME = 'datumsrechner-cache-v1';
|
||||
const urlsToCache = [
|
||||
'/',
|
||||
'/static/style.css',
|
||||
'/static/favicon.ico',
|
||||
'/static/favicon.png',
|
||||
'/static/favicon.svg',
|
||||
'/static/logo.svg',
|
||||
'/static/manifest.json',
|
||||
];
|
||||
self.addEventListener('install', event => {
|
||||
event.waitUntil(
|
||||
caches.open(CACHE_NAME)
|
||||
.then(cache => cache.addAll(urlsToCache))
|
||||
.then(cache => {
|
||||
// Füge nur existierende Dateien zum Cache hinzu
|
||||
return Promise.allSettled(
|
||||
urlsToCache.map(url =>
|
||||
cache.add(url).catch(err => {
|
||||
console.log('Failed to cache:', url, err);
|
||||
})
|
||||
)
|
||||
);
|
||||
})
|
||||
);
|
||||
});
|
||||
self.addEventListener('fetch', event => {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
.v{
|
||||
{
|
||||
"openapi": "3.0.3",
|
||||
"info": {
|
||||
"title": "Elpatrons Datumsrechner API",
|
||||
|
@@ -6,12 +6,12 @@
|
||||
{%- endif -%}
|
||||
{% endmacro %}
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<html lang="{{ get_locale() }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{{ _('Elpatrons Datumsrechner – Open Source Kalender- und Datumsberechnungen') }}</title>
|
||||
<meta name="description" content="{{ _('Elpatrons Datumsrechner: Open Source Web-App für Kalender- und Datumsberechnungen. Tage, Werktage, Wochen, Monate, Kalenderwochen, Wochentage und mehr berechnen – barrierefrei, werbefrei, trackingfrei, kostenlos.') }}">
|
||||
<meta name="keywords" content="{{ _('Datum, Kalender, Datumsrechner, Werktage, Tage zählen, Kalenderwoche, Wochentag, Open Source, Python, Flask, barrierefreiheit, barrierefrei, kostenlos, werbefrei, trackingfrei, cookiefrei') }}">
|
||||
<meta name="keywords" content="{{ _('Datum, Kalender, Datumsrechner, Werktage, Tage zählen, Kalenderwoche, Wochentag, Open Source, barrierefreiheit, barrierefrei, kostenlos, werbefrei, trackingfrei, cookiefrei, progressive web app, pwa') }}">
|
||||
<meta property="og:title" content="{{ _('Elpatrons Datumsrechner – Open Source Kalender- und Datumsberechnungen') }}">
|
||||
<meta property="og:description" content="{{ _('Open Source Web-App für Kalender- und Datumsberechnungen. Werbefrei, trackingfrei, kostenlos.') }}">
|
||||
<meta property="og:type" content="website">
|
||||
@@ -97,6 +97,186 @@ body {
|
||||
background: rgba(37, 99, 235, 0.25);
|
||||
border-color: var(--primary);
|
||||
}
|
||||
.help-button:focus {
|
||||
outline: 2px solid var(--primary);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* Calculator Styles */
|
||||
.calculator-btn {
|
||||
background: var(--primary);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
font-weight: 500;
|
||||
width: 100%;
|
||||
max-width: 480px;
|
||||
min-height: 44px;
|
||||
min-width: 44px;
|
||||
padding: 1em 1.2em;
|
||||
font-size: 1.1em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.calculator-btn:hover {
|
||||
background: var(--primary-dark);
|
||||
}
|
||||
|
||||
.calculator-btn:focus {
|
||||
outline: 3px solid #facc15;
|
||||
outline-offset: 2px;
|
||||
box-shadow: 0 0 0 4px #1e293b;
|
||||
}
|
||||
|
||||
.calculator-modal {
|
||||
max-width: 400px;
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.calculator {
|
||||
background: #f8fafc;
|
||||
border-radius: 12px;
|
||||
padding: 0.8em;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
width: fit-content;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.calculator-display {
|
||||
margin-bottom: 0.8em;
|
||||
}
|
||||
|
||||
.calculator-history {
|
||||
margin-bottom: 0.8em;
|
||||
min-height: 40px;
|
||||
border: 2px solid #d1d5db;
|
||||
border-radius: 6px;
|
||||
background: #f9fafb;
|
||||
padding: 0.3em;
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: 0.8em;
|
||||
color: #6b7280;
|
||||
overflow-y: auto;
|
||||
max-height: 80px;
|
||||
}
|
||||
|
||||
.history-item {
|
||||
padding: 0.3em 0;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
text-align: right;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.history-item:last-child {
|
||||
border-bottom: none;
|
||||
color: #374151;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.calculator-display input {
|
||||
width: 100%;
|
||||
padding: 0.8em;
|
||||
padding-right: 3.5em;
|
||||
font-size: 1.3em;
|
||||
text-align: right;
|
||||
border: 3px solid #374151;
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
color: #111827;
|
||||
font-family: 'Courier New', monospace;
|
||||
font-weight: 600;
|
||||
min-height: 48px;
|
||||
}
|
||||
|
||||
.calculator-display input:focus {
|
||||
outline: 3px solid #facc15;
|
||||
outline-offset: 2px;
|
||||
box-shadow: 0 0 0 4px #1e293b;
|
||||
border-color: #1f2937;
|
||||
}
|
||||
|
||||
.calculator-buttons {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 0.3em;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.calc-btn {
|
||||
padding: 0.7em;
|
||||
font-size: 1.1em !important;
|
||||
font-family: 'Segoe UI', Arial, sans-serif !important;
|
||||
border: 2px solid #374151;
|
||||
background: #f9fafb;
|
||||
color: #111827;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
font-weight: 600 !important;
|
||||
min-width: 44px;
|
||||
min-height: 44px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
aspect-ratio: 1;
|
||||
}
|
||||
|
||||
.calc-btn:hover {
|
||||
background: #e5e7eb;
|
||||
border-color: #1f2937;
|
||||
}
|
||||
|
||||
.calc-btn:focus {
|
||||
outline: 3px solid #facc15;
|
||||
outline-offset: 2px;
|
||||
box-shadow: 0 0 0 4px #1e293b;
|
||||
background: #e5e7eb;
|
||||
border-color: #1f2937;
|
||||
}
|
||||
|
||||
.calc-clear {
|
||||
background: #ef4444;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.calc-clear:hover {
|
||||
background: #dc2626;
|
||||
}
|
||||
|
||||
.calc-delete {
|
||||
background: #f59e0b;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.calc-delete:hover {
|
||||
background: #d97706;
|
||||
}
|
||||
|
||||
.calc-operator {
|
||||
background: var(--primary);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.calc-operator:hover {
|
||||
background: var(--primary-dark);
|
||||
}
|
||||
|
||||
.calc-equals {
|
||||
background: #10b981;
|
||||
color: white;
|
||||
grid-row: span 2;
|
||||
}
|
||||
|
||||
.calc-equals:hover {
|
||||
background: #059669;
|
||||
}
|
||||
|
||||
.calc-zero {
|
||||
grid-column: span 2;
|
||||
}
|
||||
|
||||
.help-button:focus {
|
||||
outline: 3px solid #facc15;
|
||||
outline-offset: 2px;
|
||||
@@ -154,7 +334,7 @@ body {
|
||||
padding: 2em;
|
||||
max-width: 90%;
|
||||
width: 90%;
|
||||
max-height: 90vh;
|
||||
max-height: 95vh;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
position: relative;
|
||||
@@ -318,9 +498,9 @@ button:focus, .accordion-header:focus {
|
||||
position: absolute;
|
||||
top: 0.5em;
|
||||
right: 0.5em;
|
||||
background: rgba(37, 99, 235, 0.15);
|
||||
color: var(--primary-dark);
|
||||
border: 1px solid var(--border);
|
||||
background: #ffffff;
|
||||
color: #000000;
|
||||
border: 2px solid #000000;
|
||||
border-radius: 4px;
|
||||
padding: 0.3em 0.6em;
|
||||
font-size: 0.8em;
|
||||
@@ -334,19 +514,20 @@ button:focus, .accordion-header:focus {
|
||||
z-index: 5;
|
||||
}
|
||||
.read-aloud-btn:hover {
|
||||
background: rgba(37, 99, 235, 0.25);
|
||||
border-color: var(--primary);
|
||||
background: #f0f0f0;
|
||||
border-color: #333333;
|
||||
}
|
||||
.read-aloud-btn:focus {
|
||||
outline: 3px solid #facc15;
|
||||
outline-offset: 2px;
|
||||
box-shadow: 0 0 0 4px #1e293b;
|
||||
background: rgba(37, 99, 235, 0.25);
|
||||
border-color: var(--primary);
|
||||
background: #f0f0f0;
|
||||
border-color: #333333;
|
||||
}
|
||||
.read-aloud-btn.playing {
|
||||
background: var(--primary);
|
||||
color: white;
|
||||
background: #000000;
|
||||
color: #ffffff;
|
||||
border-color: #000000;
|
||||
}
|
||||
.accordion {
|
||||
border-radius: 12px;
|
||||
@@ -508,7 +689,7 @@ button:focus, .accordion-header:focus {
|
||||
padding: 0.4em 0.6em;
|
||||
}
|
||||
.modal-content {
|
||||
padding: 1.5em;
|
||||
padding: 1.2em;
|
||||
margin: 1em;
|
||||
width: calc(100% - 2em);
|
||||
max-width: none;
|
||||
@@ -519,6 +700,38 @@ button:focus, .accordion-header:focus {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.calculator-modal {
|
||||
max-width: 95%;
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
.calculator {
|
||||
width: 100%;
|
||||
padding: 0.8em;
|
||||
}
|
||||
|
||||
.calculator-buttons {
|
||||
width: 100%;
|
||||
gap: 0.3em;
|
||||
}
|
||||
|
||||
.calc-btn {
|
||||
padding: 0.6em;
|
||||
font-size: 1.1em;
|
||||
padding: 1em 1.2em;
|
||||
font-weight: 600;
|
||||
/* font-family: 'Segoe UI', Arial, sans-serif; */
|
||||
min-width: 44px;
|
||||
min-height: 44px;
|
||||
}
|
||||
|
||||
.calculator-display input {
|
||||
padding: 0.6em;
|
||||
padding-right: 3em;
|
||||
font-size: 1.2em;
|
||||
min-height: 44px;
|
||||
}
|
||||
|
||||
.modal-close {
|
||||
top: 0.8em;
|
||||
right: 0.8em;
|
||||
@@ -677,13 +890,222 @@ footer br + a {
|
||||
document.querySelector('.help-button').focus();
|
||||
}
|
||||
|
||||
// Taschenrechner-Funktionen
|
||||
let calculatorDisplay = '0';
|
||||
let calculatorPreviousValue = null;
|
||||
let calculatorCurrentOperator = null;
|
||||
let calculatorWaitingForOperand = false;
|
||||
let calculatorHistory = [];
|
||||
|
||||
function showCalculator() {
|
||||
const modal = document.getElementById('calculatorModal');
|
||||
const input = document.getElementById('calculatorInput');
|
||||
|
||||
if (modal && input) {
|
||||
modal.style.display = 'flex';
|
||||
modal.classList.add('active');
|
||||
input.focus();
|
||||
}
|
||||
}
|
||||
|
||||
function hideCalculator() {
|
||||
const modal = document.getElementById('calculatorModal');
|
||||
modal.style.display = 'none';
|
||||
modal.classList.remove('active');
|
||||
}
|
||||
|
||||
function calculatorClear() {
|
||||
calculatorDisplay = '0';
|
||||
calculatorPreviousValue = null;
|
||||
calculatorCurrentOperator = null;
|
||||
calculatorWaitingForOperand = false;
|
||||
calculatorHistory = [];
|
||||
updateCalculatorDisplay();
|
||||
}
|
||||
|
||||
function calculatorDelete() {
|
||||
if (calculatorDisplay.length === 1) {
|
||||
calculatorDisplay = '0';
|
||||
} else {
|
||||
calculatorDisplay = calculatorDisplay.slice(0, -1);
|
||||
}
|
||||
updateCalculatorDisplay();
|
||||
}
|
||||
|
||||
function calculatorNumber(num) {
|
||||
if (calculatorWaitingForOperand) {
|
||||
calculatorDisplay = num;
|
||||
calculatorWaitingForOperand = false;
|
||||
} else {
|
||||
calculatorDisplay = calculatorDisplay === '0' ? num : calculatorDisplay + num;
|
||||
}
|
||||
updateCalculatorDisplay();
|
||||
}
|
||||
|
||||
function calculatorDecimal() {
|
||||
if (calculatorWaitingForOperand) {
|
||||
calculatorDisplay = '0.';
|
||||
calculatorWaitingForOperand = false;
|
||||
} else if (calculatorDisplay.indexOf('.') === -1) {
|
||||
calculatorDisplay += '.';
|
||||
}
|
||||
updateCalculatorDisplay();
|
||||
}
|
||||
|
||||
function calculatorOperator(op) {
|
||||
const inputValue = parseFloat(calculatorDisplay);
|
||||
|
||||
if (calculatorPreviousValue === null) {
|
||||
calculatorPreviousValue = inputValue;
|
||||
} else if (calculatorCurrentOperator) {
|
||||
const result = performCalculation(calculatorPreviousValue, inputValue, calculatorCurrentOperator);
|
||||
calculatorDisplay = String(result);
|
||||
calculatorPreviousValue = result;
|
||||
}
|
||||
|
||||
calculatorWaitingForOperand = true;
|
||||
calculatorCurrentOperator = op;
|
||||
updateCalculatorDisplay();
|
||||
}
|
||||
|
||||
function calculatorEquals() {
|
||||
const inputValue = parseFloat(calculatorDisplay);
|
||||
|
||||
if (calculatorPreviousValue === null || calculatorCurrentOperator === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
const result = performCalculation(calculatorPreviousValue, inputValue, calculatorCurrentOperator);
|
||||
|
||||
// Füge zur History hinzu
|
||||
const historyEntry = calculatorPreviousValue + ' ' + getOperatorSymbol(calculatorCurrentOperator) + ' ' + inputValue + ' = ' + result;
|
||||
addToHistory(historyEntry);
|
||||
|
||||
calculatorDisplay = String(result);
|
||||
calculatorPreviousValue = null;
|
||||
calculatorCurrentOperator = null;
|
||||
calculatorWaitingForOperand = true;
|
||||
updateCalculatorDisplay();
|
||||
}
|
||||
|
||||
function performCalculation(firstValue, secondValue, operator) {
|
||||
switch (operator) {
|
||||
case '+':
|
||||
return firstValue + secondValue;
|
||||
case '-':
|
||||
return firstValue - secondValue;
|
||||
case '*':
|
||||
return firstValue * secondValue;
|
||||
case '/':
|
||||
return secondValue !== 0 ? firstValue / secondValue : 'Error';
|
||||
default:
|
||||
return secondValue;
|
||||
}
|
||||
}
|
||||
|
||||
function updateCalculatorDisplay() {
|
||||
const display = document.getElementById('calculatorInput');
|
||||
if (calculatorDisplay === 'Error') {
|
||||
display.value = 'Error';
|
||||
display.setAttribute('aria-label', '{{ _("Fehler") }}');
|
||||
calculatorDisplay = '0';
|
||||
calculatorPreviousValue = null;
|
||||
calculatorCurrentOperator = null;
|
||||
calculatorWaitingForOperand = false;
|
||||
} else {
|
||||
display.value = calculatorDisplay;
|
||||
display.setAttribute('aria-label', '{{ _("Taschenrechner Anzeige") }}: ' + calculatorDisplay);
|
||||
}
|
||||
updateHistoryDisplay();
|
||||
}
|
||||
|
||||
function readAloudFromCalculator(button) {
|
||||
// Prüfe, ob bereits eine Wiedergabe läuft
|
||||
if (currentSpeech && speechSynthesis.speaking) {
|
||||
// Stoppe die aktuelle Wiedergabe
|
||||
speechSynthesis.cancel();
|
||||
currentSpeech = null;
|
||||
button.classList.remove('playing');
|
||||
button.textContent = '🔊';
|
||||
return;
|
||||
}
|
||||
|
||||
// Finde das Eingabefeld
|
||||
const inputElement = document.getElementById('calculatorInput');
|
||||
if (!inputElement) return;
|
||||
|
||||
let textToRead = inputElement.value;
|
||||
|
||||
// Übersetze Zahlen und Operatoren für bessere Sprachausgabe
|
||||
if (textToRead !== 'Error') {
|
||||
// Prüfe, ob es sich um ein Ergebnis einer Berechnung handelt
|
||||
if (calculatorHistory.length > 0) {
|
||||
// Verwende die letzte Berechnung aus der History
|
||||
const lastCalculation = calculatorHistory[0];
|
||||
textToRead = lastCalculation;
|
||||
|
||||
// Übersetze mathematische Symbole für bessere Sprachausgabe
|
||||
textToRead = textToRead.replace(/×/g, ' mal ');
|
||||
textToRead = textToRead.replace(/÷/g, ' geteilt durch ');
|
||||
textToRead = textToRead.replace(/−/g, ' minus ');
|
||||
textToRead = textToRead.replace(/\+/g, ' plus ');
|
||||
textToRead = textToRead.replace(/\./g, ' Komma ');
|
||||
textToRead = textToRead.replace(/=/g, ' ist gleich ');
|
||||
} else {
|
||||
// Fallback für einzelne Zahlen
|
||||
textToRead = textToRead.replace(/\./g, ' Komma ');
|
||||
if (textToRead === '0') {
|
||||
textToRead = '{{ _("Null") }}';
|
||||
} else {
|
||||
textToRead = '{{ _("Taschenrechner Anzeige") }}: ' + textToRead;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
textToRead = '{{ _("Fehler") }}';
|
||||
}
|
||||
|
||||
readAloud(textToRead, button);
|
||||
}
|
||||
|
||||
function addToHistory(entry) {
|
||||
calculatorHistory.unshift(entry);
|
||||
if (calculatorHistory.length > 3) {
|
||||
calculatorHistory.pop();
|
||||
}
|
||||
}
|
||||
|
||||
function updateHistoryDisplay() {
|
||||
const historyContainer = document.getElementById('calculatorHistory');
|
||||
if (historyContainer) {
|
||||
historyContainer.innerHTML = '';
|
||||
calculatorHistory.forEach((entry, index) => {
|
||||
const historyItem = document.createElement('div');
|
||||
historyItem.className = 'history-item';
|
||||
historyItem.textContent = entry;
|
||||
historyItem.setAttribute('aria-label', '{{ _("Berechnung") }} ' + (index + 1) + ': ' + entry);
|
||||
historyContainer.appendChild(historyItem);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getOperatorSymbol(operator) {
|
||||
switch(operator) {
|
||||
case '+': return '+';
|
||||
case '-': return '−';
|
||||
case '*': return '×';
|
||||
case '/': return '÷';
|
||||
default: return operator;
|
||||
}
|
||||
}
|
||||
|
||||
// Sprachausgabe-Funktionalität
|
||||
let currentSpeech = null;
|
||||
|
||||
function readAloud(text, button) {
|
||||
// Stoppe vorherige Wiedergabe
|
||||
if (currentSpeech) {
|
||||
currentSpeech.cancel();
|
||||
speechSynthesis.cancel();
|
||||
currentSpeech = null;
|
||||
}
|
||||
|
||||
// Entferne "playing" Klasse von allen Buttons
|
||||
@@ -692,12 +1114,92 @@ footer br + a {
|
||||
btn.textContent = '🔊';
|
||||
});
|
||||
|
||||
// Bestimme die aktuelle Sprache
|
||||
let currentLang = 'de-DE'; // Standard
|
||||
|
||||
// Methode 1: Prüfe URL-Parameter
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const langParam = urlParams.get('lang');
|
||||
|
||||
// Methode 2: Prüfe localStorage
|
||||
const savedLang = localStorage.getItem('preferred_language');
|
||||
|
||||
// Methode 3: Prüfe das HTML lang-Attribut
|
||||
const htmlLang = document.documentElement.lang;
|
||||
|
||||
// Debug-Ausgabe
|
||||
console.log('URL lang param:', langParam);
|
||||
console.log('Saved lang:', savedLang);
|
||||
console.log('HTML lang:', htmlLang);
|
||||
|
||||
// Verbesserte Spracherkennung - prüfe alle Quellen
|
||||
if (langParam === 'en' || savedLang === 'en' || htmlLang === 'en') {
|
||||
// Prüfe, ob eine britische Stimme verfügbar ist
|
||||
const voices = speechSynthesis.getVoices();
|
||||
const hasBritishVoice = voices.some(voice => voice.lang === 'en-GB');
|
||||
const hasAmericanVoice = voices.some(voice => voice.lang === 'en-US');
|
||||
|
||||
if (hasBritishVoice) {
|
||||
currentLang = 'en-GB';
|
||||
console.log('Setting language to British English:', currentLang);
|
||||
} else if (hasAmericanVoice) {
|
||||
currentLang = 'en-US';
|
||||
console.log('Setting language to American English:', currentLang);
|
||||
} else {
|
||||
// Fallback auf en-US, auch wenn keine Stimme verfügbar ist
|
||||
currentLang = 'en-US';
|
||||
console.log('Setting language to English (no specific voice available):', currentLang);
|
||||
}
|
||||
} else {
|
||||
console.log('Setting language to German:', currentLang);
|
||||
}
|
||||
|
||||
// Erstelle neue Sprachausgabe
|
||||
currentSpeech = new SpeechSynthesisUtterance(text);
|
||||
currentSpeech.lang = 'de-DE';
|
||||
currentSpeech.lang = currentLang;
|
||||
currentSpeech.rate = 0.9;
|
||||
currentSpeech.pitch = 1;
|
||||
|
||||
// Versuche eine passende Stimme zu finden
|
||||
const voices = speechSynthesis.getVoices();
|
||||
console.log('Available voices:', voices.map(v => `${v.name} (${v.lang})`));
|
||||
|
||||
// Suche nach einer Stimme in der gewünschten Sprache
|
||||
let preferredVoice = voices.find(voice =>
|
||||
voice.lang === currentLang
|
||||
);
|
||||
|
||||
// Falls keine exakte Übereinstimmung, suche nach ähnlicher Sprache
|
||||
if (!preferredVoice) {
|
||||
preferredVoice = voices.find(voice =>
|
||||
voice.lang.startsWith(currentLang.split('-')[0])
|
||||
);
|
||||
}
|
||||
|
||||
// Falls immer noch keine Stimme gefunden, suche nach englischen Stimmen für Englisch
|
||||
if (!preferredVoice && (currentLang === 'en-US' || currentLang === 'en-GB')) {
|
||||
// Bevorzuge britische Stimmen für en-GB
|
||||
if (currentLang === 'en-GB') {
|
||||
preferredVoice = voices.find(voice =>
|
||||
voice.lang === 'en-GB' || voice.name.toLowerCase().includes('british')
|
||||
);
|
||||
}
|
||||
|
||||
// Falls keine britische Stimme, suche nach amerikanischen oder allgemeinen englischen Stimmen
|
||||
if (!preferredVoice) {
|
||||
preferredVoice = voices.find(voice =>
|
||||
voice.lang.includes('en') || voice.name.toLowerCase().includes('english')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (preferredVoice) {
|
||||
currentSpeech.voice = preferredVoice;
|
||||
console.log('Using voice:', preferredVoice.name, 'for language:', currentLang);
|
||||
} else {
|
||||
console.log('No specific voice found for language:', currentLang, '- using default');
|
||||
}
|
||||
|
||||
// Button-Status aktualisieren
|
||||
button.classList.add('playing');
|
||||
button.textContent = '⏹️';
|
||||
@@ -720,6 +1222,16 @@ footer br + a {
|
||||
}
|
||||
|
||||
function readAloudFromElement(button) {
|
||||
// Prüfe, ob bereits eine Wiedergabe läuft
|
||||
if (currentSpeech && speechSynthesis.speaking) {
|
||||
// Stoppe die aktuelle Wiedergabe
|
||||
speechSynthesis.cancel();
|
||||
currentSpeech = null;
|
||||
button.classList.remove('playing');
|
||||
button.textContent = '🔊';
|
||||
return;
|
||||
}
|
||||
|
||||
// Finde das Ergebnis-Element (das div mit class="result")
|
||||
const resultElement = button.closest('.result');
|
||||
if (!resultElement) return;
|
||||
@@ -736,7 +1248,7 @@ footer br + a {
|
||||
|
||||
function stopReading() {
|
||||
if (currentSpeech) {
|
||||
currentSpeech.cancel();
|
||||
speechSynthesis.cancel();
|
||||
currentSpeech = null;
|
||||
}
|
||||
document.querySelectorAll('.read-aloud-btn').forEach(btn => {
|
||||
@@ -746,6 +1258,13 @@ footer br + a {
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Stelle sicher, dass die Stimmen geladen sind
|
||||
if (speechSynthesis.onvoiceschanged !== undefined) {
|
||||
speechSynthesis.onvoiceschanged = function() {
|
||||
console.log('Voices loaded:', speechSynthesis.getVoices().length);
|
||||
};
|
||||
}
|
||||
|
||||
// Prüfe localStorage für gespeicherte Sprachauswahl
|
||||
const savedLanguage = localStorage.getItem('preferred_language');
|
||||
if (savedLanguage && !window.location.search.includes('lang=')) {
|
||||
@@ -791,6 +1310,7 @@ footer br + a {
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Escape') {
|
||||
hideHelp();
|
||||
hideCalculator();
|
||||
stopReading();
|
||||
}
|
||||
});
|
||||
@@ -801,6 +1321,101 @@ footer br + a {
|
||||
hideHelp();
|
||||
}
|
||||
});
|
||||
|
||||
// Klick außerhalb des Taschenrechner-Modals zum Schließen
|
||||
document.getElementById('calculatorModal').addEventListener('click', function(e) {
|
||||
if (e.target === this) {
|
||||
hideCalculator();
|
||||
}
|
||||
});
|
||||
|
||||
// Tastatursteuerung für Taschenrechner-Button
|
||||
document.getElementById('calculatorBtn').addEventListener('keydown', function(event) {
|
||||
if (event.key === 'Enter' || event.key === ' ') {
|
||||
event.preventDefault();
|
||||
showCalculator();
|
||||
}
|
||||
});
|
||||
|
||||
// Tastatursteuerung für Taschenrechner
|
||||
document.addEventListener('keydown', function(event) {
|
||||
const modal = document.getElementById('calculatorModal');
|
||||
if (modal.style.display === 'flex') {
|
||||
switch(event.key) {
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
calculatorNumber(event.key);
|
||||
event.preventDefault();
|
||||
break;
|
||||
case '.':
|
||||
case ',':
|
||||
calculatorDecimal();
|
||||
event.preventDefault();
|
||||
break;
|
||||
case '+':
|
||||
case 'p': case 'P': // Plus
|
||||
calculatorOperator('+');
|
||||
event.preventDefault();
|
||||
break;
|
||||
case '-':
|
||||
case 'm': case 'M': // Minus
|
||||
calculatorOperator('-');
|
||||
event.preventDefault();
|
||||
break;
|
||||
case '*':
|
||||
case 'x': case 'X': // Multiplikation
|
||||
case '×':
|
||||
calculatorOperator('*');
|
||||
event.preventDefault();
|
||||
break;
|
||||
case '/':
|
||||
case 'd': case 'D': // Division
|
||||
case '÷':
|
||||
calculatorOperator('/');
|
||||
event.preventDefault();
|
||||
break;
|
||||
case '=':
|
||||
case 'Enter':
|
||||
case ' ': // Leertaste für Gleich
|
||||
calculatorEquals();
|
||||
event.preventDefault();
|
||||
break;
|
||||
case 'Escape':
|
||||
hideCalculator();
|
||||
event.preventDefault();
|
||||
break;
|
||||
case 'Backspace':
|
||||
case 'Delete':
|
||||
calculatorDelete();
|
||||
event.preventDefault();
|
||||
break;
|
||||
case 'c': case 'C':
|
||||
case 'Escape':
|
||||
calculatorClear();
|
||||
event.preventDefault();
|
||||
break;
|
||||
case 'Tab':
|
||||
// Erlaube normale Tab-Navigation
|
||||
break;
|
||||
default:
|
||||
// Verhindere andere Tastatureingaben
|
||||
event.preventDefault();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Werktage-Checkbox Event-Handler
|
||||
var werktageCheckbox = document.getElementById('werktage');
|
||||
var bundeslandSelect = document.getElementById('bundesland');
|
||||
if (werktageCheckbox && bundeslandSelect) {
|
||||
function toggleBundesland() {
|
||||
bundeslandSelect.disabled = !werktageCheckbox.checked;
|
||||
}
|
||||
werktageCheckbox.addEventListener('change', toggleBundesland);
|
||||
// Initial setzen
|
||||
toggleBundesland();
|
||||
}
|
||||
});
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function() {
|
||||
@@ -881,11 +1496,11 @@ footer br + a {
|
||||
</form>
|
||||
{% if tage is not none %}
|
||||
<div class="result" aria-live="polite">
|
||||
<button type="button" class="read-aloud-btn" onclick="readAloudFromElement(this)" onkeydown="if(event.key==='Enter'||event.key===' ') { event.preventDefault(); readAloudFromElement(this); }" aria-label="Ergebnis vorlesen" title="Ergebnis vorlesen" tabindex="0">🔊</button>
|
||||
<button type="button" class="read-aloud-btn" onclick="readAloudFromElement(this)" onkeydown="if(event.key==='Enter'||event.key===' ') { event.preventDefault(); readAloudFromElement(this); }" aria-label="{{ _('Ergebnis vorlesen') }}" title="{{ _('Ergebnis vorlesen') }}" tabindex="0">🔊</button>
|
||||
{% if request.form.get('werktage') %}
|
||||
{{ _('Anzahl der Werktage zwischen') }} <b>{{ format_date(request.form.get('start1', '')) }}</b> {{ _('und') }} <b>{{ format_date(request.form.get('end1', '')) }}:</b>{% if request.form.get('bundesland') %} {{ _('(Feiertage:') }} {{ request.form.get('bundesland') }}){% endif %}: {{ tage }}
|
||||
{% else %}
|
||||
{{ _('Anzahl der Tage zwischen') }} <b>{{ format_date(request.form.get('start1', '')) }}</b> {{ _('und') }} <b>{{ format_date(request.form.get('end1', '')) }}</b>: {{ tage }}.
|
||||
{{ _('Anzahl der Tage zwischen') }} <b>{{ format_date(request.form.get('start1', '')) }}</b> {{ _('und') }} <b>{{ format_date(request.form.get('end1', '')) }}</b>: {{ tage }}
|
||||
{% endif %}
|
||||
{% if wochenendtage_anzahl is not none or (feiertage_anzahl is not none and request.form.get('bundesland')) %}
|
||||
<br>
|
||||
@@ -923,7 +1538,7 @@ footer br + a {
|
||||
</form>
|
||||
{% if wochentag is not none %}
|
||||
<div class="result" aria-live="polite">
|
||||
<button type="button" class="read-aloud-btn" onclick="readAloudFromElement(this)" onkeydown="if(event.key==='Enter'||event.key===' ') { event.preventDefault(); readAloudFromElement(this); }" aria-label="Ergebnis vorlesen" title="Ergebnis vorlesen" tabindex="0">🔊</button>
|
||||
<button type="button" class="read-aloud-btn" onclick="readAloudFromElement(this)" onkeydown="if(event.key==='Enter'||event.key===' ') { event.preventDefault(); readAloudFromElement(this); }" aria-label="{{ _('Ergebnis vorlesen') }}" title="{{ _('Ergebnis vorlesen') }}" tabindex="0">🔊</button>
|
||||
{{ _('Wochentag von') }} <b>{{ format_date(request.form.get('datum3', '')) }}</b>: {{ wochentag }}
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -949,7 +1564,7 @@ footer br + a {
|
||||
</form>
|
||||
{% if kw_berechnen is not none %}
|
||||
<div class="result" aria-live="polite">
|
||||
<button type="button" class="read-aloud-btn" onclick="readAloudFromElement(this)" onkeydown="if(event.key==='Enter'||event.key===' ') { event.preventDefault(); readAloudFromElement(this); }" aria-label="Ergebnis vorlesen" title="Ergebnis vorlesen" tabindex="0">🔊</button>
|
||||
<button type="button" class="read-aloud-btn" onclick="readAloudFromElement(this)" onkeydown="if(event.key==='Enter'||event.key===' ') { event.preventDefault(); readAloudFromElement(this); }" aria-label="{{ _('Ergebnis vorlesen') }}" title="{{ _('Ergebnis vorlesen') }}" tabindex="0">🔊</button>
|
||||
{{ _('Kalenderwoche von') }} <b>{{ format_date(request.form.get('datum6', '')) }}</b>: {{ kw_berechnen }}
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -975,7 +1590,7 @@ footer br + a {
|
||||
</form>
|
||||
{% if kw_datum is not none %}
|
||||
<div class="result" aria-live="polite">
|
||||
<button type="button" class="read-aloud-btn" onclick="readAloudFromElement(this)" onkeydown="if(event.key==='Enter'||event.key===' ') { event.preventDefault(); readAloudFromElement(this); }" aria-label="Ergebnis vorlesen" title="Ergebnis vorlesen" tabindex="0">🔊</button>
|
||||
<button type="button" class="read-aloud-btn" onclick="readAloudFromElement(this)" onkeydown="if(event.key==='Enter'||event.key===' ') { event.preventDefault(); readAloudFromElement(this); }" aria-label="{{ _('Ergebnis vorlesen') }}" title="{{ _('Ergebnis vorlesen') }}" tabindex="0">🔊</button>
|
||||
{{ _('Start-/Enddatum der KW') }} <b>{{ request.form.get('kw7', '') }}</b> {{ _('im Jahr') }} <b>{{ request.form.get('jahr7', '') }}</b>: {{ kw_datum }}
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -1021,13 +1636,63 @@ footer br + a {
|
||||
</form>
|
||||
{% if plusminus_result is not none %}
|
||||
<div class="result" aria-live="polite">
|
||||
<button type="button" class="read-aloud-btn" onclick="readAloudFromElement(this)" onkeydown="if(event.key==='Enter'||event.key===' ') { event.preventDefault(); readAloudFromElement(this); }" aria-label="Ergebnis vorlesen" title="Ergebnis vorlesen" tabindex="0">🔊</button>
|
||||
<button type="button" class="read-aloud-btn" onclick="readAloudFromElement(this)" onkeydown="if(event.key==='Enter'||event.key===' ') { event.preventDefault(); readAloudFromElement(this); }" aria-label="{{ _('Ergebnis vorlesen') }}" title="{{ _('Ergebnis vorlesen') }}" tabindex="0">🔊</button>
|
||||
{{ plusminus_result }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Calculator Button -->
|
||||
<div style="text-align: center; margin-top: 1.5em;">
|
||||
<button type="button" id="calculatorBtn" class="calculator-btn" onclick="showCalculator()" aria-label="{{ _('Taschenrechner öffnen') }}" title="{{ _('Taschenrechner öffnen') }}" tabindex="0">
|
||||
🧮 {{ _('Taschenrechner') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Calculator Modal Overlay -->
|
||||
<div id="calculatorModal" class="modal-overlay" role="dialog" aria-labelledby="calculator-title" style="display: none;">
|
||||
<div class="modal-content calculator-modal">
|
||||
<button type="button" class="modal-close" onclick="hideCalculator()" aria-label="{{ _('Taschenrechner schließen') }}">×</button>
|
||||
<h1 id="calculator-title">{{ _('Taschenrechner') }}</h1>
|
||||
<p class="sr-only">{{ _('Verwenden Sie die Tab-Taste um durch die Tasten zu navigieren. Tastatur-Kurzbefehle: Zahlen 0-9, Punkt oder Komma für Dezimal, Plus (+) oder P für Addition, Minus (-) oder M für Subtraktion, Stern (*) oder X für Multiplikation, Schrägstrich (/) oder D für Division, Enter oder Leertaste für Gleich, C für Löschen, Backspace für letzte Ziffer löschen.') }}</p>
|
||||
|
||||
<div class="calculator">
|
||||
<div class="calculator-history" id="calculatorHistory" aria-label="{{ _('Berechnungsverlauf') }}" role="log" aria-live="polite"></div>
|
||||
<div class="calculator-display">
|
||||
<div style="position: relative; display: flex; align-items: center;">
|
||||
<input type="text" id="calculatorInput" readonly aria-label="{{ _('Taschenrechner Anzeige') }}" value="0" role="textbox" aria-live="polite">
|
||||
<button type="button" class="read-aloud-btn" onclick="readAloudFromCalculator(this)" onkeydown="if(event.key==='Enter'||event.key===' ') { event.preventDefault(); readAloudFromCalculator(this); }" aria-label="{{ _('Ergebnis vorlesen') }}" title="{{ _('Ergebnis vorlesen') }}" tabindex="0" style="position: absolute; right: 0.5em; top: 50%; transform: translateY(-50%);">🔊</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="calculator-buttons">
|
||||
<button type="button" onclick="calculatorClear()" class="calc-btn calc-clear" aria-label="{{ _('Löschen (Taste: C)') }}" tabindex="0">C</button>
|
||||
<button type="button" onclick="calculatorDelete()" class="calc-btn calc-delete" aria-label="{{ _('Letzte Ziffer löschen (Taste: Backspace)') }}" tabindex="0">⌫</button>
|
||||
<button type="button" onclick="calculatorOperator('/')" class="calc-btn calc-operator" aria-label="{{ _('Dividieren (Taste: / oder D)') }}" tabindex="0">÷</button>
|
||||
<button type="button" onclick="calculatorOperator('*')" class="calc-btn calc-operator" aria-label="{{ _('Multiplizieren (Taste: * oder X)') }}" tabindex="0">×</button>
|
||||
|
||||
<button type="button" onclick="calculatorNumber('7')" class="calc-btn" aria-label="{{ _('Sieben') }}" tabindex="0">7</button>
|
||||
<button type="button" onclick="calculatorNumber('8')" class="calc-btn" aria-label="{{ _('Acht') }}" tabindex="0">8</button>
|
||||
<button type="button" onclick="calculatorNumber('9')" class="calc-btn" aria-label="{{ _('Neun') }}" tabindex="0">9</button>
|
||||
<button type="button" onclick="calculatorOperator('-')" class="calc-btn calc-operator" aria-label="{{ _('Subtrahieren (Taste: - oder M)') }}" tabindex="0">−</button>
|
||||
|
||||
<button type="button" onclick="calculatorNumber('4')" class="calc-btn" aria-label="{{ _('Vier') }}" tabindex="0">4</button>
|
||||
<button type="button" onclick="calculatorNumber('5')" class="calc-btn" aria-label="{{ _('Fünf') }}" tabindex="0">5</button>
|
||||
<button type="button" onclick="calculatorNumber('6')" class="calc-btn" aria-label="{{ _('Sechs') }}" tabindex="0">6</button>
|
||||
<button type="button" onclick="calculatorOperator('+')" class="calc-btn calc-operator" aria-label="{{ _('Addieren (Taste: + oder P)') }}" tabindex="0">+</button>
|
||||
|
||||
<button type="button" onclick="calculatorNumber('1')" class="calc-btn" aria-label="{{ _('Eins') }}" tabindex="0">1</button>
|
||||
<button type="button" onclick="calculatorNumber('2')" class="calc-btn" aria-label="{{ _('Zwei') }}" tabindex="0">2</button>
|
||||
<button type="button" onclick="calculatorNumber('3')" class="calc-btn" aria-label="{{ _('Drei') }}" tabindex="0">3</button>
|
||||
<button type="button" onclick="calculatorEquals()" class="calc-btn calc-equals" aria-label="{{ _('Gleich (Taste: Enter oder Leertaste)') }}" tabindex="0">=</button>
|
||||
|
||||
<button type="button" onclick="calculatorNumber('0')" class="calc-btn calc-zero" aria-label="{{ _('Null') }}" tabindex="0">0</button>
|
||||
<button type="button" onclick="calculatorDecimal()" class="calc-btn" aria-label="{{ _('Komma (Taste: . oder ,)') }}" tabindex="0">.</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Help Modal Overlay -->
|
||||
@@ -1081,24 +1746,11 @@ footer br + a {
|
||||
</div>
|
||||
|
||||
<footer style="text-align:center; margin-top:2em; color:#475569; font-size:0.98em; padding-bottom:1.5em;">
|
||||
Dies ist ein werbe- und trackingfreier <a href="https://codeberg.org/elpatron/datecalc/src/branch/main/README.md" target="_blank" style="color:#1e40af; text-decoration:underline;">Open Source Datumsrechner</a><br>
|
||||
Dies ist ein werbe- und trackingfreier <a href="https://codeberg.org/elpatron/datecalc/src/branch/main/README.md" target="_blank" style="color:#1e40af; text-decoration:underline;">Open Source</a> Datumsrechner<br>
|
||||
<a href="/api-docs" target="_blank" style="color:#1e40af; text-decoration:underline;">REST API Dokumentation (Swagger)</a><br>
|
||||
© 2025 <a href="mailto:elpatron@mailbox.org?subject=Datumsrechner" style="color:#1e40af; text-decoration:underline;">M. Busche</a>
|
||||
© 2025 <a href="mailto:elpatron@mailbox.org?subject=Datumsrechner" style="color:#1e40af; text-decoration:underline;">Markus Busche</a>
|
||||
<div style="margin-top:0.5em; font-size:0.85em; color:#64748b;">v{{ app_version }}</div>
|
||||
</footer>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var werktageCheckbox = document.getElementById('werktage');
|
||||
var bundeslandSelect = document.getElementById('bundesland');
|
||||
if (werktageCheckbox && bundeslandSelect) {
|
||||
function toggleBundesland() {
|
||||
bundeslandSelect.disabled = !werktageCheckbox.checked;
|
||||
}
|
||||
werktageCheckbox.addEventListener('change', toggleBundesland);
|
||||
// Initial setzen
|
||||
toggleBundesland();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -221,10 +221,11 @@ def test_api_plusminus(client):
|
||||
def test_api_stats(client):
|
||||
resp = client.get('/api/stats')
|
||||
assert resp.status_code == 200
|
||||
# Die Route gibt HTML zurück, nicht JSON
|
||||
html = resp.data.decode('utf-8')
|
||||
# Prüfe auf typische HTML-Elemente des Dashboards
|
||||
assert 'Statistik-Dashboard' in html or 'Dashboard' in html
|
||||
data = resp.get_json()
|
||||
assert "pageviews" in data
|
||||
assert "func_counts" in data
|
||||
assert "impressions_per_day" in data
|
||||
assert "api_counts" in data
|
||||
|
||||
def test_api_monitor(client):
|
||||
resp = client.get('/api/monitor')
|
||||
|
Binary file not shown.
@@ -480,4 +480,108 @@ msgstr "Select German"
|
||||
|
||||
#: templates/index.html:131
|
||||
msgid "English auswählen"
|
||||
msgstr "Select English"
|
||||
msgstr "Select English"
|
||||
|
||||
#: templates/index.html:132
|
||||
msgid "Taschenrechner"
|
||||
msgstr "Calculator"
|
||||
|
||||
#: templates/index.html:133
|
||||
msgid "Taschenrechner öffnen"
|
||||
msgstr "Open calculator"
|
||||
|
||||
#: templates/index.html:134
|
||||
msgid "Taschenrechner schließen"
|
||||
msgstr "Close calculator"
|
||||
|
||||
#: templates/index.html:135
|
||||
msgid "Verwenden Sie die Tab-Taste um durch die Tasten zu navigieren. Tastatur-Kurzbefehle: Zahlen 0-9, Punkt oder Komma für Dezimal, Plus (+) oder P für Addition, Minus (-) oder M für Subtraktion, Stern (*) oder X für Multiplikation, Schrägstrich (/) oder D für Division, Enter oder Leertaste für Gleich, C für Löschen, Backspace für letzte Ziffer löschen."
|
||||
msgstr "Use the Tab key to navigate through the buttons. Keyboard shortcuts: Numbers 0-9, period or comma for decimal, Plus (+) or P for addition, Minus (-) or M for subtraction, Asterisk (*) or X for multiplication, Slash (/) or D for division, Enter or Space for equals, C for clear, Backspace for delete last digit."
|
||||
|
||||
#: templates/index.html:136
|
||||
msgid "Taschenrechner Anzeige"
|
||||
msgstr "Calculator display"
|
||||
|
||||
#: templates/index.html:137
|
||||
msgid "Berechnungsverlauf"
|
||||
msgstr "Calculation history"
|
||||
|
||||
#: templates/index.html:138
|
||||
msgid "Löschen (Taste: C)"
|
||||
msgstr "Clear (key: C)"
|
||||
|
||||
#: templates/index.html:139
|
||||
msgid "Letzte Ziffer löschen (Taste: Backspace)"
|
||||
msgstr "Delete last digit (key: Backspace)"
|
||||
|
||||
#: templates/index.html:140
|
||||
msgid "Dividieren (Taste: / oder D)"
|
||||
msgstr "Divide (key: / or D)"
|
||||
|
||||
#: templates/index.html:141
|
||||
msgid "Multiplizieren (Taste: * oder X)"
|
||||
msgstr "Multiply (key: * or X)"
|
||||
|
||||
#: templates/index.html:142
|
||||
msgid "Sieben"
|
||||
msgstr "Seven"
|
||||
|
||||
#: templates/index.html:143
|
||||
msgid "Acht"
|
||||
msgstr "Eight"
|
||||
|
||||
#: templates/index.html:144
|
||||
msgid "Neun"
|
||||
msgstr "Nine"
|
||||
|
||||
#: templates/index.html:145
|
||||
msgid "Subtrahieren (Taste: - oder M)"
|
||||
msgstr "Subtract (key: - or M)"
|
||||
|
||||
#: templates/index.html:146
|
||||
msgid "Vier"
|
||||
msgstr "Four"
|
||||
|
||||
#: templates/index.html:147
|
||||
msgid "Fünf"
|
||||
msgstr "Five"
|
||||
|
||||
#: templates/index.html:148
|
||||
msgid "Sechs"
|
||||
msgstr "Six"
|
||||
|
||||
#: templates/index.html:149
|
||||
msgid "Addieren (Taste: + oder P)"
|
||||
msgstr "Add (key: + or P)"
|
||||
|
||||
#: templates/index.html:150
|
||||
msgid "Eins"
|
||||
msgstr "One"
|
||||
|
||||
#: templates/index.html:151
|
||||
msgid "Zwei"
|
||||
msgstr "Two"
|
||||
|
||||
#: templates/index.html:152
|
||||
msgid "Drei"
|
||||
msgstr "Three"
|
||||
|
||||
#: templates/index.html:153
|
||||
msgid "Gleich (Taste: Enter oder Leertaste)"
|
||||
msgstr "Equals (key: Enter or Space)"
|
||||
|
||||
#: templates/index.html:154
|
||||
msgid "Null"
|
||||
msgstr "Zero"
|
||||
|
||||
#: templates/index.html:155
|
||||
msgid "Komma (Taste: . oder ,)"
|
||||
msgstr "Decimal (key: . or ,)"
|
||||
|
||||
#: templates/index.html:156
|
||||
msgid "Fehler"
|
||||
msgstr "Error"
|
||||
|
||||
#: templates/index.html:157
|
||||
msgid "Berechnung"
|
||||
msgstr "Calculation"
|
||||
|
Reference in New Issue
Block a user