fix(i18n): ensure contact modal displays in correct language when opened
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 <noreply@anthropic.com>
This commit is contained in:
parent
ca0ea92790
commit
e2de187fa4
1 changed files with 11 additions and 3 deletions
|
|
@ -175,7 +175,7 @@
|
|||
|
||||
<!-- Success Message -->
|
||||
<div id="contact-success" class="hidden bg-green-50 border border-green-200 text-green-800 px-4 py-3 rounded">
|
||||
<span data-i18n="contact_modal.success_message">Thank you for contacting us! We will respond within 24 hours.</span>! We'll respond within 24 hours.
|
||||
<span data-i18n="contact_modal.success_message">Thank you for contacting us! We will respond within 24 hours.</span>
|
||||
</div>
|
||||
|
||||
<!-- Error Message -->
|
||||
|
|
@ -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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue