From e2de187fa40518b5af6f696e04436f4b7b42af50 Mon Sep 17 00:00:00 2001 From: TheFlow Date: Sun, 26 Oct 2025 18:37:40 +1300 Subject: [PATCH] fix(i18n): ensure contact modal displays in correct language when opened MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed issue where clicking "Kontakt" in German mode showed English contact form. Changes: - Re-apply translations when modal opens (ensures current language is used) - Use translated "submitting" text for sending state (DE: "Senden...", FR: "Envoi en cours...") - Use translated submit button text when re-enabled - Remove duplicate success message text Now clicking "Kontakt" in DE mode or "Nous contacter" in FR mode correctly shows the modal in that language. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- public/js/components/footer.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/public/js/components/footer.js b/public/js/components/footer.js index 14ff8cbf..b13cc16b 100644 --- a/public/js/components/footer.js +++ b/public/js/components/footer.js @@ -175,7 +175,7 @@ @@ -268,6 +268,10 @@ const openModal = () => { modal.classList.remove('hidden'); + // Re-apply translations to modal when opening + if (window.I18n && window.I18n.applyTranslations) { + window.I18n.applyTranslations(); + } document.getElementById('contact-name')?.focus(); }; @@ -313,7 +317,9 @@ // Disable submit button submitBtn.disabled = true; - submitBtn.textContent = 'Sending...'; + // Use translation if available, fallback to English + const sendingText = window.I18n?.translations?.contact_modal?.submitting || 'Sending...'; + submitBtn.textContent = sendingText; try { // Get CSRF token from cookie @@ -354,7 +360,9 @@ } finally { // Re-enable submit button submitBtn.disabled = false; - submitBtn.textContent = 'Send Message'; + // Use translation if available, fallback to English + const submitText = window.I18n?.translations?.contact_modal?.submit_button || 'Send Message'; + submitBtn.textContent = submitText; } }); }