diff --git a/public/assets/js/lang.js b/public/assets/js/lang.js index f5a0136..858e63b 100644 --- a/public/assets/js/lang.js +++ b/public/assets/js/lang.js @@ -1,23 +1,24 @@ -// public/assets/js/lang-usbcheck.js +// public/assets/js/lang.js (function () { const translations = { de: { + header_slogan: "USB-Sticks testen", + btn_login: "Login", - header_slogan: "USB-Sticks testen", - btn_login: "Login", + nav_how: "Ablauf", + nav_problem: "Problem", + nav_features: "Funktionen", + nav_security: "Sicherheit", + nav_faq: "FAQ", - nav_how: "Ablauf", - nav_problem: "Problem", - nav_features: "Funktionen", - nav_security: "Sicherheit", - nav_faq: "FAQ", + footer_imprint: "Impressum", + footer_privacy: "Datenschutz", - footer_imprint: "Impressum", - footer_privacy: "Datenschutz", brand_wordmark: "usbcheck.it", brand_subtitle: "USB-Sticks auf Fakes testen", - btn_login: "Login", + // btn_login oben bereits definiert, diese Zeile könnte theoretisch entfallen + // btn_login: "Login", nav_how: "Wie es funktioniert", nav_problem: "Warum es wichtig ist", @@ -130,20 +131,21 @@ }, en: { - header_slogan: "Test USB drives", - btn_login: "Login", + header_slogan: "Test USB drives", + btn_login: "Login", - nav_how: "How it works", - nav_problem: "Why it matters", - nav_features: "Features", - nav_security: "Security", - nav_faq: "FAQ", + nav_how: "How it works", + nav_problem: "Why it matters", + nav_features: "Features", + nav_security: "Security", + nav_faq: "FAQ", + + footer_imprint: "Imprint", + footer_privacy: "Privacy policy", - footer_imprint: "Imprint", - footer_privacy: "Privacy policy", brand_wordmark: "usbcheck.it", brand_subtitle: "Test USB drives for fakes", - btn_login: "Login", + // btn_login oben bereits gesetzt nav_how: "How it works", nav_problem: "Why it matters", @@ -231,6 +233,7 @@ security_kicker: "Security & privacy", security_title: "Privacy-first design: your test data is yours.", security_intro: "USBCheck was designed from day one to protect your data. The browser quick test only works with test files. Your own documents, photos and backups are never read or uploaded. In Pro mode you decide if and which reports are synced to your account.", + security_card1_title: "Local-only tests", security_card1_text: "All write and read tests run locally on your USB drive. The browser only accesses test files – not your private content.", security_card2_title: "Transparent reports", @@ -257,20 +260,21 @@ // Italienisch (kurz, sachlich) it: { - header_slogan: "Test delle chiavette USB", - btn_login: "Accesso", + header_slogan: "Test delle chiavette USB", + btn_login: "Accesso", - nav_how: "Come funziona", - nav_problem: "Perché è importante", - nav_features: "Funzioni", - nav_security: "Sicurezza", - nav_faq: "FAQ", + nav_how: "Come funziona", + nav_problem: "Perché è importante", + nav_features: "Funzioni", + nav_security: "Sicurezza", + nav_faq: "FAQ", + + footer_imprint: "Imprint", + footer_privacy: "Privacy", - footer_imprint: "Imprint", - footer_privacy: "Privacy", brand_wordmark: "usbcheck.it", brand_subtitle: "Controlla le chiavette USB contraffatte", - btn_login: "Login", + // btn_login: "Login", nav_how: "Come funziona", nav_problem: "Perché è importante", @@ -385,20 +389,21 @@ // Französisch (kurz, sachlich) fr: { - header_slogan: "Tester vos clés USB", - btn_login: "Connexion", + header_slogan: "Tester vos clés USB", + btn_login: "Connexion", - nav_how: "Fonctionnement", - nav_problem: "Problème", - nav_features: "Fonctionnalités", - nav_security: "Sécurité", - nav_faq: "FAQ", + nav_how: "Fonctionnement", + nav_problem: "Problème", + nav_features: "Fonctionnalités", + nav_security: "Sécurité", + nav_faq: "FAQ", + + footer_imprint: "Mentions légales", + footer_privacy: "Confidentialité", - footer_imprint: "Mentions légales", - footer_privacy: "Confidentialité", brand_wordmark: "usbcheck.it", brand_subtitle: "Tester les clés USB contrefaites", - btn_login: "Connexion", + // btn_login: "Connexion", nav_how: "Fonctionnement", nav_problem: "Pourquoi c’est important", @@ -558,6 +563,12 @@ localStorage.setItem('usbcheck_lang', lang); applyTranslations(lang); + // Button-Label im Header aktualisieren + const currentLabel = document.getElementById('langCurrentLabel') || document.getElementById('langCurrent'); + if (currentLabel) { + currentLabel.textContent = lang.toUpperCase(); + } + // Optional: URL-Parameter aktualisieren (ohne Reload) const url = new URL(window.location.href); url.searchParams.set('lang', lang); @@ -568,7 +579,49 @@ const initialLang = getInitialLang(); applyTranslations(initialLang); - // Sprachumschaltung + // --- Dropdown-Elemente im Header holen --- + const langCurrent = document.getElementById('langCurrent'); + const langCurrentLabel = document.getElementById('langCurrentLabel'); + const langMenu = document.getElementById('langMenu'); + + // aktuelles Label für den Header-Button setzen + if (langCurrentLabel) { + langCurrentLabel.textContent = initialLang.toUpperCase(); + } else if (langCurrent) { + langCurrent.textContent = initialLang.toUpperCase(); + } + + // Dropdown-Logik für Sprachauswahl + if (langCurrent && langMenu) { + // Toggle Menü bei Klick auf den Button + langCurrent.addEventListener('click', function (e) { + e.stopPropagation(); + langMenu.classList.toggle('hidden'); + }); + + // Menü schließen bei Klick außerhalb + document.addEventListener('click', function (e) { + if (!langMenu.classList.contains('hidden')) { + if ( + !langMenu.contains(e.target) && + e.target !== langCurrent && + !langCurrent.contains(e.target) + ) { + langMenu.classList.add('hidden'); + } + } + }); + + // Menü schließen, wenn eine Sprache gewählt wurde + langMenu.addEventListener('click', function (e) { + const pill = e.target.closest('.lang-pill'); + if (pill) { + langMenu.classList.add('hidden'); + } + }); + } + + // Sprachumschaltung (Click auf .lang-pill → Sprache setzen) document.addEventListener('click', function (e) { const btn = e.target.closest('.lang-pill'); if (btn) { diff --git a/public/partials/header.php b/public/partials/header.php index 4218c20..8263017 100644 --- a/public/partials/header.php +++ b/public/partials/header.php @@ -30,34 +30,44 @@ - -