From dc1cb4b57d67c25c11025e329d71403f557f4e7a Mon Sep 17 00:00:00 2001 From: Scarriffle Date: Mon, 11 May 2026 08:54:20 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20Popup-Action-Icons=20riesig,=20"copy"=20?= =?UTF-8?q?als=20Text=20=E2=80=94=20Cache-Robustheit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wenn der Browser noch die alte CSS bzw. i18n.js aus dem Cache hatte, lief das neu strukturierte Popup ins Leere: - SVGs ohne CSS-Width-Constraint nahmen die Browser-Standardgröße (300×150) an → riesige Icons, Layout brach in Vertikalstapel - Der Key "copy" fehlte in der alten i18n.js → "Kopieren" wurde durch den Roh-Key "copy" ersetzt Robust gemacht: - SVGs der Action-Buttons bekommen jetzt direkt im HTML width="16" height="16" — funktioniert auch ohne dass die zugehörige CSS-Regel geladen wurde - applyLang() in i18n.js fällt bei fehlendem Schlüssel auf den HTML-Default-Text zurück, anstatt den Key als Text einzuschreiben (gleiches Prinzip für data-i18n, -i18n-ph, -i18n-title) Version v15 → v16. --- frontend/index.html | 24 ++++++++++++------------ frontend/js/i18n.js | 19 +++++++++++++++---- frontend/js/version.js | 2 +- frontend/sw.js | 2 +- 4 files changed, 29 insertions(+), 18 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index 35256fd..e73b5dd 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -4,7 +4,7 @@ - Calendarr v15 + Calendarr v16 @@ -80,7 +80,7 @@ - + @@ -199,7 +199,7 @@
- + @@ -235,7 +235,7 @@
- +
@@ -243,7 +243,7 @@
- +
@@ -253,7 +253,7 @@
- +
@@ -261,7 +261,7 @@
- +
@@ -311,7 +311,7 @@
- +
@@ -385,15 +385,15 @@ @@ -889,7 +889,7 @@ scarriffleservices@gmail.com

diff --git a/frontend/js/i18n.js b/frontend/js/i18n.js index ba49419..957b180 100644 --- a/frontend/js/i18n.js +++ b/frontend/js/i18n.js @@ -442,15 +442,26 @@ export function t(key, vars = {}) { return val.replace(/\{(\w+)\}/g, (_, k) => vars[k] ?? ''); } +// Look up a translation but return null if the key is undefined in both +// the current language and German. Lets callers fall back to the existing +// HTML default rather than displaying the raw key. +function tOrNull(key) { + const dict = translations[currentLang] ?? translations.de; + const val = dict[key] ?? translations.de[key]; + return typeof val === 'string' ? val : null; +} + export function applyLang() { document.querySelectorAll('[data-i18n]').forEach(el => { - const v = t(el.dataset.i18n); - if (typeof v === 'string') el.textContent = v; + const v = tOrNull(el.dataset.i18n); + if (v != null) el.textContent = v; }); document.querySelectorAll('[data-i18n-ph]').forEach(el => { - el.placeholder = t(el.dataset.i18nPh); + const v = tOrNull(el.dataset.i18nPh); + if (v != null) el.placeholder = v; }); document.querySelectorAll('[data-i18n-title]').forEach(el => { - el.title = t(el.dataset.i18nTitle); + const v = tOrNull(el.dataset.i18nTitle); + if (v != null) el.title = v; }); } diff --git a/frontend/js/version.js b/frontend/js/version.js index 0384aba..15b9c55 100644 --- a/frontend/js/version.js +++ b/frontend/js/version.js @@ -1,2 +1,2 @@ // Increment APP_VERSION with every code change -export const APP_VERSION = 'v15'; +export const APP_VERSION = 'v16'; diff --git a/frontend/sw.js b/frontend/sw.js index aeed36d..344e6a0 100644 --- a/frontend/sw.js +++ b/frontend/sw.js @@ -7,7 +7,7 @@ // the entry HTML / version files). New releases take effect on the next // reload, no manual SW unregister required. -const CACHE_VERSION = 'calendarr-v15'; +const CACHE_VERSION = 'calendarr-v16'; const OFFLINE_SHELL = ['/', '/index.html']; self.addEventListener('install', event => {