<?php
require_once 'inc/config.php';

$defaultLang = Config::$default['lang_default'] ?? 'de';
$lang = strtolower($_POST['lang'] ?? $_GET['lang'] ?? $defaultLang);
if (!in_array($lang, ['de','en','fr','it'])) $lang = $defaultLang;

// Translations
$T = [
  'de' => [
  'link_not_found' => "❌ Link nicht gefunden oder bereits benutzt.",
  'file_missing' => "❌ Datei nicht mehr vorhanden.",
  'password_required' => "🔐 Passwort erforderlich",
  'enter_password' => "🔐 Passwort eingeben",
  'start_download' => "📥 Download starten",
  'no_file_selected' => "❌ Keine Datei ausgewählt.",
  'upload_error' => "❌ Fehler beim Hochladen der Datei.",
  'upload_text' => "⬆️ Hochladen",
  'upload_success' => "✅ Hochladen erfolgreich",
  'creating_zip' => "⏳ ZIP wird erstellt...",
  'temp_dir_error' => "❌ Konnte temporäres Verzeichnis nicht anlegen.",
  'error_upload_file' => "❌ Fehler beim Hochladen der Datei ",
  'wrong_password' => "❌ Falsches Passwort",
  'your_link' => "Dein Link:",
  'copy' => "📋 Kopieren",
  'copied' => "✅ Kopiert!",
  'share_files' => "📤 Dateien teilen",
  'drag_files' => "📂 Dateien hierher ziehen oder klicken",
  'password_optional' => "🔐 Passwort (optional)",
  'valid_once' => "⏳ Nur 1× herunterladbar",
  'valid_1h' => "🕐 1 Stunde gültig",
  'valid_3h' => "🕒 3 Stunden gültig",
  'valid_6h' => "🕕 6 Stunden gültig",
  'valid_12h' => "🕛 12 Stunden gültig",
  'valid_1d' => "📅 1 Tag gültig",
  'valid_3d' => "📅 3 Tage gültig",
  'valid_7d' => "📅 7 Tage gültig",
  'valid_14d' => "📅 14 Tage gültig",
  'valid_30d' => "📅 30 Tage gültig",
  'valid_forever' => "📅 Unbegrenzt gültig",
  'upload_button' => "📤 Hochladen & Link erstellen",
  'upload_button_only_upload' => "📤 Hochladen",
  'upload_button_send_email' => "📤 Hochladen & E-Mail senden",
  'uploading' => "📤 Dateien werden hochgeladen...",
  'selected_files' => "Ausgewählte Datei",
  'selected_files_plural' => "Ausgewählte Dateien",
  'diskspace_error' => "❌ Nicht genügend Speicherplatz!",
  'diskspace_check_failed' => "⚠️ Speicherplatzprüfung fehlgeschlagen!",
  'diskspace_required' => "Benötigt:",
  'diskspace_free' => "Frei:",
  'send_email_yes' => "📧 Per E-Mail senden",
  'send_email_no' => "🔗 Nur Link erstellen",
  'uploader_email' => "📨 Deine E-Mail-Adresse (erforderlich)",
  'recipient_email' => "📬 Alle Empfänger E-Mail-Adressen (erforderlich)",
  'email_sent' => "✅ E-Mail an dich gesendet, bitte verifiziere den Link.",
  'sent_title_uploader' => "Bestätige deinen Upload",
  'sent_message_uploader' => "<p>Hallo,</p><p>bitte bestätige deinen Upload durch Klick auf den untenstehenden Link.</p><p>Viele Grüsse</p>",
  'verification_title' => "⚠️ Bestätigung erforderlich",
  'verification_text' => "Um den Upload zu bestätigen, klicke bitte auf den folgenden Button:",
  'verification_button' => "✅ Upload bestätigen",
  'verification_link_error' => "❌ Ungültiger oder manipulierte Link.",
  'verification_database_error' => "❌ Datei-Datenbank fehlt.",
  'verification_token_error' => "❌ Upload nicht gefunden.",
  'verification_email_error' => "❌ E-Mail stimmt nicht mit Upload überein.",
  'verification_verified_error' => "✅ Dieser Upload wurde bereits bestätigt.",
  'verification_recipient_error' => "❌ Kein gültiger Empfänger oder Link.",
  'sent_title_recipient' => "Ihr Download-Link",
  'sent_message_recipient1' => "<p>Hallo,</p><p>Sie haben eine Datei von ",
  'sent_message_recipient2' => "erhalten.</p><p>Sie können die Datei jetzt mit dem untenstehenden Link herunterladen.</p></p><p>Viele Grüsse</p>",
  'verification_success' => "✅ Upload bestätigt. Die Empfänger wurden benachrichtigt.",
  'admin_panel' => "⚙️ Admin Panel",
  'admin_setup' => "⚙️ Admin Einrichtung",
  'admin_login' => "⚙️ Admin Login",
  'user_login' => "➡️ Benutzer Login",
  'user_register' => "⚠️ Bitte ein Benutzerkonto im Admin-Panel einrichten",
  'username' => "Benutzername",
  'password' => "Passwort",
  'password_confirm' => "Passwort wiederholen",
  'register_error' => "Bitte Benutzername und Passwort ausfüllen",
  'password_error' => "Passwörter stimmen nicht überein",
  'login_error' => "❌ Login fehlgeschlagen",
  'entry_delete' => "✅ Eintrag gelöscht",
  'mode_change' => "✅ Modus geändert auf ",
  'verification_change' => "✅ Verified-Status geändert",
  'password_change' => "✅ Passwort geändert",
  'noentry' => "Keine Einträge gefunden",
  'th_file' => "Datei & externer Link",
  'th_size' => "Grösse",
  'th_uploaddate' => "Uploaddatum",
  'th_expirationdate' => "Ablaufdatum",
  'th_mode' => "Modus",
  'th_status' => "Letzter Download",
  'th_password' => "Passwort",
  'th_email' => "E-Mails",
  'th_actions' => "Aktionen",
  'password_set' => "🔐 Passwort gesetzt",
  'password_notset' => "🔓 Kein Passwort gesetzt",
  'password_notice' => "🔑 Neues Passwort (leer = löschen)",
  'uploader' => "Uploader",
  'recipient' => "Empfänger",
  'save_button' => "💾 Speichern",
  'download_button' => "📥 Download",
  'delete_button' => "❌ Löschen",
  'create_admin_button' => "👤➕ Admin erstellen",
  'login_button' => "➡️ Einloggen",
  'logout_button' => "🔚 Ausloggen",
  'delete_confirm' => "Wirklich löschen?",
  'show_uploads_button' => "📄 Uploads anzeigen",
  'hide_uploads_button' => "📄 Uploads ausblenden",
  'search_placeholder' => "🔍 Dateiname, Dateigrösse, Datum oder E-Mail suchen",
  'verified' => "verifiziert",
  'notverified' => "nicht verifiziert",
  'general_configuration' => "⚙️ Allgemeine Konfiguration",
  'lang_title' => "🌍 Standard-Sprache",
  'timezone_title' => "🕒 Zeitzone",
  'admin_email_title' => "📧 Admin E-Mail-Adresse",
  'admin_notify_mode' => '📧 Admin per E-Mail über neue Uploads informieren',
  'sent_title_admin' => "Neuer Upload erstellt",
  'token' => "Token",
  'file' => "Datei",
  'sent_message_admin' => "Diese Nachricht wurde automatisch generiert.",
  'values_title' => "⚙️ Werte",
  'configuration_save_button' => "💾 Konfiguration speichern",
  'configuration_save' => "✅ Konfiguration gespeichert",
  'only_upload_mode' => "📤 Nur-Upload-Modus (keine Link-Generierung)",
  'user_upload_mode' => "👤 Uploads nur mit Benutzerkonto",
  'send_email_mode' => "📧 E-Mail-Modus aktivieren (keine Link-Generierung)",
  'showdp_mode' => "📥 Downloadseite anzeigen (kein direkter Download)",
  'pwzip_mode' => "🔐 ZIP selbst mit Passwort schützen (nicht nur Download, keine Passwortänderung möglich)",
  'smtp_configuration' => "📧 E-Mail-Server Konfiguration (.env)",
  'smtphost_title' => "🌐 SMTP Host",
  'smtpport_title' => "🔌 SMTP Port (muss SSL-Port 465 sein)",
  'smtpuser_title' => "👤 SMTP Benutzername",
  'smtppass_title' => "🔐 SMTP Passwort",
  'smtpfrom_title' => "📧 SMTP FROM-Adresse (Sender)",
  'smtp_save_button' => "💾 SMTP-Einstellungen speichern",
  'smtp_save' => "✅ SMTP-Konfiguration gespeichert",
  'admin_configuration' => "🧑‍💻 Admin Benutzer",
  'admin_save_button' => "💾 Admin speichern",
  'admin_save' => "✅ Admin gespeichert",
  'user_configuration' => "👥 Benutzerverwaltung",
  'user_existing_title' => "👤 Bestehende Benutzer",
  'user_date' => "Erstellt am",
  'user_add_title' => "👤➕ Neuen Benutzer anlegen",
  'user_add_button' => "➕ Benutzer hinzufügen",
  'user_save' => "✅ Benutzer wurde hinzugefügt",
  'user_error_exists' => "❌ Benutzer existiert bereits",
  'user_error_notfound' => "❌ Benutzer nicht gefunden",
  'user_empty' => "Noch keine Benutzer angelegt",
  'password_new' => "Neues Passwort",
  'uploaded_by' => "Hochgeladen vom Benutzer",
  'language' => "Sprache",
  'title' => "Dropzone File Sharing",
  'version' => "V.3.1",
  'meta' => "Dropzone File Sharing ermöglicht schnelles und sicheres Teilen von Dateien mit Zugriffskontrolle, Zeitlimits, Passwortschutz und optionalem E-Mail-Versand.",
  'footer_text' => "© 2025 von Kevin Tobler - <a href='https://kevintobler.ch' target='_blank'>www.kevintobler.ch</a> - <a href='disclaimer.php?lang={$lang}'>🛡️ Datenschutzerklärung und Haftungsausschluss</a>",
  ],
  'en' => [
  'link_not_found' => "❌ Link not found or already used.",
  'file_missing' => "❌ File no longer available.",
  'password_required' => "🔐 Password required",
  'enter_password' => "🔐 Enter password",
  'start_download' => "📥 Start download",
  'no_file_selected' => "❌ No file selected.",
  'upload_error' => "❌ Error uploading the file.",
  'upload_text' => "⬆️ Upload",
  'upload_success' => "✅ Upload finished",
  'creating_zip' => "⏳ Creating ZIP...",
  'temp_dir_error' => "❌ Could not create temporary directory.",
  'error_upload_file' => "❌ Error uploading file ",
  'wrong_password' => "❌ Incorrect password",
  'your_link' => "Your link:",
  'copy' => "📋 Copy",
  'copied' => "✅ Copied!",
  'share_files' => "📤 Share files",
  'drag_files' => "📂 Drag files here or click",
  'password_optional' => "🔐 Password (optional)",
  'valid_once' => "⏳ Downloadable only 1x",
  'valid_1h' => "🕐 Valid for 1 hour",
  'valid_3h' => "🕒 Valid for 3 hours",
  'valid_6h' => "🕕 Valid for 6 hours",
  'valid_12h' => "🕛 Valid for 12 hours",
  'valid_1d' => "📅 Valid for 1 day",
  'valid_3d' => "📅 Valid for 3 days",
  'valid_7d' => "📅 Valid for 7 days",
  'valid_14d' => "📅 Valid for 14 days",
  'valid_30d' => "📅 Valid for 30 days",
  'valid_forever' => "📅 Valid forever",
  'upload_button' => "📤 Upload & create link",
  'upload_button_only_upload' => "📤 Upload",
  'upload_button_send_email' => "📤 Upload & send email",
  'uploading' => "📤 Uploading files...",
  'selected_files' => "Selected file",
  'selected_files_plural' => "Selected files",
  'diskspace_error' => "❌ Not enough disk space!",
  'diskspace_check_failed' => "⚠️ Disk space check failed!",
  'diskspace_required' => "Required:",
  'diskspace_free' => "Free:",
  'send_email_yes' => "📧 Send by email",
  'send_email_no' => "🔗 Create Link only",
  'uploader_email' => "📨 Your email address (required)",
  'recipient_email' => "📬 All recipient email addresses (required)",
  'email_sent' => "✅ An email has been sent to you. Please verify the link.",
  'sent_title_uploader' => "Confirm your upload",
  'sent_message_uploader' => "<p>Hello,</p><p>Please confirm your upload by clicking the link below.</p><p>Best regards</p>",
  'verification_title' => "⚠️ Confirmation required",
  'verification_text' => "To confirm the upload, please click the button below:",
  'verification_button' => "✅ Confirm upload",
  'verification_link_error' => "❌ Invalid or manipulated link.",
  'verification_database_error' => "❌ File database is missing.",
  'verification_token_error' => "❌ Upload not found.",
  'verification_email_error' => "❌ Email does not match the upload.",
  'verification_verified_error' => "✅ This upload has already been confirmed.",
  'verification_recipient_error' => "❌ Invalid recipient or download link.",
  'sent_title_recipient' => "Your download link",
  'sent_message_recipient1' => "<p>Hello,</p><p>You have received a file from ",
  'sent_message_recipient2' => ".</p><p>You can now download the file using the link below.</p><p>Best regards</p>",
  'verification_success' => "✅ Upload confirmed. The recipients have been notified.",
  'admin_panel' => "⚙️ Admin Panel",
  'admin_setup' => "⚙️ Admin Setup",
  'admin_login' => "⚙️ Admin Login",
  'user_login' => "➡️ User Login",
  'user_register' => "⚠️ Please set up a user account in the admin panel",
  'username' => "Username",
  'password' => "Password",
  'password_confirm' => "Confirm Password",
  'register_error' => "Please fill in username and password",
  'password_error' => "Passwords do not match",
  'login_error' => "❌ Login failed",
  'entry_delete' => "✅ Entry deleted",
  'mode_change' => "✅ Mode changed to ",
  'verification_change' => "✅ Verification status changed",
  'password_change' => "✅ Password updated",
  'noentry' => "No entries found",
  'th_file' => "File & external Link",
  'th_size' => "Size",
  'th_uploaddate' => "Upload Date",
  'th_expirationdate' => "Expiration Date",
  'th_mode' => "Mode",
  'th_status' => "Last Download",
  'th_password' => "Password",
  'th_email' => "E-Mails",
  'th_actions' => "Actions",
  'password_set' => "🔐 Password set",
  'password_notset' => "🔓 No password set",
  'password_notice' => "🔑 New password (leave empty = remove)",
  'uploader' => "Uploader",
  'recipient' => "Recipient",
  'save_button' => "💾 Save",
  'download_button' => "📥 Download",
  'delete_button' => "❌ Delete",
  'create_admin_button' => "👤➕ Create Admin",
  'login_button' => "➡️ Login",
  'logout_button' => "🔚 Logout",
  'delete_confirm' => "Really delete?",
  'show_uploads_button' => "📄 Show uploads",
  'hide_uploads_button' => "📄 Hide uploads",
  'search_placeholder' => "🔍 Search filename, filesize, date or email",
  'verified' => "verified",
  'notverified' => "not verified",
  'general_configuration' => "⚙️ General configuration",
  'lang_title' => "🌍 Default language",
  'timezone_title' => "🕒 Time zone",
  'admin_email_title' => "📧 Admin email address",
  'admin_notify_mode' => '📧 Notify admin by email about new uploads',
  'sent_title_admin' => "New upload created",
  'token' => "Token",
  'file' => "File",
  'sent_message_admin' => "This message was generated automatically.",
  'values_title' => "⚙️ Values",
  'configuration_save_button' => "💾 Save configuration",
  'configuration_save' => "✅ Configuration saved",
  'only_upload_mode' => "📤 Upload-only mode (no link generation)",
  'user_upload_mode' => "👤 Allow uploads only with a user account",
  'send_email_mode' => "📧 Enable email mode (no link generation)",
  'showdp_mode' => "📥 Show download page (no direct download)",
  'pwzip_mode' => "🔐 Protect ZIP file itself with a password (not just download, password cannot be changed)",
  'smtp_configuration' => "📧 Email server configuration (.env)",
  'smtphost_title' => "🌐 SMTP Host",
  'smtpport_title' => "🔌 SMTP Port (must be SSL port 465)",
  'smtpuser_title' => "👤 SMTP User",
  'smtppass_title' => "🔐 SMTP Password",
  'smtpfrom_title' => "📧 SMTP FROM address (sender)",
  'smtp_save_button' => "💾 Save SMTP settings",
  'smtp_save' => "✅ SMTP configuration saved",
  'admin_configuration' => "🧑‍💻 Admin user",
  'admin_save_button' => "💾 Save admin",
  'admin_save' => "✅ Admin saved",
  'user_configuration' => "👥 User management",
  'user_existing_title' => "👤 Existing users",
  'user_date' => "Created on",
  'user_add_title' => "👤➕ Create new user",
  'user_add_button' => "➕ Add user",
  'user_save' => "✅ User has been added",
  'user_error_exists' => "❌ User already exists",
  'user_error_notfound' => "❌ User not found",
  'user_empty' => "No users created yet",
  'password_new' => "New password",
  'uploaded_by' => "Uploaded by User",
  'language' => "Language",
  'title' => "Dropzone File Sharing",
  'version' => "V.3.1",
  'meta' => "Dropzone File Sharing enables fast and secure file transfer with access control, expiration limits, password protection and optional email delivery.",
  'footer_text' => "© 2025 by Kevin Tobler - <a href='https://kevintobler.ch' target='_blank'>www.kevintobler.ch</a> - <a href='disclaimer.php?lang={$lang}'>🛡️ Privacy Policy and Disclaimer</a>",
  ],
  'fr' => [
  'link_not_found' => "❌ Le lien n'a pas été trouvé ou il est déjà utilisé.",
  'file_missing' => "❌ Le fichier n'existe pas.",
  'password_required' => "🔐 Un mot de passe est attendu",
  'enter_password' => "🔐 Donnez un mot de passe",
  'start_download' => "📥 Commencer le téléchargement",
  'no_file_selected' => "❌ Aucun fichier de sélectionné.",
  'upload_error' => "❌ Erreur d'envoi.",
  'upload_text' => "⬆️ Envoi",
  'upload_success' => "✅ Envoi terminé",
  'creating_zip' => "⏳ Création du fichier ZIP...",
  'temp_dir_error' => "❌ Impossible de créer le répertoire temporaire.",
  'error_upload_file' => "❌ Erreur d'envoi de fichier ",
  'wrong_password' => "❌ Mot de passe incorrect",
  'your_link' => "Votre lien:",
  'copy' => "📋 Copier",
  'copied' => "✅ Copié!",
  'share_files' => "📤 Partager des fichiers",
  'drag_files' => "📂 Déposer des fichiers ou cliquer ici",
  'password_optional' => "🔐 Mot de passe (optionel)",
  'valid_once' => "⏳ Téléchargeable seulement 1x",
  'valid_1h' => "🕐 Valide pour 1 heure",
  'valid_3h' => "🕒 Valide pour 3 heures",
  'valid_6h' => "🕕 Valide pour 6 heures",
  'valid_12h' => "🕛 Valide pour 12 heures",
  'valid_1d' => "📅 Valide pour 1 jour",
  'valid_3d' => "📅 Valide pour 3 jours",
  'valid_7d' => "📅 Valide pour 7 jours",
  'valid_14d' => "📅 Valide pour 14 jours",
  'valid_30d' => "📅 Valide pour 30 jours",
  'valid_forever' => "📅 Valide indéfiniment",
  'upload_button' => "📤 Envoyer & créer le lien",
  'upload_button_only_upload' => "📤 Envoyer",
  'upload_button_send_email' => "📤 Envoyer & envoyer un email",
  'uploading' => "📤 Téléchargement des fichiers...",
  'selected_files' => "Selectionner fichier",
  'selected_files_plural' => "Selectionner plusieurs fichiers",
  'diskspace_error' => "❌ Espace disque insuffisant!",
  'diskspace_check_failed' => "⚠️ Vérification de l’espace disque échouée!",
  'diskspace_required' => "Nécessaire:",
  'diskspace_free' => "Libre:",
  'send_email_yes' => "📧 Envoyer par email",
  'send_email_no' => "🔗 Créer uniquement le lien",
  'uploader_email' => "📨 Votre adresse email (obligatoire)",
  'recipient_email' => "📬 Toutes les adresses email des destinataires (obligatoire)",
  'email_sent' => "✅ Un email vous a été envoyé. Veuillez vérifier le lien.",
  'sent_title_uploader' => "Confirmez votre envoi",
  'sent_message_uploader' => "<p>Bonjour,</p><p>Veuillez confirmer votre envoi en cliquant sur le lien ci-dessous.</p><p>Meilleures salutations</p>",
  'verification_title' => "⚠️ Confirmation requise",
  'verification_text' => "Pour confirmer l'envoi, veuillez cliquer sur le bouton ci-dessous:",
  'verification_button' => "✅ Confirmer l'envoi",
  'verification_link_error' => "❌ Lien invalide ou modifié.",
  'verification_database_error' => "❌ Base de données des fichiers manquante.",
  'verification_token_error' => "❌ Envoi introuvable.",
  'verification_email_error' => "❌ L'adresse email ne correspond pas à l'envoi.",
  'verification_verified_error' => "✅ Cet envoi a déjà été confirmé.",
  'verification_recipient_error' => "❌ Destinataire ou lien de téléchargement invalide.",
  'sent_title_recipient' => "Votre lien de téléchargement",
  'sent_message_recipient1' => "<p>Bonjour,</p><p>Vous avez reçu un fichier de la part de ",
  'sent_message_recipient2' => ".</p><p>Vous pouvez maintenant télécharger le fichier via le lien ci-dessous.</p><p>Meilleures salutations</p>",
  'verification_success' => "✅ Téléversement vérifié. Les destinataires ont été notifiés.",
  'admin_panel' => "⚙️ Panneau d’administration",
  'admin_setup' => "⚙️ Configuration de l’administrateur",
  'admin_login' => "⚙️ Connexion administrateur",
  'user_login' => "➡️ Connexion utilisateur",
  'user_register' => "⚠️ Veuillez configurer un compte utilisateur dans le panneau d’administration",
  'username' => "Nom d’utilisateur",
  'password' => "Mot de passe",
  'password_confirm' => "Confirmer le mot de passe",
  'register_error' => "Veuillez saisir le nom d’utilisateur et le mot de passe",
  'password_error' => "Les mots de passe ne correspondent pas",
  'login_error' => "❌ Échec de la connexion",
  'entry_delete' => "✅ Entrée supprimée",
  'mode_change' => "✅ Mode changé en ",
  'verification_change' => "✅ Statut de vérification modifié",
  'password_change' => "✅ Mot de passe modifié",
  'noentry' => "Aucune entrée trouvée",
  'th_file' => "Fichier & lien externe",
  'th_size' => "Taille",
  'th_uploaddate' => "Date de téléversement",
  'th_expirationdate' => "Date d’expiration",
  'th_mode' => "Mode",
  'th_status' => "Dernier téléchargement",
  'th_password' => "Mot de passe",
  'th_email' => "E-Mails",
  'th_actions' => "Actions",
  'password_set' => "🔐 Mot de passe défini",
  'password_notset' => "🔓 Aucun mot de passe défini",
  'password_notice' => "🔑 Nouveau mot de passe (laisser vide = supprimer)",
  'uploader' => "Expéditeur",
  'recipient' => "Destinataire",
  'save_button' => "💾 Enregistrer",
  'download_button' => "📥 Télécharger",
  'delete_button' => "❌ Supprimer",
  'create_admin_button' => "👤➕ Créer un administrateur",
  'login_button' => "➡️ Connexion",
  'logout_button' => "🔚 Déconnexion",
  'delete_confirm' => "Voulez-vous vraiment supprimer?",
  'show_uploads_button' => "📄 Afficher les uploads",
  'hide_uploads_button' => "📄 Masquer les uploads",
  'search_placeholder' => "🔍 Rechercher un nom de fichier, une taille, une date ou un email",
  'verified' => "vérifié",
  'notverified' => "non vérifié",
  'general_configuration' => "⚙️ Configuration générale",
  'lang_title' => "🌍 Langue par défaut",
  'timezone_title' => "🕒 Fuseau horaire",
  'admin_email_title' => "📧 Adresse email de l’administrateur",
  'admin_notify_mode' => '📧 Notifier l’administrateur par email lors de nouveaux téléchargements',
  'sent_title_admin' => "Nouveau fichier téléversé",
  'token' => "Jeton",
  'file' => "Fichier",
  'sent_message_admin' => "Ce message a été généré automatiquement.",
  'values_title' => "⚙️ Valeurs",
  'configuration_save_button' => "💾 Enregistrer la configuration",
  'configuration_save' => "✅ Configuration enregistrée",
  'only_upload_mode' => "📤 Mode upload uniquement (pas de génération de lien)",
  'user_upload_mode' => "👤 Autoriser les uploads uniquement pour les comptes utilisateurs",
  'send_email_mode' => "📧 Activer le mode email (pas de génération de lien)",
  'showdp_mode' => "📥 Afficher la page de téléchargement (pas de téléchargement direct)",
  'pwzip_mode' => "🔐 Protéger le fichier ZIP avec un mot de passe (pas seulement le téléchargement, le mot de passe ne peut pas être modifié)",
  'smtp_configuration' => "📧 Configuration du serveur email (.env)",
  'smtphost_title' => "🌐 Hôte SMTP",
  'smtpport_title' => "🔌 Port SMTP (doit être le port SSL 465)",
  'smtpuser_title' => "👤 Utilisateur SMTP",
  'smtppass_title' => "🔐 Mot de passe SMTP",
  'smtpfrom_title' => "📧 Adresse SMTP FROM (expéditeur)",
  'smtp_save_button' => "💾 Enregistrer les paramètres SMTP",
  'smtp_save' => "✅ Configuration SMTP enregistrée",
  'admin_configuration' => "🧑‍💻 Utilisateur administrateur",
  'admin_save_button' => "💾 Enregistrer l’administrateur",
  'admin_save' => "✅ Administrateur enregistré",
  'user_configuration' => "👥 Gestion des utilisateurs",
  'user_existing_title' => "👤 Utilisateurs existants",
  'user_date' => "Créé le",
  'user_add_title' => "👤➕ Créer un nouvel utilisateur",
  'user_add_button' => "➕ Ajouter un utilisateur",
  'user_save' => "✅ L’utilisateur a été ajouté",
  'user_error_exists' => "❌ L’utilisateur existe déjà",
  'user_error_notfound' => "❌ Utilisateur introuvable",
  'user_empty' => "Aucun utilisateur créé pour l’instant",
  'password_new' => "Nouveau mot de passe",
  'uploaded_by' => "Téléversé par l'utilisateur",
  'language' => "Langue",
  'title' => "Dropzone File Sharing",
  'version' => "V.3.1",
  'meta' => "Dropzone File Sharing permet le partage rapide et sécurisé de fichiers, avec contrôle d’accès, délais d’expiration, mot de passe et envoi d’e-mails optionnel.",
  'footer_text' => "© 2025 par Kevin Tobler - <a href='https://kevintobler.ch' target='_blank'>www.kevintobler.ch</a> - <a href='disclaimer.php?lang={$lang}'>🛡️ Politique de confidentialité et exclusion de responsabilité</a>",
  ],
  'it' => [
  'link_not_found' => "❌ Link non trovato o già utilizzato.",
  'file_missing' => "❌ Il file non è più disponibile.",
  'password_required' => "🔐 È richiesta una password",
  'enter_password' => "🔐 Inserisci la password",
  'start_download' => "📥 Avvia download",
  'no_file_selected' => "❌ Nessun file selezionato.",
  'upload_error' => "❌ Errore durante il caricamento.",
  'upload_text' => "⬆️ Carica",
  'upload_success' => "✅ Caricamento completato",
  'creating_zip' => "⏳ Creazione dell'archivio ZIP in corso...",
  'temp_dir_error' => "❌ Impossibile creare la cartella temporanea.",
  'error_upload_file' => "❌ Errore nel caricamento del file ",
  'wrong_password' => "❌ Password errata",
  'your_link' => "Il tuo link:",
  'copy' => "📋 Copia",
  'copied' => "✅ Copiato!",
  'share_files' => "📤 Condividi file",
  'drag_files' => "📂 Trascina i file qui o clicca",
  'password_optional' => "🔐 Password (opzionale)",
  'valid_once' => "⏳ Scaricabile solo una volta",
  'valid_1h' => "🕐 Valido per 1 ora",
  'valid_3h' => "🕒 Valido per 3 ore",
  'valid_6h' => "🕕 Valido per 6 ore",
  'valid_12h' => "🕛 Valido per 12 ore",
  'valid_1d' => "📅 Valido per 1 giorno",
  'valid_3d' => "📅 Valido per 3 giorni",
  'valid_7d' => "📅 Valido per 7 giorni",
  'valid_14d' => "📅 Valido per 14 giorni",
  'valid_30d' => "📅 Valido per 30 giorni",
  'valid_forever' => "📅 Valido indefinitamente",
  'upload_button' => "📤 Carica & crea link",
  'upload_button_only_upload' => "📤 Carica",
  'upload_button_send_email' => "📤 Carica & invia email",
  'uploading' => "📤 Caricamento dei file...",
  'selected_files' => "File selezionato",
  'selected_files_plural' => "File selezionati",
  'diskspace_error' => "❌ Spazio su disco insufficiente!",
  'diskspace_check_failed' => "⚠️ Controllo dello spazio su disco non riuscito!",
  'diskspace_required' => "Necessario:",
  'diskspace_free' => "Libero:",
  'send_email_yes' => "📧 Invia via email",
  'send_email_no' => "🔗 Crea solo il link",
  'uploader_email' => "📨 Il tuo indirizzo email (obbligatorio)",
  'recipient_email' => "📬 Tutti gli indirizzi email dei destinatari (obbligatorio)",
  'email_sent' => "✅ Ti è stata inviata un'email. Verifica il link.",
  'sent_title_uploader' => "Conferma il tuo upload",
  'sent_message_uploader' => "<p>Ciao,</p><p>Conferma il tuo upload cliccando sul link sottostante.</p><p>Cordiali saluti</p>",
  'verification_title' => "⚠️ Conferma richiesta",
  'verification_text' => "Per confermare l'upload, clicca sul seguente pulsante:",
  'verification_button' => "✅ Conferma upload",
  'verification_link_error' => "❌ Link non valido o manomesso.",
  'verification_database_error' => "❌ Database dei file mancante.",
  'verification_token_error' => "❌ Upload non trovato.",
  'verification_email_error' => "❌ L'email non corrisponde all'upload.",
  'verification_verified_error' => "✅ Questo upload è già stato confermato.",
  'verification_recipient_error' => "❌ Destinatario o link non valido.",
  'sent_title_recipient' => "Il tuo link per il download",
  'sent_message_recipient1' => "<p>Ciao,</p><p>Hai ricevuto un file da ",
  'sent_message_recipient2' => ".</p><p>Ora puoi scaricare il file dal link sottostante.</p><p>Cordiali saluti</p>",
  'verification_success' => "✅ Caricamento verificato. I destinatari sono stati notificati.",
  'admin_panel' => "⚙️ Pannello di amministrazione",
  'admin_setup' => "⚙️ Configurazione amministratore",
  'admin_login' => "⚙️ Accesso amministratore",
  'user_login' => "➡️ Accesso utente",
  'user_register' => "⚠️ Si prega di configurare un account utente nel pannello di amministrazione",
  'username' => "Nome utente",
  'password' => "Password",
  'password_confirm' => "Conferma password",
  'register_error' => "Inserisci nome utente e password",
  'password_error' => "Le password non corrispondono",
  'login_error' => "❌ Accesso non riuscito",
  'entry_delete' => "✅ Voce eliminata",
  'mode_change' => "✅ Modalità cambiata in ",
  'verification_change' => "✅ Stato di verifica modificato",
  'password_change' => "✅ Password modificata",
  'noentry' => "Nessuna voce trovata",
  'th_file' => "File e link esterno",
  'th_size' => "Dimensione",
  'th_uploaddate' => "Data di caricamento",
  'th_expirationdate' => "Data di scadenza",
  'th_mode' => "Modalità",
  'th_status' => "Ultimo download",
  'th_password' => "Password",
  'th_email' => "E-Mails",
  'th_actions' => "Azioni",
  'password_set' => "🔐 Password impostata",
  'password_notset' => "🔓 Nessuna password impostata",
  'password_notice' => "🔑 Nuova password (lasciare vuoto = eliminare)",
  'uploader' => "Mittente",
  'recipient' => "Destinatario",
  'save_button' => "💾 Salva",
  'download_button' => "📥 Scarica",
  'delete_button' => "❌ Elimina",
  'create_admin_button' => "👤➕ Crea amministratore",
  'login_button' => "➡️ Accedi",
  'logout_button' => "🔚 Esci",
  'delete_confirm' => "Vuoi davvero eliminare?",
  'show_uploads_button' => "📄 Mostra upload",
  'hide_uploads_button' => "📄 Nascondi upload",
  'search_placeholder' => "🔍 Cerca nome file, dimensione, data o email",
  'verified' => "verificato",
  'notverified' => "non verificato",
  'general_configuration' => "⚙️ Configurazione generale",
  'lang_title' => "🌍 Lingua predefinita",
  'timezone_title' => "🕒 Fuso orario",
  'admin_email_title' => "📧 Indirizzo email dell’amministratore",
  'admin_notify_mode' => "📧 Notifica l’amministratore via email per nuovi caricamenti",
  'sent_title_admin' => "Nuovo upload creato",
  'token' => "Token",
  'file' => "File",
  'sent_message_admin' => "Questo messaggio è stato generato automaticamente.",
  'values_title' => "⚙️ Valori",
  'configuration_save_button' => "💾 Salva configurazione",
  'configuration_save' => "✅ Configurazione salvata",
  'only_upload_mode' => "📤 Modalità solo upload (nessuna generazione di link)",
  'user_upload_mode' => "👤 Consenti upload solo con account utente",
  'send_email_mode' => "📧 Attiva modalità email (nessuna generazione di link)",
  'showdp_mode' => "📥 Mostrare la pagina di download (nessun download diretto)",
  'pwzip_mode' => "🔐 Proteggi il file ZIP con una password (non solo per il download, la password non può essere modificata)",
  'smtp_configuration' => "📧 Configurazione server email (.env)",
  'smtphost_title' => "🌐 Host SMTP",
  'smtpport_title' => "🔌 Porta SMTP (deve essere la porta SSL 465)",
  'smtpuser_title' => "👤 Utente SMTP",
  'smtppass_title' => "🔐 Password SMTP",
  'smtpfrom_title' => "📧 Indirizzo SMTP FROM (mittente)",
  'smtp_save_button' => "💾 Salva impostazioni SMTP",
  'smtp_save' => "✅ Configurazione SMTP salvata",
  'admin_configuration' => "🧑‍💻 Utente amministratore",
  'admin_save_button' => "💾 Salva amministratore",
  'admin_save' => "✅ Amministratore salvato",
  'user_configuration' => "👥 Gestione utenti",
  'user_existing_title' => "👤 Utenti esistenti",
  'user_date' => "Creato il",
  'user_add_title' => "👤➕ Crea nuovo utente",
  'user_add_button' => "➕ Aggiungi utente",
  'user_save' => "✅ Utente aggiunto",
  'user_error_exists' => "❌ L’utente esiste già",
  'user_error_notfound' => "❌ Utente non trovato",
  'user_empty' => "Nessun utente creato finora",
  'password_new' => "Nuova password",
  'uploaded_by' => "Caricato dall'utente",
  'language' => "Lingua",
  'title' => "Dropzone File Sharing",
  'version' => "V.3.1",
  'meta' => "Dropzone File Sharing consente la condivisione rapida e sicura di file, con controllo degli accessi, scadenze, protezione tramite password e invio email opzionale.",
  'footer_text' => "© 2025 di Kevin Tobler - <a href='https://kevintobler.ch' target='_blank'>www.kevintobler.ch</a> - <a href='disclaimer.php?lang={$lang}'>🛡️ Informativa sulla privacy e esclusione di responsabilità</a>",
  ]
];

// Use translations
$t = $T[$lang];